pynq.board package — Python productivity for Zynq (Pynq) v1.0

# pynq.board package

## Submodules

## pynq.board.button module

class `pynq.board.button.``Button`(index)

  Bases: `object`

  This class controls the onboard push-buttons.

  `index`

    int – Index of the push-buttons, starting from 0.

  `read`()

    Read the current value of the button.

    Returns: | Either 1 if the button is pressed or 0 otherwise
    Return type: | int

## pynq.board.led module

class `pynq.board.led.``LED`(index)

  Bases: `object`

  This class controls the onboard LEDs.

  `index`

    int – The index of the onboard LED, starting from 0.

  `off`()

    Turn off a single LED.

    Parameters: | None –
    Returns: |
    Return type: | None

  `on`()

    Turn on a single LED.

    Parameters: | None –
    Returns: |
    Return type: | None

  `read`()

    Retrieve the LED state.

    Returns: | Either 0 if the LED is off or 1 if the LED is on.
    Return type: | int

  `toggle`()

    Flip the state of a single LED.

    If the LED is on, it will be turned off. If the LED is off, it will be turned on.

    Parameters: | None –
    Returns: |
    Return type: | None

  `write`(value)

    Set the LED state according to the input value.

    Parameters: | value (int) – This parameter can be either 0 (off) or 1 (on).
    Raises: | `ValueError` – If the value parameter is not 0 or 1.

## pynq.board.rgbled module

class `pynq.board.rgbled.``RGBLED`(index)

  Bases: `object`

  This class controls the onboard RGB LEDs.

  `index`

    int – The index of the RGB LED, from 4 (LD4) to 5 (LD5).

  `_mmio`

    MMIO – Shared memory map for the RGBLED GPIO controller.

  `_rgbleds_val`

    int – Global value of the RGBLED GPIO pins.

  `off`()

    Turn off a single RGBLED.

    Parameters: | None –
    Returns: |
    Return type: | None

  `on`(color)

    Turn on a single RGB LED with a color value (see color constants).

    Parameters: | color (int) – Color of RGB specified by a 3-bit RGB integer value.
    Returns: |
    Return type: | None

  `read`()

    Retrieve the RGBLED state.

    Returns: | The color value stored in the RGBLED.
    Return type: | int

  `write`(color)

    Set the RGBLED state according to the input value.

    Parameters: | color (int) – Color of RGB specified by a 3-bit RGB integer value.
    Returns: |
    Return type: | None

`pynq.board.rgbled.``RGBLEDS_START_INDEX` = 4

  Reference Color Values for RGB LED

## pynq.board.switch module

class `pynq.board.switch.``Switch`(index)

  Bases: `object`

  This class controls the onboard switches.

  `index`

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

  `read`()

    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

## Module contents