31#ifndef Adafruit_I2CDevice_h
32#define Adafruit_I2CDevice_h
47 bool begin(
bool addr_detect =
true);
51 bool read(uint8_t *buffer,
size_t len,
bool stop =
true);
52 bool write(
const uint8_t *buffer,
size_t len,
bool stop =
true,
53 const uint8_t *prefix_buffer =
nullptr,
size_t prefix_len = 0);
55 uint8_t *read_buffer,
size_t read_len,
67 size_t _maxBufferSize;
68 bool _read(uint8_t *buffer,
size_t len,
bool stop);
Adafruit I2CDevice Class for OLED.
size_t maxBufferSize()
How many bytes we can read in a transaction.
bool setSpeed(uint32_t desiredclk)
Change the I2C clock speed to desired (relies on underlying Wire support!
bool write(const uint8_t *buffer, size_t len, bool stop=true, const uint8_t *prefix_buffer=nullptr, size_t prefix_len=0)
Write a buffer or two to the I2C device. Cannot be more than maxBufferSize() bytes.
bool detected(void)
Scans I2C for the address - note will give a false-positive if there's no pullups on I2C.
bool begin(bool addr_detect=true)
Initializes and does basic address detection.
uint8_t address(void)
Returns the 7-bit address of this device.
bool write_then_read(const uint8_t *write_buffer, size_t write_len, uint8_t *read_buffer, size_t read_len, bool stop=false)
Write some data, then read some data from I2C into another buffer. Cannot be more than maxBufferSize(...
void end(void)
De-initialize device, turn off the Wire interface.
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire=&Wire)
Create an I2C device at a given address.
bool read(uint8_t *buffer, size_t len, bool stop=true)
Read from I2C into a buffer from the I2C device. Cannot be more than maxBufferSize() bytes.