|
AceWire
0.3.2
Unified interface for selecting different I2C implementations on Arduino platforms
|
25 #ifndef ACE_WIRE_TWO_WIRE_INTERFACE_H
26 #define ACE_WIRE_TWO_WIRE_INTERFACE_H
49 template <
typename T_WIRE>
76 mWire.beginTransmission(addr);
89 return (uint8_t) mWire.write(data);
107 return mWire.endTransmission(sendStop);
112 return mWire.endTransmission();
124 uint8_t
requestFrom(uint8_t addr, uint8_t quantity,
bool sendStop) {
125 return mWire.requestFrom(addr, quantity, (uint8_t) sendStop);
141 return mWire.requestFrom(addr, quantity);
TwoWireInterface(T_WIRE &wire)
Constructor.
uint8_t endTransmission()
Same as endTransmission(bool) but always send STOP condition.
uint8_t read()
Read byte from buffer.
void end()
End the interface.
uint8_t endTransmission(bool sendStop)
Send the data in the buffer, with a STOP condition if sendStop is true.
A thin wrapper around an I2C TwoWire class and its Wire object.
uint8_t write(uint8_t data)
Write data into the write buffer.
void begin()
Initial the interface.
uint8_t beginTransmission(uint8_t addr)
Prepare the write buffer to accept a sequence of data, and save the addr for transmission when endTra...
uint8_t requestFrom(uint8_t addr, uint8_t quantity)
Read bytes from the slave and store in buffer owned by T_WIRE, and always send a STOP condition.
uint8_t requestFrom(uint8_t addr, uint8_t quantity, bool sendStop)
Read bytes from the slave and store in buffer owned by T_WIRE and send a STOP condition if sendStop i...