Thread UART

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_wireless_uart by samuel belete

Revision:
27:1eb29717bfd9
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/circular_buffer.h	Mon Jun 29 05:50:47 2015 +0000
@@ -0,0 +1,34 @@
+#ifndef __CIRCULAR_BUFFER_H__
+#define __CIRCULAR_BUFFER_H__
+
+#include "EmbeddedTypes.h"
+#include "MemManager.h"
+
+#ifndef gCircularBufferSize_c
+#define gCircularBufferSize_c 32
+#endif
+
+typedef enum bufferStatus_tag
+{
+    buffer_Ok_c = 0,
+    buffer_Empty_c,
+    buffer_Full_c
+}bufferStatus_t;
+
+class CircularBuffer {
+  public:
+    CircularBuffer();
+    CircularBuffer(uint32_t sz);
+    ~CircularBuffer();
+    bufferStatus_t addToBuffer (uint8_t c);
+    bufferStatus_t getFromBuffer (uint8_t *c);
+    uint32_t getCount();
+  private:
+    uint8_t *buffer;
+    uint32_t size;
+    uint32_t readIndex;
+    uint32_t writeIndex; 
+    uint32_t count;
+};
+
+#endif
\ No newline at end of file