aboutsummaryrefslogtreecommitdiffstats
path: root/nrf52/i2c_ring_buffer.h
blob: a274798d1c2b1b6b2fb72b4b699e78ba84a87ab2 (plain)
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