adds a queue library, work for keyb driver
This commit is contained in:
25
libc/include/queue.h
Normal file
25
libc/include/queue.h
Normal file
@ -0,0 +1,25 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#ifndef QUEUE_H
|
||||
#define QUEUE_H
|
||||
|
||||
#define MAX_QUEUE_SIZE 100
|
||||
|
||||
typedef struct {
|
||||
uint8_t items[MAX_QUEUE_SIZE];
|
||||
short front;
|
||||
short rear;
|
||||
} queue;
|
||||
|
||||
void init_queue(queue* q);
|
||||
|
||||
bool queue_is_empty(queue* q);
|
||||
bool queue_is_full(queue* q);
|
||||
|
||||
void enqueue(queue* q, uint8_t val);
|
||||
void dequeue(queue* q);
|
||||
|
||||
uint8_t queue_peek(queue* q);
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user