PCA9555

PCA9555

CircuitPython module for the PCA9555 and compatible expanders. The PCA9555 is a basic 16 pin I2C expander.

  • Configurable pins as input or output

  • Per pin polarity inversion. This inverts the value that is returned when an input port is read. Does not affect the pins set as outputs.

  • Pin change interrupts. An interrupt is generated on any pin change for a pin configured as an input. The interrupt signal is cleared by a change back to the original value of the input pin or a read to the GPIO register.This will have to be detected and tracked in user code. There is no way to tell from the device what pin caused the interrupt.

Use this class if you are using a PCA9555 or compatible expander. This class is also used as the base class for the PCAL9555 expander.

Required library files (.py or their .mpy equivalent):

  • PCA9555.py

  • i2c_expander.py

  • digital_inout.py

  • helpers.py

Compatible Devices

  • PCA9555

These are devices I have specifically tested and know work. There appear to be a lot more devices with similar naming schemes that use the same register map. These should also be compatible, but make sure you check the i2c address and default register state.

Heavily based on the code written by Tony DiCola for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.PCA9555.PCA9555(i2c, address=_PCA9555_DEFAULT_ADDRESS, reset=True)

Bases: I2c_Expander

The class for the PCA9555 expander. Instantiate one of these for each expander on the bus. Make sure you get the address right.

reset_to_defaults()

Reset all registers to their default state. This is also done with a power cycle, but it can be called by software here.

Returns:

Nothing.

property gpio

The raw GPIO port registers. Each bit represents the value of the associated pin (0 = low, 1 = high). Read this register to get the value of all pins. Write to this register to set the value of any pins configured as outputs. Read and written as a 16 bit number.

Register address (read): 0x00, 0x01

Register address (write): 0x02, 0x03

property capability

Indicates the device capability. Used by digital_inout when setting pull up/down resistors and stuff.

  • Bit 0: Pull up resistors.

  • Bit 1: Pull down resisors.

  • Bit 2: Invert polarity of inputs.

  • Bit 3: Set drive mode of pins.

Note that this bit is only set if the part has capabilty on a per-pin basis. Some parts can only set banks of pins, so they do not advertise the capability here.

Read only from user code.

get_pin(pin)

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin on the IO expander. This function should never be called directly from the I2c_expander class. It is included here so that all subclasses have this function by default.

property ipol

The raw ‘polarity inversion’ register. Each bit represents the polarity value of the associated pin (0 = normal, 1 = inverted). This only applies to pins configured as inputs. Read and written as a 16 bit number.

Register address: 0x04, 0x05

property maxpins

Number of pins in the expander. Starts at 0. Read only from user code.

property iodir

The raw pin configuration register. Each bit represents direction of a pin, either 1 for an input or 0 for an output. Read and written as a 16 bit number.

Register address: 0x06, 0x07

PCAL9555

PCAL9555

CircuitPython module for the PCAL9555 I2C I/O extenders. The PCAL9555 is a 16 pin IO Expander. It is software compatible with the PCA9555, but has a bunch of added functions.

Added features of these expanders include:

  • Built in pull up and pull down resistors.

  • Per pin selectable drive strength.

  • Maskable interrupt pins

  • Latching interrupt option

  • Per bank push-pull/open drain pin setup.

Required library files (.py or their .mpy equivalent):

  • PCAL9555.py

  • PCA9555.py

  • i2c_expander.py

  • digital_inout.py

  • helpers.py

Compatible Devices

  • PCAL9555

These are devices I have specifically tested and know work. There appear to be a lot more devices with similar naming schemes that use the same register map. These should also be compatible, but make sure you check the i2c address and default register state.

Note:

By default if an (non-latched) interrupt enabled pin changes state, but changes back before the GPIO state register is read, the interrupt state will be cleared. Setting the interrupt latch will cause the device to latch on a state change of the input pin. With latching enabled, on a state change to the pin, the interrupt pin will be asserted and will not deassert until the input register is read. The value read from the input register will be the value that caused the interrupt, not nessecarially the current value of the pin. If the pin changed state, but changed back before the input register was read, the changed state will be what is returned in the register. The state change back to the original state will not trigger another interrupt as long as it happens before the input register is read. If the input register is read before the pin state changes back to the original value, both state changes will cause an interrupt.

Heavily based on the code written by Tony DiCola for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.PCAL9555.DriveStrength

Bases: object

IO Pins have a selectable drive strength. For the PCAL9555, the full drive strength is 10mA source, 25mA sink. The drive strength can be decreased by setting the drive strength registers.

Note: I have tested these functions to show that the software sets the correct bits to the correct values, but I have not tested the affect on the rise/fall time of the pins.

class i2c_expanders.PCAL9555.PCAL9555(i2c, address=_PCAL9555_DEFAULT_ADDRESS, reset=True)

Bases: PCA9555

The class for the PCAL9555 expander. Instantiate one of these for each expander on the bus. Make sure you get the address right.

set_int_pin(pin, latch=False)

Enable interrupt on a pin. Interrupts are generally triggered by any state change of the pin. There is an exception to this, see info below on latching for details.

Parameters:
  • pin – Pin number to modify.

  • latch – Set to True to enable latching on this interrupt. Defaults to False.

Returns:

Nothing.

clear_int_pin(pin)

Disable interrupts on a pin.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

get_interrupts()

Returns a list of pins causing an interruptn along with the value of those pins. It is possible for multiple pins to be causing an interrupt. Calling this function clears the interrupt state.

Returns:

Returns a list of dicts containing items “pin” and “value”. If no interrupts are triggered, this function returns none.

get_int_pins()

Returns a list of pins causing an interrupt. It is possible for multiple pins to be causing an interrupt. Calling this function will not clear the interrupt state.

Returns:

Returns a list of pin numbers.

set_int_latch(pin)

Set the interrupt on ‘pin’ to latching operation. Note this does not enable or disable the interrupt or clear the interrupt state.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

clear_int_latch(pin)

Set the interrupt on ‘pin’ to non-latching operation. Note this does not enable or disable the interrupt. This does not clear the interrupt state.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

get_pupd(pin)

Checks the state of a pin to see if pull up/down is enabled.

Parameters:

pin – Pin number to check.

Returns:

Returns ‘digitalio.Pull.UP’, ‘digitalio.Pull.DOWN’ or ‘None’ to indicate the state of the pin.

set_pupd(pin, status)

Sets the state of the pull up/down resistors on a pin.

Parameters:
  • pin – Pin number to modify.

  • status – The new state of the pull up/down resistors. Should be one of ‘digitalio.Pull.UP’, ‘digitalio.Pull.DOWN’ or ‘None’.

Returns:

Nothing.

set_output_drive(pin, drive)

Sets the output drive strength of a pin.

Parameters:
  • pin – Pin number to modify.

  • drive – The drive strength value to set. See the class ‘Drive_strength’ for valid values to set.

Returns:

Nothing.

get_output_drive(pin)

Reads the drive strength value of the given pin.

Parameters:

pin – Pin number to check.

Returns:

The current drive strength. Return values are shown in the ‘Drive_strength’ class

set_drive_mode(bank, mode)

Configures the output drive of an output bank. Sets the outputs to either open drain or push-pull. Note that this is not a per-pin setting. All pins in bank 0 (pins 0-7) or 1 (pins 8-15) are set to the same mode.

Parameters:
  • bank – The bank to set. Should be 0 or 1.

  • mode – The mode to set. Should be one of either ‘digitalio.DriveMode.PUSH_PULL’ or ‘digitalio.DriveMode.OPEN_DRAIN’.

Returns:

Nothing.

get_drive_mode(bank)

Reads the output drive of an output bank. All pins in bank 0 (pins 0-7) or 1 (pins 8-15) are set to the same mode.

Parameters:

bank – The bank to set. Should be 0 or 1.

Returns:

The drive mode. Either ‘digitalio.DriveMode.PUSH_PULL’ or ‘digitalio.DriveMode.OPEN_DRAIN’.

reset_to_defaults()

Reset all registers to their default state. This is also done with a power cycle, but it can be called by software here.

Returns:

Nothing.

property out0_drive

The raw ‘output drive strength 0’ register. Controls the drive strength of bank 0 (pins 0-7). Read and written as a 16 bit number.

Register address: 0x40, 0x41.

property out1_drive

The raw ‘output drive strength 1’ register. Controls the drive strength of bank 1 (pins 8-15). Read and written as a 16 bit number.

Register address: 0x42, 0x43.

property input_latch

The raw ‘input latch’ register. Each bit represents the latch configuration for the matching pin. A zero indicates that the corresponding input pin is not latched. Read and written as a 16 bit number.

Register address: 0x44, 0x45.

property pupd_en

The raw ‘pull-up/pull-down enable’ register. Each bit represents the enabled state of the pull up/down resistors for that pin. A one indicates that the pull up/down resistors are enabled. The selection of pull-up vs pull-down is done with the ‘pull-up/pull-down selection register’. A zero indicates that the pull up/down resistors are disconnected. Read and written as a 16 bit number.

Register address: 0x46, 0x47.

property capability

Indicates the device capability. Used by digital_inout when setting pull up/down resistors and stuff.

  • Bit 0: Pull up resistors.

  • Bit 1: Pull down resisors.

  • Bit 2: Invert polarity of inputs.

  • Bit 3: Set drive mode of pins.

Note that this bit is only set if the part has capabilty on a per-pin basis. Some parts can only set banks of pins, so they do not advertise the capability here.

Read only from user code.

get_pin(pin)

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin on the IO expander. This function should never be called directly from the I2c_expander class. It is included here so that all subclasses have this function by default.

property gpio

The raw GPIO port registers. Each bit represents the value of the associated pin (0 = low, 1 = high). Read this register to get the value of all pins. Write to this register to set the value of any pins configured as outputs. Read and written as a 16 bit number.

Register address (read): 0x00, 0x01

Register address (write): 0x02, 0x03

property iodir

The raw pin configuration register. Each bit represents direction of a pin, either 1 for an input or 0 for an output. Read and written as a 16 bit number.

Register address: 0x06, 0x07

property ipol

The raw ‘polarity inversion’ register. Each bit represents the polarity value of the associated pin (0 = normal, 1 = inverted). This only applies to pins configured as inputs. Read and written as a 16 bit number.

Register address: 0x04, 0x05

property maxpins

Number of pins in the expander. Starts at 0. Read only from user code.

property pupd_sel

The raw ‘pull-up/pull-down selection’ register. Each bit enables either a pull-up or pull-down resistor on that corresponding pin. A one selects a pull-up and a zero selects a pull-down. Internal pull up/down resistors are ~100 KOhm (+/-50 KOhm). Read and written as a 16 bit number.

Register address: 0x48, 0x49.

property irq_mask

The raw ‘interrupt mask’ register. Setting a bit to one will mask interrupts on that corresponding pin. All interrupts are masked by default. Read and written as a 16 bit number.

Register address: 0x4A, 0x4B.

property irq_status

The raw ‘interrupt status’ register. Reading this register will tell the source of an interrupt. A one read from a bit in this register indicates that the corresponding pin caused the interrupt. This register is read only. Reading from this register does not clear the interrupt state. Read and written as a 16 bit number.

Register address: 0x4C, 0x4D.

property out_port_config

The raw ‘output port configuration’ register. Use this register to set the output banks to either open-drain or push-pull operation. Bit zero controls bank 0 (pins 0-7) and bit 1 controls bank 1 (pins 8-15). Set the corresponding bit to zero to set that bank to push-pull. Set to one to configure the bank as open-drain. All other bits are reserved. Read and written as a 8 bit number.

Register address: 0x4F.

PCA9554

PCA9554

CircuitPython module for the PCA9554 and compatible expanders. The PCA9554 is a basic 8 pin I2C expander.

  • Configurable pins as input or output

  • Per pin polarity inversion. This inverts the value that is returned when an input port is read. Does not affect the pins set as outputs.

  • Pin change interrupts. An interrupt is generated on any pin change for a pin configured as an input. The interrupt signal is cleared by a change back to the original value of the input pin or a read to the GPIO register.This will have to be detected and tracked in user code. There is no way to tell from the device what pin caused the interrupt.

Use this class if you are using a PCA9554 or compatible expander. This class is also used as the base class for the PCAL9554 expander.

Required library files (.py or their .mpy equivalent):

  • PCA9554.py

  • i2c_expander.py

  • digital_inout.py

  • helpers.py

Compatible Devices

  • PCA9554

  • PCA9538

These are devices I have specifically tested and know work. There appear to be a lot more devices with similar naming schemes that use the same register map. These should also be compatible, but make sure you check the i2c address and default register state.

Heavily based on the code written by Tony DiCola for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.PCA9554.PCA9554(i2c, address=_PCA9554_DEFAULT_ADDRESS, reset=True)

Bases: I2c_Expander

The class for the PCA9554 expander. Instantiate one of these for each expander on the bus. Make sure you get the address right.

reset_to_defaults()

Reset all registers to their default state. This is also done with a power cycle, but it can be called by software here.

Returns:

Nothing.

property gpio

The raw GPIO port registers. Each bit represents the value of the associated pin (0 = low, 1 = high). Read this register to get the value of all pins. Write to this register to set the value of any pins configured as outputs. Read and written as a 8 bit number.

Register address (read): 0x00

Register address (write): 0x01

property capability

Indicates the device capability. Used by digital_inout when setting pull up/down resistors and stuff.

  • Bit 0: Pull up resistors.

  • Bit 1: Pull down resisors.

  • Bit 2: Invert polarity of inputs.

  • Bit 3: Set drive mode of pins.

Note that this bit is only set if the part has capabilty on a per-pin basis. Some parts can only set banks of pins, so they do not advertise the capability here.

Read only from user code.

get_pin(pin)

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin on the IO expander. This function should never be called directly from the I2c_expander class. It is included here so that all subclasses have this function by default.

property ipol

The raw ‘polarity inversion’ register. Each bit represents the polarity value of the associated pin (0 = normal, 1 = inverted). This only applies to pins configured as inputs. Read and written as a 8 bit number.

Register address: 0x02

property maxpins

Number of pins in the expander. Starts at 0. Read only from user code.

property iodir

The raw pin configuration register. Each bit represents direction of a pin, either 1 for an input or 0 for an output. Read and written as a 8 bit number.

Register address: 0x03

PCAL9554

PCAL9554

CircuitPython module for the PCAL9554 I2C I/O extenders. The PCAL9554 is a 8 pin IO Expander. It is software compatible with the PCA9554, but has a bunch of added functions.

Added features of these expanders include:

  • Built in pull up and pull down resistors.

  • Per pin selectable drive strength.

  • Maskable interrupt pins

  • Latching interrupt option

  • Per bank push-pull/open drain pin setup.

Required library files (.py or their .mpy equivalent):

  • PCAL9554.py

  • PCA9554.py

  • i2c_expander.py

  • digital_inout.py

  • helpers.py

Compatible Devices

  • PCAL9554

  • PCAL9538

These are devices I have specifically tested and know work. There appear to be a lot more devices with similar naming schemes that use the same register map. These should also be compatible, but make sure you check the i2c address and default register state.

Note:

By default if an (non-latched) interrupt enabled pin changes state, but changes back before the GPIO state register is read, the interrupt state will be cleared. Setting the interrupt latch will cause the device to latch on a state change of the input pin. With latching enabled, on a state change to the pin, the interrupt pin will be asserted and will not deassert until the input register is read. The value read from the input register will be the value that caused the interrupt, not nessecarially the current value of the pin. If the pin changed state, but changed back before the input register was read, the changed state will be what is returned in the register. The state change back to the original state will not trigger another interrupt as long as it happens before the input register is read. If the input register is read before the pin state changes back to the original value, both state changes will cause an interrupt.

Heavily based on the code written by Tony DiCola for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.PCAL9554.PCAL9554(i2c, address=_PCAL9554_DEFAULT_ADDRESS, reset=True)

Bases: PCA9554

The class for the PCAL9554 expander. Instantiate one of these for each expander on the bus. Make sure you get the address right.

set_int_pin(pin, latch=False)

Enable interrupt on a pin. Interrupts are generally triggered by any state change of the pin. There is an exception to this, see info below on latching for details.

Parameters:
  • pin – Pin number to modify.

  • latch – Set to True to enable latching on this interrupt. Defaults to False.

Returns:

Nothing.

clear_int_pin(pin)

Disable interrupts on a pin.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

get_interrupts()

Returns a list of pins causing an interruptn along with the value of those pins. It is possible for multiple pins to be causing an interrupt. Calling this function clears the interrupt state.

Returns:

Returns a list of dicts containing items “pin” and “value”. If no interrupts are triggered, this function returns none.

get_int_pins()

Returns a list of pins causing an interrupt. It is possible for multiple pins to be causing an interrupt. Calling this function will not clear the interrupt state.

Returns:

Returns a list of pin numbers.

set_int_latch(pin)

Set the interrupt on ‘pin’ to latching operation. Note this does not enable or disable the interrupt or clear the interrupt state.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

clear_int_latch(pin)

Set the interrupt on ‘pin’ to non-latching operation. Note this does not enable or disable the interrupt. This does not clear the interrupt state.

Parameters:

pin – Pin number to modify.

Returns:

Nothing.

get_pupd(pin)

Checks the state of a pin to see if pull up/down is enabled.

Parameters:

pin – Pin number to check.

Returns:

Returns ‘digitalio.Pull.UP’, ‘digitalio.Pull.DOWN’ or ‘None’ to indicate the state of the pin.

set_pupd(pin, status)

Sets the state of the pull up/down resistors on a pin.

Parameters:
  • pin – Pin number to modify.

  • status – The new state of the pull up/down resistors. Should be one of ‘digitalio.Pull.UP’, ‘digitalio.Pull.DOWN’ or ‘None’.

Returns:

Nothing.

set_output_drive(pin, drive)

Sets the output drive strength of a pin.

Parameters:
  • pin – Pin number to modify.

  • drive – The drive strength value to set. See the class ‘Drive_strength’ for valid values to set.

Returns:

Nothing.

get_output_drive(pin)

Reads the drive strength value of the given pin.

Parameters:

pin – Pin number to check.

Returns:

The current drive strength. Return values are shown in the ‘Drive_strength’ class

set_drive_mode(mode)

Configures the output drive of the entire output bank. Sets the outputs to either open drain or push-pull. Note that this is not a per-pin setting. All pins are set to the same mode.

Parameters:

mode – The mode to set. Should be one of either ‘digitalio.DriveMode.PUSH_PULL’ or ‘digitalio.DriveMode.OPEN_DRAIN’.

Returns:

Nothing.

get_drive_mode()

Returns the drive mode of the output bank. This is the drive mode of all pins.

Returns:

The drive mode. Either ‘digitalio.DriveMode.PUSH_PULL’ or ‘digitalio.DriveMode.OPEN_DRAIN’.

reset_to_defaults()

Reset all registers to their default state. This is also done with a power cycle, but it can be called by software here.

Returns:

Nothing.

property out_drive

The raw ‘output drive strength’ register. Controls the drive strength of the pins. Read and written as a 16 bit number.

Register address: 0x40, 0x41.

property input_latch

The raw ‘input latch’ register. Each bit represents the latch configuration for the matching pin. A zero indicates that the corresponding input pin is not latched. Read and written as a 8 bit number.

Register address: 0x42.

property pupd_en

The raw ‘pull-up/pull-down enable’ register. Each bit represents the enabled state of the pull up/down resistors for that pin. A one indicates that the pull up/down resistors are enabled. The selection of pull-up vs pull-down is done with the ‘pull-up/pull-down selection register’. A zero indicates that the pull up/down resistors are disconnected. Read and written as a 8 bit number.

Register address: 0x43.

property capability

Indicates the device capability. Used by digital_inout when setting pull up/down resistors and stuff.

  • Bit 0: Pull up resistors.

  • Bit 1: Pull down resisors.

  • Bit 2: Invert polarity of inputs.

  • Bit 3: Set drive mode of pins.

Note that this bit is only set if the part has capabilty on a per-pin basis. Some parts can only set banks of pins, so they do not advertise the capability here.

Read only from user code.

get_pin(pin)

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin on the IO expander. This function should never be called directly from the I2c_expander class. It is included here so that all subclasses have this function by default.

property gpio

The raw GPIO port registers. Each bit represents the value of the associated pin (0 = low, 1 = high). Read this register to get the value of all pins. Write to this register to set the value of any pins configured as outputs. Read and written as a 8 bit number.

Register address (read): 0x00

Register address (write): 0x01

property iodir

The raw pin configuration register. Each bit represents direction of a pin, either 1 for an input or 0 for an output. Read and written as a 8 bit number.

Register address: 0x03

property ipol

The raw ‘polarity inversion’ register. Each bit represents the polarity value of the associated pin (0 = normal, 1 = inverted). This only applies to pins configured as inputs. Read and written as a 8 bit number.

Register address: 0x02

property maxpins

Number of pins in the expander. Starts at 0. Read only from user code.

property pupd_sel

The raw ‘pull-up/pull-down selection’ register. Each bit enables either a pull-up or pull-down resistor on that corresponding pin. A one selects a pull-up and a zero selects a pull-down. Internal pull up/down resistors are ~100 KOhm (+/-50 KOhm). Read and written as a 8 bit number.

Register address: 0x44.

property irq_mask

The raw ‘interrupt mask’ register. Setting a bit to one will mask interrupts on that corresponding pin. All interrupts are masked by default. Read and written as a 8 bit number.

Register address: 0x45.

property irq_status

The raw ‘interrupt status’ register. Reading this register will tell the source of an interrupt. A one read from a bit in this register indicates that the corresponding pin caused the interrupt. This register is read only. Reading from this register does not clear the interrupt state. Read and written as a 8 bit number.

Register address: 0x46.

property out_port_config

The raw ‘output port configuration’ register. Use bit zero of this register to set the output pins to either open-drain or push-pull operation. Set the bit to zero to configure the pins as push-pull. Set to one to configure the pins as open-drain. All other bits are reserved. Read and written as a 8 bit number.

Register address: 0x4F.

Common

i2c_expander

The base class for the I2C expanders. This class should not be included directly in user code. It provides base functions that are used by all of the I2C expander drivers.

Based heavily on the code from Red_M for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.i2c_expander.I2c_Expander(bus_device, address)

Base class for I2C GPIO expander devices. This class has basic read and write functions that are common to all i2c expanders. This class should never be used directly.

property maxpins

Number of pins in the expander. Starts at 0. Read only from user code.

property capability

Indicates the device capability. Used by digital_inout when setting pull up/down resistors and stuff.

  • Bit 0: Pull up resistors.

  • Bit 1: Pull down resisors.

  • Bit 2: Invert polarity of inputs.

  • Bit 3: Set drive mode of pins.

Note that this bit is only set if the part has capabilty on a per-pin basis. Some parts can only set banks of pins, so they do not advertise the capability here.

Read only from user code.

get_pin(pin)

Convenience function to create an instance of the DigitalInOut class pointing at the specified pin on the IO expander. This function should never be called directly from the I2c_expander class. It is included here so that all subclasses have this function by default.

digital_inout

An implementation of the digitalio interface that works with the I2C expanders.

Heavily based on the version written by Tony DiCola for the MCP230xx library.

  • Author(s): Pat Satyshur

class i2c_expanders.digital_inout.DigitalInOut(pin_number, ioexpander_class)

The interface is exactly the same as the digitalio.DigitalInOut class. However Some devices do not support pull up/down resistors or setting the pin to open drain.

Parameters:
  • pin_number (int) – The pin number. Starts at zero.

  • ioexpander_class (gpio class object) – The I2c expander class object.

Exceptions will be thrown when attempting to set unsupported configurations.

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).

switch_to_input(pull=None, invert_polarity=False, **kwargs)

Switch the pin state to a digital input with the provided starting pull up/down resistor state (optional, none by default) and input polarity. Attempting to set a pull up/down resistor here for an expander that does not support it will throw an error.

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.

property direction

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

property pull

Returns the setup of internal pull up/down resistors. If pull up/down resistors are not supported, this function will raise an error.

property invert_polarity

The polarity of the pin, either True for an Inverted or False for an normal.

property drive_mode

Set the drive mode on expanders that support it. Will raise an error if setting drive mode is not supported.

Not implemented, will raise an error if set/read.

helpers

Helper functions that are used by the various other classes. These are a bunch of helper functions that are collected here to avoid circular import references.

  • Author(s): Pat Satyshur