j5.components package¶
Submodules¶
j5.components.base module¶
Base classes for components.
-
class
j5.components.base.
Component
[source]¶ Bases:
object
A component is the smallest logical part of some hardware.
j5.components.led module¶
Classes for the LED support.
-
class
j5.components.led.
LED
(identifier: int, board: j5.boards.base.Board, backend: j5.components.led.LEDInterface)[source]¶ Bases:
j5.components.base.Component
A standard Light Emitting Diode.
-
static
interface_class
() → Type[j5.components.led.LEDInterface][source]¶ Get the interface class that is required to use this component.
-
state
¶ Get the current state of the LED.
-
static
-
class
j5.components.led.
LEDInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to control an LED.
Module contents¶
This module contains components, which are the smallest logical element of hardware.
-
class
j5.components.
BatterySensor
(identifier: int, board: j5.boards.base.Board, backend: j5.components.battery_sensor.BatterySensorInterface)[source]¶ Bases:
j5.components.base.Component
A sensor capable of monitoring a battery.
-
current
¶ Get the current of the battery sensor.
-
static
interface_class
() → Type[j5.components.battery_sensor.BatterySensorInterface][source]¶ Get the interface class that is required to use this component.
-
voltage
¶ Get the voltage of the battery sensor.
-
-
class
j5.components.
BatterySensorInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to read data from a BatterySensor.
-
class
j5.components.
Button
(identifier: int, board: j5.boards.base.Board, backend: j5.components.button.ButtonInterface)[source]¶ Bases:
j5.components.base.Component
A button.
-
static
interface_class
() → Type[j5.components.button.ButtonInterface][source]¶ Get the interface class that is required to use this component.
-
is_pressed
¶ Get the current pushed state of the button.
-
static
-
class
j5.components.
ButtonInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required for a button.
Set the state of a button.
Halt the program until this button is pushed.
-
class
j5.components.
Component
[source]¶ Bases:
object
A component is the smallest logical part of some hardware.
-
class
j5.components.
GPIOPin
(identifier: int, board: j5.boards.base.Board, backend: j5.components.gpio_pin.GPIOPinInterface, supported_modes: List[j5.components.gpio_pin.GPIOPinMode] = [<GPIOPinMode.DIGITAL_OUTPUT: 3>], initial_mode: Optional[j5.components.gpio_pin.GPIOPinMode] = None)[source]¶ Bases:
j5.components.base.Component
A GPIO Pin.
-
analogue_value
¶ Get the scaled analogue reading of the pin.
-
digital_state
¶ Get the digital state of the pin.
-
static
interface_class
() → Type[j5.components.gpio_pin.GPIOPinInterface][source]¶ Get the interface class that is required to use this component.
-
mode
¶ Get the hardware mode of this pin.
-
-
class
j5.components.
GPIOPinInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required for a GPIO Pin.
-
get_gpio_pin_digital_state
(board: j5.boards.base.Board, identifier: int) → bool[source]¶ Get the last written state of the GPIO pin.
-
get_gpio_pin_mode
(board: j5.boards.base.Board, identifier: int) → j5.components.gpio_pin.GPIOPinMode[source]¶ Get the hardware mode of a GPIO pin.
-
read_gpio_pin_analogue_value
(board: j5.boards.base.Board, identifier: int) → float[source]¶ Read the scaled analogue value of the GPIO pin.
-
read_gpio_pin_digital_state
(board: j5.boards.base.Board, identifier: int) → bool[source]¶ Read the digital state of the GPIO pin.
-
set_gpio_pin_mode
(board: j5.boards.base.Board, identifier: int, pin_mode: j5.components.gpio_pin.GPIOPinMode) → None[source]¶ Set the hardware mode of a GPIO pin.
-
write_gpio_pin_dac_value
(board: j5.boards.base.Board, identifier: int, scaled_value: float) → None[source]¶ Write a scaled analogue value to the DAC on the GPIO pin.
-
-
class
j5.components.
GPIOPinMode
[source]¶ Bases:
enum.IntEnum
Hardware modes that a GPIO pin can be set to.
-
ANALOGUE_INPUT
= 4¶ The analogue voltage of the pin can be read.
-
ANALOGUE_OUTPUT
= 5¶ The analogue voltage of the pin can be set using a DAC.
-
DIGITAL_INPUT
= 0¶ The digital state of the pin can be read
-
DIGITAL_INPUT_PULLDOWN
= 2¶ Same as DIGITAL_INPUT but internal pull-down is enabled
-
DIGITAL_INPUT_PULLUP
= 1¶ Same as DIGITAL_INPUT but internal pull-up is enabled
-
DIGITAL_OUTPUT
= 3¶ The digital state of the pin can be set.
-
PWM_OUTPUT
= 6¶ A PWM output signal can be created on the pin.
-
-
class
j5.components.
LED
(identifier: int, board: j5.boards.base.Board, backend: j5.components.led.LEDInterface)[source]¶ Bases:
j5.components.base.Component
A standard Light Emitting Diode.
-
static
interface_class
() → Type[j5.components.led.LEDInterface][source]¶ Get the interface class that is required to use this component.
-
state
¶ Get the current state of the LED.
-
static
-
class
j5.components.
LEDInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to control an LED.
-
exception
j5.components.
NotSupportedByHardwareError
[source]¶ Bases:
Exception
This is thrown when hardware does not support the action that is attempted.
-
class
j5.components.
Piezo
(identifier: int, board: j5.boards.base.Board, backend: j5.components.piezo.PiezoInterface)[source]¶ Bases:
j5.components.base.Component
A standard piezo.
-
class
j5.components.
PiezoInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to control an piezo.
-
class
j5.components.
PowerOutput
(identifier: int, board: j5.boards.base.Board, backend: j5.components.power_output.PowerOutputInterface)[source]¶ Bases:
j5.components.base.Component
A power output channel.
It can be enabled/disabled, and the current being drawn on this channel can be measured.
-
current
¶ Get the current being drawn on this power output, in amperes.
-
static
interface_class
() → Type[j5.components.power_output.PowerOutputInterface][source]¶ Get the interface class that is required to use this component.
-
is_enabled
¶ Get whether the output is enabled.
-
-
class
j5.components.
PowerOutputInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to control a power output channel.
-
get_power_output_current
(board: j5.boards.base.Board, identifier: int) → float[source]¶ Get the current being drawn on a power output, in amperes.
-
-
class
j5.components.
PowerOutputGroup
(outputs: Mapping[T, j5.components.power_output.PowerOutput])[source]¶ Bases:
object
A group of PowerOutputs.
-
class
j5.components.
Servo
(identifier: int, board: j5.boards.base.Board, backend: j5.components.servo.ServoInterface)[source]¶ Bases:
j5.components.base.Component
A standard servomotor.
-
static
interface_class
() → Type[j5.components.servo.ServoInterface][source]¶ Get the interface class that is required to use this component.
-
position
¶ Get the current position of the Servo.
-
static
-
class
j5.components.
ServoInterface
[source]¶ Bases:
j5.components.base.Interface
An interface containing the methods required to control a Servo.