29 lines
573 B
C
29 lines
573 B
C
#ifndef __FIFO_H
|
|
#define __FIFO_H
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
#define FLASE 0
|
|
#define OK 1
|
|
#define RINGBUFF_LEN 128
|
|
|
|
|
|
typedef struct
|
|
{
|
|
uint16_t Head;
|
|
uint16_t Tail;
|
|
uint16_t Lenght;
|
|
uint16_t Ring_Buff[RINGBUFF_LEN];
|
|
}RingBuff_t;
|
|
|
|
|
|
//extern RingBuff_t co2RingBuff; //创建一个ringBuff的缓冲区
|
|
|
|
void RingBuff_Init(RingBuff_t *ringBuff); //初始化
|
|
uint8_t Write_RingBuff(RingBuff_t *ringBuff,uint8_t data); //写入
|
|
uint8_t Read_RingBuff(RingBuff_t *ringBuff,uint8_t *rData);//读取
|
|
uint8_t Read_Length_RingBuff(RingBuff_t *ringBuff);
|
|
#endif /* __FIFO_H */
|