j5.backends.console.sr.v4.power_board module¶
Console Backend for the SR V4 power board.
-
class
j5.backends.console.sr.v4.power_board.
SRV4PowerBoardConsoleBackend
(serial: str, console_class: Type[j5.backends.console.console.Console] = <class 'j5.backends.console.console.Console'>)[source]¶ Bases:
j5.components.power_output.PowerOutputInterface
,j5.components.piezo.PiezoInterface
,j5.components.button.ButtonInterface
,j5.components.battery_sensor.BatterySensorInterface
,j5.components.led.LEDInterface
,j5.backends.backend.Backend
The console implementation of the SR V4 power board.
-
board
¶
-
buzz
(identifier: int, duration: datetime.timedelta, pitch: float) → None[source]¶ Queue a pitch to be played.
Parameters: - identifier – piezo identifier to play pitch on.
- duration – duration of the tone.
- pitch – Pitch of the tone in Hz.
Raises: ValueError – invalid value for parameter.
-
classmethod
discover
() → Set[j5.boards.board.Board][source]¶ Discover boards that this backend can control.
Returns: set of boards that this backend can control.
-
firmware_version
¶ The firmware version reported by the board.
Returns: firmware version reported by the board, if any.
-
get_battery_sensor_current
(identifier: int) → float[source]¶ Get the current of a battery sensor.
Parameters: identifier – Identifier of battery sensor. Returns: current measured by the sensor. Raises: ValueError – invalid battery sensor identifier.
-
get_battery_sensor_voltage
(identifier: int) → float[source]¶ Get the voltage of a battery sensor.
Parameters: identifier – Identifier of battery sensor. Returns: voltage measured by the sensor. Raises: ValueError – invalid battery sensor identifier.
Get the state of a button.
Parameters: identifier – Button identifier to fetch state of. Returns: state of the button. Raises: ValueError – invalid button identifier.
-
get_led_state
(identifier: int) → bool[source]¶ Get the state of an LED.
Parameters: identifier – identifier of the LED. Returns: current state of the LED.
-
get_power_output_current
(identifier: int) → float[source]¶ Get the current being drawn on a power output, in amperes.
Parameters: identifier – power output to fetch current of. Returns: measured current of the output. Raises: ValueError – Invalid power output identifier.
-
get_power_output_enabled
(identifier: int) → bool[source]¶ Get whether a power output is enabled.
Parameters: identifier – power output to fetch status of. Returns: status of the power output. Raises: ValueError – Invalid power output identifier.
-
serial
¶ The serial number reported by the board.
Returns: serial number reported by the board.
-
set_led_state
(identifier: int, state: bool) → None[source]¶ Set the state of an LED.
Parameters: - identifier – identifier of the LED.
- state – desired state of the LED.
Raises: ValueError – invalid LED identifer.
-
set_power_output_enabled
(identifier: int, enabled: bool) → None[source]¶ Set whether a power output is enabled.
Parameters: - identifier – power output to enable / disable
- enabled – status of the power output.
Raises: ValueError – Invalid power output identifier.
Halt the program until this button is pushed.
Parameters: identifier – Button identifier to wait for.
-