pcf8575 - Driver for PCF8575 16-bit I/O expander for I2C-bus

group pcf8575

ESP-IDF driver for PCF8575 remote 16-bit I/O expander for I2C-bus.

Copyright (C) 2019 Ruslan V. Uss https://github.com/UncleRus

MIT Licensed as described in the file LICENSE

Defines

PCF8575_I2C_ADDR_BASE

Functions

esp_err_t pcf8575_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 descriptior.

SCL frequency is 400kHz

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

  • port: I2C port number

  • addr: I2C address (0b0100<A2><A1><A0> for PCF8575)

  • sda_gpio: SDA GPIO

  • scl_gpio: SCL GPIO

esp_err_t pcf8575_free_desc(i2c_dev_t *dev)

Free device descriptor.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

esp_err_t pcf8575_port_read(i2c_dev_t *dev, uint16_t *val)

Read GPIO port value.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

  • val: 8-bit GPIO port value

esp_err_t pcf8575_port_write(i2c_dev_t *dev, uint16_t value)

Write value to GPIO port.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

  • value: GPIO port value