diff options
author | Brian Cully <bjc@kublai.com> | 2019-06-13 18:00:42 -0400 |
---|---|---|
committer | Brian Cully <bjc@kublai.com> | 2019-06-22 16:18:03 -0400 |
commit | fad3038b035db90c59f297891835d37fd97b79c5 (patch) | |
tree | e99ab8e4de5130dc9aca5ad35f3c6b8e0e82d263 /nrf52/i2c_ring_buffer.h | |
download | usb2btle-fad3038b035db90c59f297891835d37fd97b79c5.tar.gz usb2btle-fad3038b035db90c59f297891835d37fd97b79c5.zip |
Initial commit.
Diffstat (limited to 'nrf52/i2c_ring_buffer.h')
-rw-r--r-- | nrf52/i2c_ring_buffer.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/nrf52/i2c_ring_buffer.h b/nrf52/i2c_ring_buffer.h new file mode 100644 index 0000000..a274798 --- /dev/null +++ b/nrf52/i2c_ring_buffer.h @@ -0,0 +1,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 |