GPIO¶
GPIO readback, static drive, timed pulses, and pulse-width trigger configuration live on AqProtocolExerciser. Import enums and payload types from aqpxlib.gpio or aqpxlib—not from aqpxlib.message.
Tutorials
Public exports¶
| Name | Kind | Use |
|---|---|---|
PxIoState |
enum | Levels for set_gpio_state, pulse edges, and reported pin state |
PxGpioWidthTriggerMode |
enum | set_gpio_trigger(..., mode=...) |
PxGpioPinState |
message | Return type of get_gpio_state |
PxGpioTriggerEvent |
message | event_msg.global_event.gpio_trigger when handling gpio_trigger |
PxIoState
¶
Logical I/O state for a single GPIO line.
Logical level for one GPIO line.
| Member | Meaning |
|---|---|
LOW |
Driven or sampled low |
HIGH |
Driven or sampled high |
HIGH_Z |
High impedance (not actively driven) |
PxGpioWidthTriggerMode
¶
Width-condition selector for set_gpio_trigger.
| Member | Meaning |
|---|---|
TRIGGER_PULSE_WIDTH_IN_RANGE |
Fire when width is inside [min_duration_ns, max_duration_ns] (with low_pulse / high_pulse) |
TRIGGER_PULSE_WIDTH_OUT_OF_RANGE |
Fire when width is outside that window |
PxGpioPinState
¶
PxGpioPinState(
pin_idx: int = uint32_field(1),
output_state: Optional[PxIoState] = enum_field(2, optional=True),
input_state: Optional[PxIoState] = enum_field(3, optional=True),
)
One pin’s snapshot from get_gpio_state(gpio_idx=…).
| Field | Meaning |
|---|---|
pin_idx |
Pin index |
output_state |
Driven level, if known (None when not driving / unknown) |
input_state |
Sampled input (None when unavailable) |
PxGpioTriggerEvent
¶
PxGpioTriggerEvent(
pin_idx: int = uint32_field(1),
pulse_duration: int = uint64_field(2),
pulse_polarity: bool = bool_field(3),
)
Payload for the gpio_trigger handler (PxEventMsg.global_event.gpio_trigger).
| Field | Meaning |
|---|---|
pin_idx |
Pin that matched |
pulse_duration |
Width in nanoseconds |
pulse_polarity |
Detected polarity |
Exerciser methods¶
AqProtocolExerciser
¶
AqProtocolExerciser class.
| METHOD | DESCRIPTION |
|---|---|
get_gpio_state |
Read electrical state for one GPIO pin. |
set_gpio_state |
Drive a static logic level on one GPIO pin. |
send_gpio_pulse |
Emit one pulse: idle → |
set_gpio_trigger |
Configure GPIO pulse-width triggering (fires |
get_gpio_state
¶
get_gpio_state(gpio_idx: int) -> PxGpioPinState
Read electrical state for one GPIO pin.
The instrument returns status for all pins; this method selects gpio_idx.
| PARAMETER | DESCRIPTION |
|---|---|
|
Index of the pin to read.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
PxGpioPinState
|
TYPE:
|
PxGpioPinState
|
and |
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
set_gpio_state
¶
send_gpio_pulse
¶
send_gpio_pulse(
gpio_idx: int, active_state: PxIoState, idle_state: PxIoState, active_time_ns: int
) -> None
Emit one pulse: idle → active_state for active_time_ns → idle_state.
Supported only on GPIO indices 8 and 9. Pulse width must be greater than 5 ns and less than 1 second.
| PARAMETER | DESCRIPTION |
|---|---|
|
Pin index; must be
TYPE:
|
|
Level during the active portion of the pulse.
TYPE:
|
|
Level after the pulse completes.
TYPE:
|
|
Width of the active portion in nanoseconds.
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |
set_gpio_trigger
¶
set_gpio_trigger(
gpio_idx: int,
min_duration_ns: int,
max_duration_ns: int,
low_pulse: bool = False,
high_pulse: bool = False,
mode: PxGpioWidthTriggerMode = TRIGGER_PULSE_WIDTH_IN_RANGE,
) -> None
Configure GPIO pulse-width triggering (fires gpio_trigger global events).
Supported only on GPIO indices 8 and 9. Both duration bounds must be greater than 5 ns and less than 1 second.
| PARAMETER | DESCRIPTION |
|---|---|
|
Pin index; must be
TYPE:
|
|
Minimum pulse width for the condition (nanoseconds).
TYPE:
|
|
Maximum pulse width for the condition (nanoseconds).
TYPE:
|
|
Include low-going pulses when
TYPE:
|
|
Include high-going pulses when
TYPE:
|
|
TYPE:
|
| RAISES | DESCRIPTION |
|---|---|
ValueError
|
If |