tca9548 - Driver for TCA9548A/PCA9548A low-voltage 8-channel I2C switch

group tca9548

ESP-IDF driver for low-voltage 8-channel I2C switch TCA9548/PCA9548.

Copyright (C) 2020 Ruslan V. Uss unclerus@gmail.com

BSD Licensed as described in the file LICENSE

Defines

TCA9548_ADDR_0
TCA9548_ADDR_1
TCA9548_ADDR_2
TCA9548_ADDR_3
TCA9548_ADDR_4
TCA9548_ADDR_5
TCA9548_ADDR_6
TCA9548_ADDR_7
BV(x)
TCA9548_CHANNEL0
TCA9548_CHANNEL1
TCA9548_CHANNEL2
TCA9548_CHANNEL3
TCA9548_CHANNEL4
TCA9548_CHANNEL5
TCA9548_CHANNEL6
TCA9548_CHANNEL7

Functions

esp_err_t tca9548_init_desc(i2c_dev_t *dev, i2c_port_t port, uint8_t addr, gpio_num_t sda_gpio, gpio_num_t scl_gpio)

Initialize device descriptor.

Parameters
  • dev – Device descriptor

  • port – I2C port

  • addr – Device address

  • sda_gpio – SDA GPIO pin

  • scl_gpio – SCL GPIO pin

Returns

ESP_OK on success

esp_err_t tca9548_free_desc(i2c_dev_t *dev)

Free device descriptor.

Parameters

dev – Device descriptor

Returns

ESP_OK on success

esp_err_t tca9548_set_channels(i2c_dev_t *dev, uint8_t channels)

Switch channels.

Parameters
  • dev – Device descriptor

  • channels – Channel flags, combination of TCA9548_CHANNELn

Returns

ESP_OK on success

esp_err_t tca9548_get_channels(i2c_dev_t *dev, uint8_t *channels)

Read current channels configuration.

Parameters
  • dev – Device descriptor

  • [out] channels – Channel flags, combination of TCA9548_CHANNELn

Returns

ESP_OK on success