A thin wrapper around the SoftWire
class provided by the https://github.com/stevemarple/SoftWire project so that it becomes compatible with the AceWire interface.
More...
#include <MarpleWireInterface.h>
template<typename T_WIRE>
class ace_wire::MarpleWireInterface< T_WIRE >
A thin wrapper around the SoftWire
class provided by the https://github.com/stevemarple/SoftWire project so that it becomes compatible with the AceWire interface.
The SoftWire
class uses an RX buffer and a TX buffer whose sizes are defined by the end-user.
- Template Parameters
-
T_WIRE | underlying I2C class which will always be SoftWire |
Definition at line 41 of file MarpleWireInterface.h.
◆ MarpleWireInterface()
template<typename T_WIRE >
◆ begin()
template<typename T_WIRE >
◆ beginTransmission()
template<typename T_WIRE >
Prepare the write buffer to accept a sequence of data, and save the addr for transmission when endTransmission()
is called.
- Returns
- always returns 0 to indicate success because the
addr
is simply written into a buffer
Definition at line 62 of file MarpleWireInterface.h.
◆ end()
template<typename T_WIRE >
◆ endTransmission()
template<typename T_WIRE >
Send the data in the buffer, and return the following status code:
- 0: success
- 1: length too long for buffer
- 2: address send, NACK received
- 3: data send, NACK received
- 4: other twi error (lost bus arbitration, bus error, ..)
- Parameters
-
sendStop | controls whether or not a STOP condition is sent at the end of the buffer |
Definition at line 88 of file MarpleWireInterface.h.
◆ requestFrom()
template<typename T_WIRE >
Read bytes from the slave and store in buffer owned by SoftWire.
- Parameters
-
addr | I2C address |
quantity | number of bytes to read |
sendStop | whether the STOP condition should be sent at end |
- Returns
- the value returned by the underlying SoftWire::requestFrom() method, which will normally be 'quantity'.
Definition at line 102 of file MarpleWireInterface.h.
◆ write()
template<typename T_WIRE >
Write data into the write buffer.
- Returns
- the number of bytes written into buffer, which will always be 1
Definition at line 72 of file MarpleWireInterface.h.
The documentation for this class was generated from the following file: