EXTIO Unit

Support the following products:

EXTIOUnit

class EXTIOUnit

Constructors

class EXTIOUnit(i2c, address)

Initialize the PCA9554 device.

Parameters:
  • i2c (I2C) – An instance of the I2C bus to communicate with the device.

  • address (int) – The I2C address of the PCA9554 device (default is _PCA9554_DEFAULT_ADDRESS).

UIFLOW2:

init.png

Methods

EXTIOUnit.set_port_mode(mode) None

Set the mode of the entire port.

Parameters:

mode (Literal[0x00,0x01]) – The mode to set, either PCA9554.IN (input, 0x00) or PCA9554.OUT (output, 0x01).

UIFLOW2:

set_port_mode.png

EXTIOUnit.set_pin_mode(id, mode) None

Set the mode of a specific pin.

Parameters:
  • id (int) – The pin number (0-7).

  • mode (Literal[0x00,0x01]) – The mode to set, either PCA9554.IN (input, 0x00) or PCA9554.OUT (output, 0x01).

UIFLOW2:

set_pin_mode.png

EXTIOUnit.digit_write_port(value) None

Set a value to the entire port.

Parameters:

value (int) – An 8-bit value to set to the port.

UIFLOW2:

digit_write_port.png

EXTIOUnit.digit_write(id, value) None

Set a value to a specific pin.

Parameters:
  • id (int) – The pin number (0-7).

  • value (int) – The value to set, either 0 (low) or 1 (high).

UIFLOW2:

digit_write.png

EXTIOUnit.digit_read_port() int

Read the value from the entire port.

Returns:

An 8-bit value representing the state of the port.

UIFLOW2:

digit_read_port.png

EXTIOUnit.digit_read(id) int

Read the value from a specific pin.

Parameters:

id (int) – The pin number (0-7).

Returns:

The value of the pin, either 0 (low) or 1 (high).

UIFLOW2:

digit_read.png

EXTIOUnit.pin(id, mode, value) Pin

Provide a MicroPython-style interface for handling GPIO pins.

Parameters:
  • id (int) – The GPIO pin number to configure and control.

  • mode (int) – The pin mode, either Pin.IN (default) or Pin.OUT.

  • value – The initial value to set for the pin if in OUT mode. Use None for no initial value.

Returns:

A Pin object for further pin operations such as reading or writing values.

class Pin

Constructors

class Pin(port, id, mode, value)

Initialize the Pin object with specified parameters.

Parameters:
  • port – The port object controlling the pin.

  • id – The pin identifier (e.g., GPIO number).

  • mode (int) – The mode of the pin, either Pin.IN (default) or Pin.OUT.

  • value – Optional initial value for the pin, 0 or 1.

UIFLOW2:

init.png

Methods

Pin.init(mode, value)

Reinitialize the pin with a new mode or value.

Parameters:
  • mode (int) – New mode for the pin, Pin.IN (default) or Pin.OUT.

  • value – New value for the pin, 0 or 1.

Pin.value(args)

Get or set the digital value of the pin.

If no arguments are passed, the method returns the current value of the pin. If one argument is passed, it sets the pin to the specified value.

Parameters:

args – Optional argument to set the pin value.

Pin.on()

Set the pin to a high state (1).

Pin.off()

Set the pin to a low state (0).