Rock, Paper, Scissors game - remote controller

Dependencies:   fsl_phy_mcr20a fsl_smac mbed-rtos mbed

Fork of mcr20_RPS_GameController by Freescale

Committer:
mnorman4
Date:
Tue Nov 17 17:15:28 2015 +0000
Revision:
0:7654345263e0
Initial commit of Rock, Paper, Scissors game remote control

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mnorman4 0:7654345263e0 1 #ifndef __CIRCULAR_BUFFER_H__
mnorman4 0:7654345263e0 2 #define __CIRCULAR_BUFFER_H__
mnorman4 0:7654345263e0 3
mnorman4 0:7654345263e0 4 #include "EmbeddedTypes.h"
mnorman4 0:7654345263e0 5 #include "MemManager.h"
mnorman4 0:7654345263e0 6
mnorman4 0:7654345263e0 7 #ifndef gCircularBufferSize_c
mnorman4 0:7654345263e0 8 #define gCircularBufferSize_c 32
mnorman4 0:7654345263e0 9 #endif
mnorman4 0:7654345263e0 10
mnorman4 0:7654345263e0 11 typedef enum bufferStatus_tag
mnorman4 0:7654345263e0 12 {
mnorman4 0:7654345263e0 13 buffer_Ok_c = 0,
mnorman4 0:7654345263e0 14 buffer_Empty_c,
mnorman4 0:7654345263e0 15 buffer_Full_c
mnorman4 0:7654345263e0 16 }bufferStatus_t;
mnorman4 0:7654345263e0 17
mnorman4 0:7654345263e0 18 class CircularBuffer {
mnorman4 0:7654345263e0 19 public:
mnorman4 0:7654345263e0 20 CircularBuffer();
mnorman4 0:7654345263e0 21 CircularBuffer(uint32_t sz);
mnorman4 0:7654345263e0 22 ~CircularBuffer();
mnorman4 0:7654345263e0 23 bufferStatus_t addToBuffer (uint8_t c);
mnorman4 0:7654345263e0 24 bufferStatus_t getFromBuffer (uint8_t *c);
mnorman4 0:7654345263e0 25 uint32_t getCount();
mnorman4 0:7654345263e0 26 private:
mnorman4 0:7654345263e0 27 uint8_t *buffer;
mnorman4 0:7654345263e0 28 uint32_t size;
mnorman4 0:7654345263e0 29 uint32_t readIndex;
mnorman4 0:7654345263e0 30 uint32_t writeIndex;
mnorman4 0:7654345263e0 31 uint32_t count;
mnorman4 0:7654345263e0 32 };
mnorman4 0:7654345263e0 33
mnorman4 0:7654345263e0 34 #endif