This program utilizes the mcr20 Thread Shield on the FRDM-K64F MCU which is a two-part workspace (HVAC Server (RX)/Probe(TX)) to handle low temperature events read at the probe(s) to prevent pipes from freezing.

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by NXP

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers circular_buffer.h Source File

circular_buffer.h

00001 #ifndef __CIRCULAR_BUFFER_H__
00002 #define __CIRCULAR_BUFFER_H__
00003 
00004 #include "EmbeddedTypes.h"
00005 #include "MemManager.h"
00006 
00007 #ifndef gCircularBufferSize_c
00008 #define gCircularBufferSize_c 32
00009 #endif
00010 
00011 typedef enum bufferStatus_tag
00012 {
00013     buffer_Ok_c = 0,
00014     buffer_Empty_c,
00015     buffer_Full_c
00016 }bufferStatus_t;
00017 
00018 class CircularBuffer {
00019   public:
00020     CircularBuffer();
00021     CircularBuffer(uint32_t sz);
00022     ~CircularBuffer();
00023     bufferStatus_t addToBuffer (uint8_t c);
00024     bufferStatus_t getFromBuffer (uint8_t *c);
00025     uint32_t getCount();
00026   private:
00027     uint8_t *buffer;
00028     uint32_t size;
00029     uint32_t readIndex;
00030     uint32_t writeIndex; 
00031     uint32_t count;
00032 };
00033 
00034 #endif