1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#ifndef I2C_RING_BUFFER_H #define I2C_RING_BUFFER_H #include <stdint.h> #define RINGBUFLEN 256 class I2CRingBuffer { public: I2CRingBuffer(); bool read(uint8_t *); void write(uint8_t); private: volatile uint8_t buf[RINGBUFLEN]; volatile uint8_t head; volatile uint8_t tail; }; #endif