FabGL
ESP32 Display Controller and Graphics Library
|
I2C class allows multiple tasks to communicate with I2C devices, serializing read/write jobs. More...
#include <tsi2c.h>
Public Member Functions | |
I2C (int bus=0) | |
I2C class constructor. More... | |
bool | begin (gpio_num_t SDAGPIO, gpio_num_t SCLGPIO) |
Initializes I2C instance associating GPIOs to I2C signals. More... | |
int | getMaxBufferLength () |
Returns maximum size of read and write buffers. More... | |
int | read (int address, uint8_t *buffer, int size, int frequency=100000, int timeOutMS=50) |
Receives a buffer from I2C bus. More... | |
bool | write (int address, uint8_t *buffer, int size, int frequency=100000, int timeOutMS=50) |
Sends a buffer to I2C bus. More... | |
I2C class allows multiple tasks to communicate with I2C devices, serializing read/write jobs.
A single instance of I2C class can be shared among multiple tasks or timers (not interrupts).
Example:
fabgl::I2C I2C; void setup() { I2C.begin(GPIO_NUM_4, GPIO_NUM_15); // 4 = SDA, 15 = SCL (WARN: disconnect VGA connector!!) }