AceWire
0.4.0
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>
72 mWire.beginTransmission(addr);
81 uint8_t
write(uint8_t data)
const {
82 return (uint8_t) mWire.write(data);
99 return mWire.endTransmission(sendStop);
113 uint8_t
requestFrom(uint8_t addr, uint8_t quantity,
bool sendStop =
true)
115 return mWire.requestFrom(addr, quantity, (uint8_t) sendStop);
TwoWireInterface(T_WIRE &wire)
Constructor.
uint8_t read() const
Read byte from the TwoWire receive buffer.
void begin() const
Initialize the interface.
uint8_t beginTransmission(uint8_t addr) const
Prepare the write buffer to accept a sequence of data, and save the addr for transmission when endTra...
uint8_t endTransmission(bool sendStop=true) const
Send the data in the buffer, with a STOP condition if sendStop is true.
A thin wrapper around the default TwoWire class and its Wire object provided by most Arduino platform...
void end() const
End the interface.
uint8_t requestFrom(uint8_t addr, uint8_t quantity, bool sendStop=true) const
Read bytes from the slave and store in buffer owned by TwoWire and send a STOP condition if sendStop ...
uint8_t write(uint8_t data) const
Write data into the write buffer.