AceWire
0.4.0
Unified interface for selecting different I2C implementations on Arduino platforms
|
A thin wrapper around the TwoWire
class from the https://github.com/thexeno/HardWire-Arduino-Library project so that it becomes compatible with the AceWire API.
More...
#include <ThexenoWireInterface.h>
Public Member Functions | |
ThexenoWireInterface (T_WIRE &wire) | |
Constructor. More... | |
void | begin () const |
Initialize the interface. More... | |
void | end () const |
End the interface. More... | |
uint8_t | beginTransmission (uint8_t addr) const |
Prepare the write buffer to accept a sequence of data, and save the addr for transmission when endTransmission() is called. More... | |
uint8_t | write (uint8_t data) const |
Write data into the write buffer. More... | |
uint8_t | endTransmission (bool sendStop=true) const |
Send the data in the buffer, with a STOP condition if sendStop is true. More... | |
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 is true. More... | |
uint8_t | read () const |
Read byte from the TwoWire receive buffer. | |
ThexenoWireInterface (const ThexenoWireInterface &)=default | |
ThexenoWireInterface & | operator= (const ThexenoWireInterface &)=default |
A thin wrapper around the TwoWire
class from the https://github.com/thexeno/HardWire-Arduino-Library project so that it becomes compatible with the AceWire API.
The HardWire library uses a TX buffer and an RX buffer of 32 bytes each.
T_WIRE | underlying I2C class which will always be TwoWire |
Definition at line 41 of file ThexenoWireInterface.h.
|
inlineexplicit |
Constructor.
wire | instance of HardWire |
Definition at line 47 of file ThexenoWireInterface.h.
|
inline |
Initialize the interface.
Currently does nothing.
Definition at line 50 of file ThexenoWireInterface.h.
|
inline |
Prepare the write buffer to accept a sequence of data, and save the addr for transmission when endTransmission()
is called.
addr
is simply written into a buffer Definition at line 62 of file ThexenoWireInterface.h.
|
inline |
|
inline |
Send the data in the buffer, with a STOP condition if sendStop
is true.
Returns the value returned by the underlying TwoWire::endTransmission() method, which returns the values documented in the twi_writeTo() function:
Definition at line 89 of file ThexenoWireInterface.h.
|
inline |
Read bytes from the slave and store in buffer owned by TwoWire and send a STOP condition if sendStop
is true.
addr | I2C address |
quantity | number of bytes to read |
sendStop | whether the STOP condition should be sent at end |
Definition at line 104 of file ThexenoWireInterface.h.
|
inline |
Write data into the write buffer.
Definition at line 72 of file ThexenoWireInterface.h.