pynq.lib.switch Module

The pynq.lib.switch module is a driver for reading, and waiting for value changes on onboard switches.

class pynq.lib.switch.Switch(index)[source]

Bases: object

This class controls the onboard switches.

index

int – Index of the onboard switches, starting from 0.

read()[source]

Read the current value of the switch.

Returns:Either 0 if the switch is off or 1 if the switch is on
Return type:int
wait_for_value(value)[source]

Wait for the switch to be set to a particular position

Parameters:
  • value (int) – 1 for the switch up and 0 for the switch down
  • function wraps the coroutine form so the asyncio (This) –
  • loop will run until the function returns (event) –
wait_for_value_async(value)[source]

Wait for the switch to be set to a particular position

Parameters:
  • value (int) – 1 for the switch up and 0 for the switch down
  • function is an asyncio coroutine (This) –