poulet_py.hardware.triggers package#

class BaseTrigger(**data)[source]#

Bases: BaseModel, ABC

Abstract base class for trigger devices.

abstractmethod cleanup()[source]#

Cleanup trigger resources.

Return type:

None

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

abstractmethod wait()[source]#

Wait for trigger event.

Return type:

bool

name: str#
timeout: float | None#
class GPIOTrigger(*, name: str = '', timeout: float | None = None, pin: int, pull_up: bool = False, edge: Literal['rising', 'falling', 'both'] = 'rising')[source]#

Bases: BaseTrigger

GPIO-based trigger using gpiozero.

__init__(**data)[source]#

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

cleanup()[source]#

Cleanup GPIO resources.

Return type:

None

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_post_init(context, /)#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Return type:

None

Args:

self: The BaseModel instance. context: The context.

wait()[source]#

Wait for GPIO event.

Return type:

bool

pin: int#
pull_up: bool#
edge: Literal['rising', 'falling', 'both']#
name: str#
timeout: float | None#
class KeyboardTrigger(**data)[source]#

Bases: BaseTrigger

Keyboard-based trigger (press Enter key).

cleanup()[source]#

No cleanup needed for keyboard.

Return type:

None

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

wait()[source]#

Wait for keyboard input with optional timeout.

Return type:

bool

key: str#
name: str#
timeout: float | None#

Submodules#