|
| I2CWrapper (HardwareI2C &i2c) |
|
| I2CWrapper (I2CSource &source) |
|
int | available () |
|
void | begin () |
|
void | begin (uint8_t address) |
|
void | beginTransmission (uint8_t address) |
|
void | end () |
|
uint8_t | endTransmission (bool stopBit) |
|
uint8_t | endTransmission (void) |
|
void | onReceive (void(*)(int)) |
|
void | onRequest (void(*)(void)) |
|
int | peek () |
|
int | read () |
|
size_t | requestFrom (uint8_t address, size_t len) |
|
size_t | requestFrom (uint8_t address, size_t len, bool stopBit) |
|
void | setClock (uint32_t freq) |
|
void | setI2C (HardwareI2C *i2c) |
| defines the i2c implementation: use nullptr to reset.
|
|
void | setSource (I2CSource *source) |
| alternatively defines a class that provides the I2C implementation
|
|
size_t | write (uint8_t) |
|
bool | find (char target) |
|
bool | find (const char *target) |
|
bool | find (const char *target, size_t length) |
|
bool | find (const uint8_t *target) |
|
bool | find (const uint8_t *target, size_t length) |
|
bool | findUntil (const char *target, const char *terminator) |
|
bool | findUntil (const char *target, size_t targetLen, const char *terminate, size_t termLen) |
|
bool | findUntil (const uint8_t *target, const char *terminator) |
|
bool | findUntil (const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen) |
|
unsigned long | getTimeout (void) |
|
float | parseFloat (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR) |
|
long | parseInt (LookaheadMode lookahead=SKIP_ALL, char ignore=NO_IGNORE_CHAR) |
|
size_t | readBytes (char *buffer, size_t length) |
|
size_t | readBytes (uint8_t *buffer, size_t length) |
|
size_t | readBytesUntil (char terminator, char *buffer, size_t length) |
|
size_t | readBytesUntil (char terminator, uint8_t *buffer, size_t length) |
|
String | readString () |
|
String | readStringUntil (char terminator) |
|
void | setTimeout (unsigned long timeout) |
|
virtual int | availableForWrite () |
|
void | clearWriteError () |
|
virtual void | flush () |
|
int | getWriteError () |
|
size_t | print (char) |
|
size_t | print (const __FlashStringHelper *) |
|
size_t | print (const char[]) |
|
size_t | print (const Printable &) |
|
size_t | print (const String &) |
|
size_t | print (double, int=2) |
|
size_t | print (int, int=DEC) |
|
size_t | print (long long, int=DEC) |
|
size_t | print (long, int=DEC) |
|
size_t | print (unsigned char, int=DEC) |
|
size_t | print (unsigned int, int=DEC) |
|
size_t | print (unsigned long long, int=DEC) |
|
size_t | print (unsigned long, int=DEC) |
|
size_t | println (char) |
|
size_t | println (const __FlashStringHelper *) |
|
size_t | println (const char[]) |
|
size_t | println (const Printable &) |
|
size_t | println (const String &s) |
|
size_t | println (double, int=2) |
|
size_t | println (int, int=DEC) |
|
size_t | println (long long, int=DEC) |
|
size_t | println (long, int=DEC) |
|
size_t | println (unsigned char, int=DEC) |
|
size_t | println (unsigned int, int=DEC) |
|
size_t | println (unsigned long long, int=DEC) |
|
size_t | println (unsigned long, int=DEC) |
|
size_t | println (void) |
|
size_t | write (const char *buffer, size_t size) |
|
size_t | write (const char *str) |
|
virtual size_t | write (const uint8_t *buffer, size_t size) |
|
I2C wrapper class that provides flexible hardware abstraction.
I2CWrapper is a concrete implementation of the HardwareI2C interface that supports multiple delegation patterns for I2C communication. It can delegate operations to:
- An injected HardwareI2C implementation
- An I2CSource provider that supplies the I2C implementation
- A default fallback implementation
This class implements the complete I2C interface including:
- Master/slave mode initialization and control
- Data transmission and reception methods
- Stream-like read/write operations with buffering
- Callback registration for slave mode operations
- Clock frequency configuration
The wrapper automatically handles null safety and provides appropriate default return values when no underlying I2C implementation is available.
A global Wire
instance is automatically provided for Arduino compatibility.
- See also
- HardwareI2C
-
I2CSource