| 1234567891011121314151617181920212223242526 |
- #ifndef _FIFO_H_
- #define _FIFO_H_
- #include "../User/gd32f10x_it.h"
- #define MAXSIZE 8
- typedef struct _fifo_data_{
- uint8_t da[256];
- uint8_t len;
- }__attribute__((packed))fifoDa;
- typedef struct _fifo_{
- fifoDa memory[8];
- uint8_t front;
- uint8_t rear;
- bool flag;
- }__attribute__((packed)) FIFO_T;
- extern FIFO_T g_rxfifo;
- extern FIFO_T g_txfifo;
- extern void init_fifo(FIFO_T *fifo);
- extern bool fifo_is_full(FIFO_T *fifo);
- extern bool fifo_is_empty(FIFO_T *fifo);
- extern uint8_t fifo_write(FIFO_T *fifo,uint8_t *data,uint8_t len);
- extern uint8_t fifo_read(FIFO_T *fifo,uint8_t *data);
- #endif
|