PL::I2C class

class I2C : public PL::Lockable

I2C class.

Public Functions

I2C(i2c_port_num_t port, gpio_num_t sdaPin, gpio_num_t sclPin, bool enableInternalPullUp = false)

Creates an I2C.

Parameters:
  • port – port number

  • sdaPin – SDA pin

  • sclPin – SCL pin

  • enableInternalPullUp – enable internal pull-up resistors (only for controller)

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 I2C.

Returns:

error code