From 1c64cf73cde5b15f02d5a4d7ba4e611ea4d05316 Mon Sep 17 00:00:00 2001 From: Robert Gustafsson Date: Thu, 28 Sep 2017 14:34:18 +0200 Subject: Move includes folder to broccoli --- broccoli/includes/fifoqueue.h | 15 +++++++++++++++ broccoli/includes/types.h | 29 +++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 broccoli/includes/fifoqueue.h create mode 100644 broccoli/includes/types.h (limited to 'broccoli/includes') diff --git a/broccoli/includes/fifoqueue.h b/broccoli/includes/fifoqueue.h new file mode 100644 index 0000000..9ee5c53 --- /dev/null +++ b/broccoli/includes/fifoqueue.h @@ -0,0 +1,15 @@ +#include +#include +#include "types.h" + +Fifo_q * init_queue(int size); + +boolean is_full(Fifo_q * q); + +boolean is_empty(Fifo_q * q); + +int add_to_queue(Fifo_q * q, Sensor_t * sensor); + +Sensor_t * pop_from_queue(Fifo_q * q); + +void print_queue(Fifo_q * q); diff --git a/broccoli/includes/types.h b/broccoli/includes/types.h new file mode 100644 index 0000000..a8fa1cf --- /dev/null +++ b/broccoli/includes/types.h @@ -0,0 +1,29 @@ +#ifndef TYPES_H +#define TYPES_H + +#define true 1 +#define false 0 + +typedef int boolean; +typedef struct sensor_t Sensor_t; +typedef struct queue_t Queue_t; +typedef struct fifo_q Fifo_q; + +struct sensor_t{ + int uid; + int value; +}; + +struct queue_t{ + Sensor_t * sensor; + Queue_t * next; +}; + +struct fifo_q{ + Queue_t * head; + Queue_t * tail; + int maxSize; + int currentSize; +}; + +#endif -- cgit v1.2.3