You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
770 B
26 lines
770 B
/********************************************************************************************** |
|
描述 : 环形缓冲区读写 |
|
作者 : |
|
版本 :V1.0 |
|
修改 : |
|
完成日期 : |
|
Notice : |
|
***********************************************************************************************/ |
|
|
|
#ifndef __RINGBUFFER_H__ |
|
#define __RINGBUFFER_H__ |
|
#include "n32g45x.h" |
|
|
|
#define BUFFER_MAX 1024 //缓冲区大小 |
|
typedef struct |
|
{ |
|
unsigned int headPos; //缓冲区头部位置 |
|
unsigned int tailPos; //缓冲区尾部位置 |
|
unsigned char ringBuf[BUFFER_MAX];//缓冲区数组 |
|
} RingBuffer_T; |
|
|
|
void RingBuf_Init(RingBuffer_T *pbuf); |
|
void RingBuf_Write(RingBuffer_T *pbuf, unsigned char data); |
|
uint8_t RingBuf_Read(RingBuffer_T *pbuf, unsigned char* pData); |
|
|
|
#endif /* __RINGBUFFER_H__ */
|
|
|