gpio Module

LED outputs using the GPIO interface of the RPi

LED Classes

class tallypi.outputs.gpio.LED(*args, **kwargs)[source]

Bases: tallypi.outputs.gpio.SingleLED

A single color, non-dimmed LED

Parameters
  • config (SingleTallyConfig) – The initial value for config

  • pin (int) – The GPIO pin number for the LED

  • active_high (bool, optional) – Set to True (the default) for common cathode LEDs, False for common anode LEDs

  • brightness_scale (float, optional) – The value to set for brightness_scale. Default is 1.0

set_led(color: tslumd.common.TallyColor, brightness: float)[source]

Set the LED values from the given color and brightness

class tallypi.outputs.gpio.PWMLED(*args, **kwargs)[source]

Bases: tallypi.outputs.gpio.SingleLED

A single color, dimmable (PWM) LED

Parameters
  • config (SingleTallyConfig) – The initial value for config

  • pin (int) – The GPIO pin number for the LED

  • active_high (bool, optional) – Set to True (the default) for common cathode LEDs, False for common anode LEDs

  • brightness_scale (float, optional) – The value to set for brightness_scale. Default is 1.0

set_led(color: tslumd.common.TallyColor, brightness: float)[source]

Set the LED values from the given color and brightness

class tallypi.outputs.gpio.RGBLED(*args, **kwargs)[source]

Bases: tallypi.outputs.gpio.BaseLED

A full color RGB LED using PWM dimming

Parameters
  • config (SingleTallyConfig) – The initial value for config

  • pins – Initial value for pins

  • active_high (bool, optional) – Set to True (the default) for common cathode LEDs, False for common anode LEDs

  • brightness_scale (float, optional) – The value to set for brightness_scale. Default is 1.0

pins: Tuple[int, int, int]

The GPIO pin numbers for each of the red, green and blue components

classmethod get_init_options()Tuple[tallypi.config.Option][source]

Get the config.Option definitions required for this object

set_led(color: tslumd.common.TallyColor, brightness: float)[source]

Set the LED values from the given color and brightness

Base Classes

class tallypi.outputs.gpio.BaseLED(*args, **kwargs)[source]

Bases: tallypi.baseio.BaseOutput

Base class for GPIO LEDs

Parameters
  • config (SingleTallyConfig) – The initial value for config

  • active_high (bool, optional) – Set to True (the default) for common cathode LEDs, False for common anode LEDs

  • brightness_scale (float, optional) – The value to set for brightness_scale. Default is 1.0

active_high: bool

If True configure the GPIO pins as common cathode, False for common anode

brightness_scale: float

A multiplier (from 0.0 to 1.0) used to limit the maximum brightness (for PWM LEDs). A value of 1.0 produces the full range while 0.5 scales to half brightness.

classmethod get_init_options()Tuple[tallypi.config.Option][source]

Get the config.Option definitions required for this object

async open()[source]

Initalize any necessary device communication

async close()[source]

Close device communication

set_led(color: tslumd.common.TallyColor, brightness: float)[source]

Set the LED values from the given color and brightness

async on_receiver_tally_change(tally: tslumd.tallyobj.Tally, *args, **kwargs)[source]

Callback for tally updates from tslumd.tallyobj.Tally

class tallypi.outputs.gpio.SingleLED(*args, **kwargs)[source]

Bases: tallypi.outputs.gpio.BaseLED

Base class for LEDs that use a single GPIO pin

Parameters
  • config (SingleTallyConfig) – The initial value for config

  • pin (int) – The GPIO pin number for the LED

  • active_high (bool, optional) – Set to True (the default) for common cathode LEDs, False for common anode LEDs

  • brightness_scale (float, optional) – The value to set for brightness_scale. Default is 1.0

pin: int

The GPIO pin number for the LED

classmethod get_init_options()Tuple[tallypi.config.Option][source]

Get the config.Option definitions required for this object