|
|
typedef bool | aw9523_pin_data_digital_t |
| | GPIO digital pin data to read/write.
|
|
typedef uint8_t | aw9523_pin_num_t |
| | Pin number, ranging from 0 to 15 inclusive.
|
|
typedef aw9523_pin_data_digital_t | aw9523_pins_data_digital_t[16] |
| | GPIO digital pin data to read/write for all 16 pins.
|
|
typedef aw9523_pin_interrupt_mode_t | aw9523_pins_interrupt_mode_t[16] |
| | Interrupt mode for all 16 GPIO input pins.
|
|
typedef aw9523_pin_mode_t | aw9523_pins_mode_t[16] |
| | Pin mode of all 16 pins.
|
|
typedef uint8_t | aw9523_reg_value_t |
| | Register value read from and/or to write to the AW9523 GPIO expander.
|
|
typedef i2c_master_dev_handle_t | aw9523_t |
| | AW9523 GPIO expander's I2C device handle.
|
|
| enum | aw9523_gpio_output_mode_t { AW9523_GPIO_OUTPUT_MODE_OPEN_DRAIN = 0b0
, AW9523_GPIO_OUTPUT_MODE_PUSH_PULL = 0b1
} |
| | GPIO output mode for all port 0 pins (pins 0 to 7). More...
|
| enum | aw9523_i2c_addr_t { AW9523_I2C_ADDR_AD0_GND_AD1_GND = 0x58
, AW9523_I2C_ADDR_AD0_VCC_AD1_GND = 0x59
, AW9523_I2C_ADDR_AD0_GND_AD1_VCC = 0x5A
, AW9523_I2C_ADDR_AD0_VCC_AD1_VCC = 0x5B
} |
| | I2C address of the AW9523 GPIO expander. More...
|
| enum | aw9523_led_max_current_t { AW9523_LED_MAX_mA_37 = 0x0
, AW9523_LED_MAX_mA_27_75 = 0x1
, AW9523_LED_MAX_mA_18_5 = 0x2
, AW9523_LED_MAX_mA_9_25 = 0x3
} |
| | Maximum current for all LED output pins. More...
|
| enum | aw9523_pin_interrupt_mode_t { AW9523_PIN_INTERRUPT_MODE_ENABLE = 0b0
, AW9523_PIN_INTERRUPT_MODE_DISABLE = 0b1
} |
| | Interrupt mode on/off for a GPIO input pin. More...
|
| enum | aw9523_pin_mode_t { AW9523_PIN_GPIO_OUTPUT = 0
, AW9523_PIN_GPIO_INPUT = 1
, AW9523_PIN_LED = 2
} |
| | Pin mode of a specific pin. More...
|
| enum | aw9523_reg_addr_t {
AW9523_REG_GPIO_INPUT_P0 = 0x00
, AW9523_REG_GPIO_INPUT_P1 = 0x01
, AW9523_REG_GPIO_OUTPUT_P0 = 0x02
, AW9523_REG_GPIO_OUTPUT_P1 = 0x03
,
AW9523_REG_GPIO_DIR_P0 = 0x04
, AW9523_REG_GPIO_DIR_P1 = 0x05
, AW9523_REG_GPIO_INTERRUPT_P0 = 0x06
, AW9523_REG_GPIO_INTERRUPT_P1 = 0x07
,
AW9523_REG_ID = 0x10
, AW9523_REG_CONTROL = 0x11
, AW9523_REG_MODE_P0 = 0x12
, AW9523_REG_MODE_P1 = 0x13
,
AW9523_REG_SOFT_RESET = 0x7F
} |
| | Register address constants to read from and/or write to for the AW9523 GPIO expander. More...
|
|
| esp_err_t | aw9523_destroy (aw9523_t *dev) |
| | Soft reset and remove the I2C instance of the AW9523 GPIO expander.
|
| 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.
|
| esp_err_t | aw9523_gpio_read_pins (const aw9523_t *dev, aw9523_pins_data_digital_t *pins_data) |
| | Read all GPIO pins.
|
| 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.
|
| 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.
|
| 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.
|
| 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.
|
| 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.
|
| 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.
|
| 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).
|
| 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.
|
| 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.
|
| 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.
|
| esp_err_t | aw9523_set_pins (const aw9523_t *dev, const aw9523_pins_mode_t *pins_mode) |
| | Set pin mode of all 16 pins.
|
| esp_err_t | aw9523_soft_reset (const aw9523_t *dev) |
| | Soft reset the AW9523 GPIO expander.
|
| 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.
|
AW9523 GPIO expander component.
- Author
- Yik Jin (@yikjin) yikji.nosp@m.n@nu.nosp@m.shack.nosp@m.ers..nosp@m.org
- Version
- 0.0.3
- Date
- 2026-01-05
- Copyright
- Copyright (c) 2026 NUS Hackers
This component simplifies communication with the AW9523 GPIO expander module, and abstracts away having to deal with the 2 physical ports (P0 and P1) of 8 pins (Pn_0..7) each in the device, representing them as 16 virtual pins instead (0..15) for ease of use.