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.
27 lines
425 B
27 lines
425 B
#ifndef FIFO_H
|
|
#define FIFO_H
|
|
|
|
#include "CH58x_common.h"
|
|
|
|
typedef struct {
|
|
uint8_t *Data;
|
|
uint16_t Size;
|
|
uint16_t Cap;
|
|
uint16_t Begin;
|
|
uint16_t End;
|
|
} Fifo_t;
|
|
|
|
void Fifo_Init(Fifo_t *fifo, uint8_t *data, uint16_t cap);
|
|
|
|
void Fifo_Push(Fifo_t *fifo, uint8_t data);
|
|
|
|
uint8_t Fifo_Pop(Fifo_t *fifo);
|
|
|
|
void Fifo_Clear(Fifo_t *fifo);
|
|
|
|
bool Fifo_IsEmpty(Fifo_t *fifo);
|
|
|
|
bool Fifo_IsFull(Fifo_t *fifo);
|
|
|
|
|
|
#endif
|
|
|