21#include "driver/i2c_types.h"
189esp_err_t
aw9523_init(
const i2c_master_bus_handle_t* bus_handle,
esp_err_t aw9523_destroy(aw9523_t *dev)
Soft reset and remove the I2C instance of the AW9523 GPIO expander.
Definition aw9523.c:428
esp_err_t aw9523_gpio_write_pins(const aw9523_t *dev, const aw9523_pins_data_digital_t *data)
Write digital pin data to all GPIO output pins.
Definition aw9523.c:269
i2c_master_dev_handle_t aw9523_t
AW9523 GPIO expander's I2C device handle.
Definition aw9523.h:51
aw9523_i2c_addr_t
I2C address of the AW9523 GPIO expander.
Definition aw9523.h:31
@ AW9523_I2C_ADDR_AD0_GND_AD1_VCC
Definition aw9523.h:36
@ AW9523_I2C_ADDR_AD0_GND_AD1_GND
Definition aw9523.h:32
@ AW9523_I2C_ADDR_AD0_VCC_AD1_VCC
Definition aw9523.h:38
@ AW9523_I2C_ADDR_AD0_VCC_AD1_GND
Definition aw9523.h:34
aw9523_reg_addr_t
Register address constants to read from and/or write to for the AW9523 GPIO expander.
Definition aw9523.h:57
@ AW9523_REG_GPIO_OUTPUT_P0
Definition aw9523.h:62
@ AW9523_REG_GPIO_DIR_P1
Definition aw9523.h:68
@ AW9523_REG_GPIO_DIR_P0
Definition aw9523.h:66
@ AW9523_REG_CONTROL
Definition aw9523.h:77
@ AW9523_REG_GPIO_INTERRUPT_P0
Definition aw9523.h:70
@ AW9523_REG_GPIO_INPUT_P1
Definition aw9523.h:60
@ AW9523_REG_GPIO_INPUT_P0
Definition aw9523.h:58
@ AW9523_REG_SOFT_RESET
Definition aw9523.h:82
@ AW9523_REG_ID
Definition aw9523.h:76
@ AW9523_REG_GPIO_INTERRUPT_P1
Definition aw9523.h:73
@ AW9523_REG_MODE_P0
Definition aw9523.h:78
@ AW9523_REG_GPIO_OUTPUT_P1
Definition aw9523.h:64
@ AW9523_REG_MODE_P1
Definition aw9523.h:80
esp_err_t aw9523_read_reg(const aw9523_t *dev, const aw9523_reg_addr_t reg, aw9523_reg_value_t *value)
Read the specified register from the AW9523 GPIO expander.
Definition aw9523.c:89
aw9523_pin_data_digital_t aw9523_pins_data_digital_t[16]
GPIO digital pin data to read/write for all 16 pins.
Definition aw9523.h:117
esp_err_t aw9523_gpio_read_pin(const aw9523_t *dev, const aw9523_pin_num_t pin, const aw9523_pin_mode_t pin_mode, aw9523_pin_data_digital_t *data)
Read digital pin data from a specific GPIO pin.
Definition aw9523.c:228
uint8_t aw9523_pin_num_t
Pin number, ranging from 0 to 15 inclusive.
Definition aw9523.h:107
aw9523_pin_mode_t aw9523_pins_mode_t[16]
Pin mode of all 16 pins.
Definition aw9523.h:102
esp_err_t aw9523_gpio_read_pins(const aw9523_t *dev, aw9523_pins_data_digital_t *pins_data)
Read all GPIO pins.
Definition aw9523.c:184
aw9523_pin_interrupt_mode_t aw9523_pins_interrupt_mode_t[16]
Interrupt mode for all 16 GPIO input pins.
Definition aw9523.h:132
esp_err_t aw9523_write_reg(const aw9523_t *dev, const aw9523_reg_addr_t reg, const aw9523_reg_value_t value)
Write the specified register to the AW9523 GPIO expander.
Definition aw9523.c:95
bool aw9523_pin_data_digital_t
GPIO digital pin data to read/write.
Definition aw9523.h:112
aw9523_led_max_current_t
Maximum current for all LED output pins.
Definition aw9523.h:145
@ AW9523_LED_MAX_mA_37
Definition aw9523.h:146
@ AW9523_LED_MAX_mA_9_25
Definition aw9523.h:151
@ AW9523_LED_MAX_mA_18_5
Definition aw9523.h:149
@ AW9523_LED_MAX_mA_27_75
Definition aw9523.h:147
esp_err_t aw9523_gpio_write_pin(const aw9523_t *dev, const aw9523_pin_num_t pin, const aw9523_pin_data_digital_t data)
Write digital pin data to specific GPIO output pin.
Definition aw9523.c:293
uint8_t aw9523_reg_value_t
Register value read from and/or to write to the AW9523 GPIO expander.
Definition aw9523.h:88
aw9523_gpio_output_mode_t
GPIO output mode for all port 0 pins (pins 0 to 7).
Definition aw9523.h:137
@ AW9523_GPIO_OUTPUT_MODE_OPEN_DRAIN
Definition aw9523.h:138
@ AW9523_GPIO_OUTPUT_MODE_PUSH_PULL
Definition aw9523.h:139
esp_err_t aw9523_soft_reset(const aw9523_t *dev)
Soft reset the AW9523 GPIO expander.
Definition aw9523.c:419
esp_err_t aw9523_init(const i2c_master_bus_handle_t *bus_handle, const aw9523_i2c_addr_t address, aw9523_t *dev)
Initialise the AW9523 GPIO expander.
Definition aw9523.c:101
esp_err_t aw9523_set_gpio_interrupt_pin(const aw9523_t *dev, const aw9523_pin_num_t pin, const aw9523_pin_interrupt_mode_t pin_interrupt_mode)
Set interrupt pin mode for specific GPIO input pin.
Definition aw9523.c:348
esp_err_t aw9523_set_pins(const aw9523_t *dev, const aw9523_pins_mode_t *pins_mode)
Set pin mode of all 16 pins.
Definition aw9523.c:127
esp_err_t aw9523_set_led_max_current(const aw9523_t *dev, const aw9523_led_max_current_t max_current)
Set max current output of LED pins in LED mode.
Definition aw9523.c:393
esp_err_t aw9523_set_gpio_interrupt_pins(const aw9523_t *dev, const aw9523_pins_interrupt_mode_t *pins_interrupt_mode)
Set interrupt pin mode for all GPIO input pins.
Definition aw9523.c:319
aw9523_pin_mode_t
Pin mode of a specific pin.
Definition aw9523.h:93
@ AW9523_PIN_GPIO_OUTPUT
Definition aw9523.h:94
@ AW9523_PIN_GPIO_INPUT
Definition aw9523.h:95
@ AW9523_PIN_LED
Definition aw9523.h:96
esp_err_t aw9523_set_pin(const aw9523_t *dev, const aw9523_pin_num_t pin, const aw9523_pin_mode_t pin_mode)
Set pin mode of a specific pin.
Definition aw9523.c:155
aw9523_pin_interrupt_mode_t
Interrupt mode on/off for a GPIO input pin.
Definition aw9523.h:122
@ AW9523_PIN_INTERRUPT_MODE_DISABLE
Definition aw9523.h:125
@ AW9523_PIN_INTERRUPT_MODE_ENABLE
Definition aw9523.h:123
esp_err_t aw9523_set_gpio_output_mode_p0(const aw9523_t *dev, const aw9523_gpio_output_mode_t gpio_output_mode)
Set GPIO output mode of all pins in port 0 (pins 0 to 7).
Definition aw9523.c:375
esp_err_t aw9523_set_led_brightness(const aw9523_t *dev, const aw9523_pin_num_t pin, const aw9523_reg_value_t brightness)
Set LED brightness of specific LED pin in LED mode.
Definition aw9523.c:408