jacdac.gpio

Submodules

Package Contents

Classes

GPIOClient

Access to General Purpose Input/Output (GPIO) pins on a board.

class jacdac.gpio.GPIOClient(bus: jacdac.bus.Bus, role: str, *, missing_state_value: bytes | None = None)

Bases: jacdac.bus.SensorClient

Access to General Purpose Input/Output (GPIO) pins on a board.
  • The pins are indexed 0 … num_pins-1.

  • The indexing does not correspond to hardware pin names, nor labels on the board (see get_pin_info command for that),

  • and should not be exposed to the user.

Implements a client for the GPIO service.

property state: bytes | None

For every pin set to Input* the corresponding bit in digital_values will be 1 if and only if the pin is high. For other pins, the bit is 0. This is normally streamed at low-ish speed, but it’s also automatically reported whenever a digital input pin changes value (throttled to ~100Hz). The analog values can be read with the ADC service.,

property num_pins: int | None

Number of pins that can be operated through this service., _: #

pin_info(pin: int) None

Report capabilities and name of a pin.

pin_by_label(label: str) None

This responds with pin_info report.

pin_by_hw_pin(hw_pin: int) None

This responds with pin_info report.