33 #define BUFFER_LENGTH 32
35 class TwoWire :
public Stream
39 static uint8_t rxBuffer[];
40 static uint8_t rxBufferIndex;
41 static uint8_t rxBufferLength;
43 static uint8_t txAddress;
44 static uint8_t txBuffer[];
45 static uint8_t txBufferIndex;
46 static uint8_t txBufferLength;
48 static uint8_t transmitting;
52 void begin(uint8_t address);
53 void begin(
int address);
55 void setClock(uint32_t clock);
57 void beginTransmission(uint8_t address);
58 void beginTransmission(
int address);
59 uint8_t endTransmission(
void);
61 size_t requestFrom(uint8_t address,
size_t size);
62 uint8_t requestFrom(uint8_t address, uint8_t quantity);
63 uint8_t requestFrom(
int address,
int quantity);
65 size_t write(uint8_t
data);
66 size_t write(
const uint8_t *
data,
size_t quantity);
72 inline size_t write(
unsigned long n)
74 return write((uint8_t)n);
76 inline size_t write(
long n)
78 return write((uint8_t)n);
80 inline size_t write(
unsigned int n)
82 return write((uint8_t)n);
84 inline size_t write(
int n)
86 return write((uint8_t)n);