Log data to a micro SD card.
Dependencies: SDFileSystem mbed
Diff: RingBuffer.h
- Revision:
- 1:c5e56e2580bf
diff -r 56d642e39289 -r c5e56e2580bf RingBuffer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/RingBuffer.h Mon May 04 07:10:55 2015 +0000 @@ -0,0 +1,26 @@ +#ifndef RING_BUFFER_H_ +#define RING_BUFFER_H_ + +#include "mbed.h" + +#define RING_BUFFER_SIZE 512 + +class RingBuffer{ +public: + void initialize_buffer(); + int16_t buffer_size(); + uint8_t read_buffer_byte(); + int16_t read_buffer_short(); + void read_buffer(uint8_t buf[], int16_t offset, int16_t size); + int16_t buffer_capacity(); + void write_buffer_byte(uint8_t ch); + void write_buffer(const uint8_t buf[], int16_t offset, int16_t size); + bool is_buffer_empty(); + +protected: + uint8_t buffer[RING_BUFFER_SIZE]; + int16_t start; + int16_t end; +}; + +#endif /* RING_BUFFER_H_ */ \ No newline at end of file