OpenRoadCode
Public API reference for OpenRoadCode
Loading...
Searching...
No Matches
hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf Class Reference

Interface for receiving rotary encoder events. More...

Inheritance diagram for hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf:
hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder rotary_encoder_runtime._NoOpRotaryEncoder

Public Member Functions

bool is_running (self)
 Return whether the encoder is currently being monitored.
None start (self, RotationCallback rotated, ButtonCallback|None button_pressed=None, ButtonCallback|None button_released=None)
 Start monitoring the rotary encoder.
None stop (self)
 Stop monitoring the rotary encoder.
None poll (self)
 Perform implementation-specific polling work.

Detailed Description

Interface for receiving rotary encoder events.

Positive rotation values indicate clockwise movement. Negative rotation values indicate counterclockwise movement.

Member Function Documentation

◆ is_running()

bool hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.is_running ( self)

Return whether the encoder is currently being monitored.

Return values
TrueEncoder monitoring is active.
FalseEncoder monitoring is stopped.

Reimplemented in hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder, hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder, and rotary_encoder_runtime._NoOpRotaryEncoder.

◆ poll()

None hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.poll ( self)

Perform implementation-specific polling work.

Callback-driven encoders may leave this as a no-op. Implementations that accumulate hardware events can dispatch them here.

Reimplemented in hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder.

◆ start()

None hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.start ( self,
RotationCallback rotated,
ButtonCallback | None button_pressed = None,
ButtonCallback | None button_released = None )

Start monitoring the rotary encoder.

Parameters
rotatedCallback receiving signed steps since the prior event; positive values indicate clockwise rotation.
button_pressedOptional callback invoked on button press.
button_releasedOptional callback invoked on button release.

Reimplemented in hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder, hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder, and rotary_encoder_runtime._NoOpRotaryEncoder.


The documentation for this class was generated from the following file:
  • hardware_io/rotary_encoder/rotary_encoder_if.py