PRU

class olaf.PruState(value)[source]

Bases: Enum

All the states a Pru can be in.

OFFLINE = 1

PRU is offline

RUNNING = 2

PRU is online and running

exception olaf.PruError[source]

Raised when a error occurs with a PRU.

class olaf.Pru(pru_num: int)[source]

Handles interterations with a PRU on Octavo A8.

A PRU is Programible Real-time Unit. It’s a microcontroller that shares pins and other resources with the core processor.

Parameters:

pru_num (int) – PRU number. Must be a 0 or 1.

Raises:

PruErrorpru was not set to 0 or 1 or if the firmware file does not exist.

start()[source]

Starts the PRU.

Raises:

PruError – The PRU or PRU firmware was not found.

stop()[source]

Stops the PRU.

Raises:

PruError – The PRU was not found.

restart()[source]

Restarts the PRU.

property state: PruState

The state of the PRU.

Type:

PruState

exists(raise_exception: bool = False) bool[source]

Check if the PRU exists.

Parameters:

raise_exception (bool) – Raises PruError if PRU is not found.

Raises:

PruError – Raised when raise_exception was set to True and the PRU was not found.

Returns:

True if the PRU exists or False if not found.

Return type:

bool

property firmware: str

Firmware file name selected. Must be in /lib/firmware/.

Type:

str