PL::I2CController class
- 
class I2CController : public PL::Lockable
 I2C controller class.
Public Functions
Creates an I2C controller.
- Parameters:
 i2c – I2C interface
targetAddress – target address
sclFrequency – SCL frequency in Hz
- 
virtual esp_err_t Lock(TickType_t timeout = portMAX_DELAY) override
 Locks the object.
- Parameters:
 timeout – timeout in FreeRTOS ticks
- Returns:
 error code
- 
virtual esp_err_t Unlock() override
 Unlocks the object.
- Returns:
 error code
- 
esp_err_t Initialize()
 Initializes the controller.
- Returns:
 error code
- 
esp_err_t Read(void *dest, size_t size)
 Reads the data from the I2C target.
- Parameters:
 dest – destination
size – number of bytes to read
- Returns:
 error code
- 
esp_err_t Write(const void *src, size_t size)
 Writes the data to the I2C target.
- Parameters:
 src – source
size – number of bytes to write
- Returns:
 error code
- 
esp_err_t WriteAndRead(const void *src, size_t srcSize, void *dest, size_t destSize)
 Writes the data to the I2C target and reads the data from the I2C target in a single transaction.
- Parameters:
 src – write data source
size – number of bytes to write
src – read data destination
size – number of bytes to read
- Returns:
 error code
- 
TickType_t GetTimeout()
 Gets the operation timeout.
- Returns:
 timeout in FreeRTOS ticks
- 
esp_err_t SetTimeout(TickType_t timeout)
 Sets the operation timeout.
- Parameters:
 timeout – timeout in FreeRTOS ticks
- Returns:
 error code
Public Static Attributes
- 
static const TickType_t defaultTimeout = 2
 Default operation timeout in FreeRTOS ticks.