Tasmota/lib/lib_i2c/Adafruit_BusIO/Adafruit_I2CDevice.h
Roberto Bonacina 9f752b9230 Adafruit_BusIO: bump library to version 1.11.0
The previous included version (1.0.10) was failing to read more than
32 bytes of data from I2C devices (tested on AMG8833 which typically
reads 128 bytes -whose support is in progress-).
The problem was fixed in version 1.9.0.
Currently, this library is required and used just by the
Adafruit_VEML7700 library.
The VEML7700 sensor has been tested and proved to correctly work.

Signed-off-by: Roberto Bonacina <roby.bonacina@tutanota.com>
2022-02-09 11:00:28 +01:00

37 lines
1.1 KiB
C++

#ifndef Adafruit_I2CDevice_h
#define Adafruit_I2CDevice_h
#include <Arduino.h>
#include <Wire.h>
///< The class which defines how we will talk to this device over I2C
class Adafruit_I2CDevice {
public:
Adafruit_I2CDevice(uint8_t addr, TwoWire *theWire = &Wire);
uint8_t address(void);
bool begin(bool addr_detect = true);
void end(void);
bool detected(void);
bool read(uint8_t *buffer, size_t len, bool stop = true);
bool write(const uint8_t *buffer, size_t len, bool stop = true,
const uint8_t *prefix_buffer = NULL, size_t prefix_len = 0);
bool write_then_read(const uint8_t *write_buffer, size_t write_len,
uint8_t *read_buffer, size_t read_len,
bool stop = false);
bool setSpeed(uint32_t desiredclk);
/*! @brief How many bytes we can read in a transaction
* @return The size of the Wire receive/transmit buffer */
size_t maxBufferSize() { return _maxBufferSize; }
private:
uint8_t _addr;
TwoWire *_wire;
bool _begun;
size_t _maxBufferSize;
bool _read(uint8_t *buffer, size_t len, bool stop);
};
#endif // Adafruit_I2CDevice_h