AceWire
0.1.0
Unified interface for selecting different I2C implementations on Arduino platforms
|
A thin wrapper around an I2C TwoWire
class and its Wire
object.
More...
#include <TwoWireInterface.h>
Public Member Functions | |
TwoWireInterface (T_WIRE &wire) | |
Constructor. More... | |
void | begin () |
Initial the interface. More... | |
void | end () |
End the interface. More... | |
void | beginTransmission (uint8_t addr) |
Start transmission at specified I2C addr. | |
void | write (uint8_t data) |
Write data. | |
void | endTransmission () |
End transmission. | |
A thin wrapper around an I2C TwoWire
class and its Wire
object.
This is a template class to avoid including the <Wire.h> header file, which increases flash memory on AVR by about 1000 byte even if the Wire object is never used.
This wrapper can also be used with alternative implementations of I2C (software or hardware) so long as they implement some basic API of the TwoWire
class: specifically the beginTransmission()
, write()
and endTransmission() methods. Since
TwoWireInterface` is a template, the alternative implementation classes do not need to inherit from the TwoWire
class.
Definition at line 45 of file TwoWireInterface.h.
|
inline |
Constructor.
wire | instance of T_WIRE . If the pre-installed Wire.h is used, then T_WIRE is TwoWire and wire is the precreated Wire object |
Definition at line 53 of file TwoWireInterface.h.
|
inline |
|
inline |