pcf8574 - Driver for PCF8574 8-bit I/O expander for I2C-bus

group pcf8574

ESP-IDF driver for PCF8574 compatible remote 8-bit I/O expanders for I2C-bus.

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

MIT Licensed as described in the file LICENSE

Functions

esp_err_t pcf8574_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 SCL frequency is 100kHz.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

  • port: I2C port number

  • addr: I2C address (0b0100[A2][A1][A0] for PCF8574, 0b0111[A2][A1][A0] for PCF8574A)

  • sda_gpio: SDA GPIO

  • scl_gpio: SCL GPIO

esp_err_t pcf8574_free_desc(i2c_dev_t *dev)

Free device descriptor.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

esp_err_t pcf8574_port_read(i2c_dev_t *dev, uint8_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 pcf8574_port_write(i2c_dev_t *dev, uint8_t value)

Write value to GPIO port.

Return

ESP_OK on success

Parameters
  • dev: Pointer to I2C device descriptor

  • value: GPIO port value