GPIO

class olaf.Gpio(pin: str, mock: bool = False)[source]

Quick GPIO legacy sysfs wrapper class that can handle issues with gpio pin on the OreSat cards when those pins are configured with device tree and/or device tree overlays.

Also supports mocking.

Parameters:
  • pin (str or int) – The GPIO name/label defined by device tree or the pin number. The name from the device tree is the preferred value.

  • mock (bool) – Mock the GPIO.

property mode: str

The GPIO pin mode. Readwrite.

Type:

str

property value: int

The value of GPIO pin. Readwrite.

Type:

bool

high()[source]

Set the GPIO high.

low()[source]

Set the GPIO low.

property is_high: bool

Check if the GPIO is set high. Readonly.

Type:

bool

property number: int

The GPIO number. Readonly.

Type:

int

property name: str

The GPIO name/label. Readonly.

Type:

str

class olaf.GpioError[source]

Error with Gpio

olaf.GPIO_HIGH = 1

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

olaf.GPIO_LOW = 0

int([x]) -> integer int(x, base=10) -> integer

Convert a number or string to an integer, or return 0 if no arguments are given. If x is a number, return x.__int__(). For floating point numbers, this truncates towards zero.

If x is not a number or if base is given, then x must be a string, bytes, or bytearray instance representing an integer literal in the given base. The literal can be preceded by ‘+’ or ‘-’ and be surrounded by whitespace. The base defaults to 10. Valid bases are 0 and 2-36. Base 0 means to interpret the base from the string as an integer literal. >>> int(‘0b100’, base=0) 4

olaf.GPIO_IN = 'in'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.

olaf.GPIO_OUT = 'out'

str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str

Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.