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, address=88, reset=True)

CircuitPython helper class for using the AW9523 GPIO expander

property LED_modes

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

property directions

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

get_pin(pin)

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

Enables interrupt for input pin change if bit mask is 1

reset()

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

set_constant_current(pin, value)

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, aw)

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

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

property pull

Pull-down resistors are NOT supported!

switch_to_input(pull=None, **kwargs)

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=False, **kwargs)

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

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.