#ifndef CIRCULAR_BUFFER_H #define CIRCULAR_BUFFER_H #include "config.h" #include "include/wifi.h" void cbuf_init(); void cbuf_fill_buffer(); void cbuf_fill_buffer_force(); Byte cbuf_push_element(Byte element_a); Int16 cbuf_space(); #define CBUF_SIZE 2000 #define CBUF_SIZE_MINUS_ONE CBUF_SIZE-1 // doesn't check for underflow // do it on your own // Byte cbuf_pop_element(); extern __xdata Byte circular_buffer[CBUF_SIZE]; extern Int16 cbuf_head; extern Int16 cbuf_tail; #define cbuf_empty() (cbuf_head==cbuf_tail) #define cbuf_full() (cbuf_tail==(cbuf_head-1) || (cbuf_head==0 && cbuf_tail==CBUF_SIZE_MINUS_ONE)) #endif