Skip to content

Commit

Permalink
*p_byte
Browse files Browse the repository at this point in the history
  • Loading branch information
Chong Liu committed Jan 27, 2024
1 parent 25beeef commit feac915
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions F01_Common_Functions/inc/common_ring_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* @Author : Chong Liu
* @CreateDate : 2023-10-21 14:22:20
* @LastEditors : Chong Liu
* @LastEditTime : 2024-01-27 12:01:17
* @LastEditTime : 2024-01-27 12:01:47
* =================================================================================
* Copyright (c) 2023 by Chong Liu, All Rights Reserved.
* =================================================================================
Expand Down Expand Up @@ -34,7 +34,7 @@ typedef struct {
/**********************************************************************************/
int16_t RingBuffer_Init(RingBuffer *p_ring, uint8_t *p_buff, int16_t buff_len); /* Initialize a ring buffer */
int16_t RingBuffer_AddByte(RingBuffer *p_ring, uint8_t byte); /* Add a byte to the ring buffer */
int16_t RingBuffer_GetByte(RingBuffer *p_ring, uint8_t *pByte); /* Get a byte from the ring buffer */
int16_t RingBuffer_GetByte(RingBuffer *p_ring, uint8_t *p_byte); /* Get a byte from the ring buffer */

/**********************************************************************************/
/* */
Expand Down
6 changes: 3 additions & 3 deletions F01_Common_Functions/src/common_ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,10 @@ int16_t RingBuffer_AddByte(RingBuffer *p_ring, uint8_t byte) {
* @description: 从环形 buffer 中取出一个字节
* =================================================================================
* @param {RingBuffer} *p_ring
* @param {uint8_t} *pByte
* @param {uint8_t} *p_byte
* @return {int16_t}
*/
int16_t RingBuffer_GetByte(RingBuffer *p_ring, uint8_t *pByte) {
int16_t RingBuffer_GetByte(RingBuffer *p_ring, uint8_t *p_byte) {
/* 指针空检验 */
RETURN_ERR_IF(pRing == NULL);
RETURN_ERR_IF(pByte == NULL);
Expand All @@ -88,7 +88,7 @@ int16_t RingBuffer_GetByte(RingBuffer *p_ring, uint8_t *pByte) {
}

/* 取出一个字节 */
*pByte = pRing->pBuff[pRing->data_idx];
*p_byte = pRing->pBuff[pRing->data_idx];
pRing->data_idx++;

/* 当idx越界时归零 */
Expand Down

0 comments on commit feac915

Please sign in to comment.