AceWire
0.4.0
Unified interface for selecting different I2C implementations on Arduino platforms
|
A thin wrapper around the SoftWire
class provided by the SWire project at https://github.com/RaemondBW/SWire so that it becomes compatible with the AceWire API.
More...
#include <RaemondWireInterface.h>
Public Member Functions | |
RaemondWireInterface (T_WIRE &wire) | |
Constructor. More... | |
void | begin () const |
Initial 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, and return the following status code: 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 SoftWire. More... | |
uint8_t | read () const |
Read byte from buffer. | |
RaemondWireInterface (const RaemondWireInterface &)=default | |
RaemondWireInterface & | operator= (const RaemondWireInterface &)=default |
A thin wrapper around the SoftWire
class provided by the SWire project at https://github.com/RaemondBW/SWire so that it becomes compatible with the AceWire API.
The SoftWire class uses a 32-byte RX buffer and a 32-byte TX buffer.
T_WIRE | underlying I2C class which will always be SoftWire |
Definition at line 41 of file RaemondWireInterface.h.
|
inlineexplicit |
Constructor.
wire | instance of SoftWire |
Definition at line 47 of file RaemondWireInterface.h.
|
inline |
Initial the interface.
Currently does nothing.
Definition at line 50 of file RaemondWireInterface.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 RaemondWireInterface.h.
|
inline |
|
inline |
Send the data in the buffer, and return the following status code:
sendStop | controls whether or not a STOP condition is sent at the end of the buffer. But the SWire implementation currently ignores this parameter and always sends a STOP condition. |
Definition at line 89 of file RaemondWireInterface.h.
|
inline |
Read bytes from the slave and store in buffer owned by SoftWire.
The sendStop
is supposed to control whether the STOP condition should be sent, but the SoftWire implementation does not provide this feature and always sends a STOP condition.
Definition at line 102 of file RaemondWireInterface.h.
|
inline |
Write data into the write buffer.
Definition at line 72 of file RaemondWireInterface.h.