adafruit_pcf8575
CircuitPython library for Adafruit PCF8575 GPIO expander
Author(s): ladyada
Implementation Notes
Hardware:
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
- class adafruit_pcf8575.DigitalInOut(pin_number: int, pcf: PCF8575)
Digital input/output of the PCF8575. The interface is exactly the same as the digitalio.DigitalInOut class, however:
PCF8575 does not support pull-down resistors
PCF8575 does not actually have a sourcing transistor, instead there’s an internal pullup
Exceptions will be thrown when attempting to set unsupported pull configurations.
Specify the pin number of the PCF8575 0..15, and instance.
- property direction: Direction
Setting a pin to OUTPUT drives it low, setting it to an INPUT enables the light pullup.
- property pull: Pull
Pull-up is always activated so this will always return the same, thing:
digitalio.Pull.UP
- switch_to_input(pull: Pull | None = None, **kwargs) None
Switch the pin state to a digital input which is the same as setting the light pullup on. Note that true tri-state or pull-down resistors are NOT supported!
Note that keyword arguments are not parsed, and only included for compatibility with code expecting
digitalio.DigitalInOut
.
- 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).
Note that keyword arguments are not parsed, and only included for compatibility with code expecting
digitalio.DigitalInOut
.- Parameters:
value (bool) – The value to set upon switching to output; default is
False
- class adafruit_pcf8575.PCF8575(i2c_bus: I2C, address: int = 32)
Interface library for PCF8575 GPIO expanders
- Parameters:
- get_pin(pin: int) DigitalInOut
Convenience function to create an instance of the DigitalInOut class pointing at the specified pin of this PCF8575 device.
- Parameters:
pin (int) – pin to use for digital IO, 0 to 15
- read_pin(pin: int) bool
Read a single GPIO pin as high/pulled-up or driven low
- Parameters:
pin (int) – The pin number