adafruit_aw9523

Python library for AW9523 GPIO expander and LED driver

  • Author(s): ladyada

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_aw9523.AW9523(i2c_bus: I2C, address: int = 88, reset: bool = True)

CircuitPython helper class for using the AW9523 GPIO expander

property LED_modes: int

Pin is set up for constant current mode if bit mask is 1

property directions: int

Direction is output if bit mask is 1, input if bit is 0

get_pin(pin: int) DigitalInOut

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin of this AW9523 device. :param int pin: pin to use for digital IO, 0 to 15

property interrupt_enables: int

Enables interrupt for input pin change if bit mask is 1

reset() None

Perform a soft reset, check datasheets for post-reset defaults!

set_constant_current(pin: int, value: int) None

Set the constant current drain for an AW9523 pin :param int pin: pin to set constant current, 0..15 :param int value: the value ranging from 0 (off) to 255 (max current)

class adafruit_aw9523.DigitalInOut(pin_number: int, aw: AW9523)

Digital input/output of the AW9523. The interface is exactly the same as the digitalio.DigitalInOut class, however:

  • AW9523 family does not support pull-up or -down resistors

Exceptions will be thrown when attempting to set unsupported pull configurations.

Specify the pin number of the AW9523 0..15, and instance.

property direction: bool

The direction of the pin, either True for an input or False for an output.

property pull: None

Pull-down resistors are NOT supported!

switch_to_input(pull: bool | None = None, **kwargs) None

Switch the pin state to a digital input with the provided starting pull-up resistor state (optional, no pull-up by default) and input polarity. Note that pull-down resistors are NOT supported!

switch_to_output(value: bool = False, **kwargs) None

Switch the pin state to a digital output with the provided starting value (True/False for high or low, default is False/low).

property value: bool

The value of the pin, either True for high or False for low. Note you must configure as an output or input appropriately before reading and writing this value.