Reads a directly connected rotary encoder using Raspberry Pi GPIO. More...
Public Member Functions | |
| GpioRotaryEncoderPins | pins (self) |
| Return the GPIO pin assignment used by the encoder. | |
| 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 | cleanup (self) |
| Stop monitoring and release only the GPIO channels used by this encoder. | |
| None | poll (self) |
| Dispatch accumulated rotary movement. | |
| None | tick (self) |
| Backward-compatible alias for poll(). | |
Reads a directly connected rotary encoder using Raspberry Pi GPIO.
Physical Raspberry Pi header pin numbers are used when configuring the encoder.
| bool hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder.is_running | ( | self | ) |
Return whether the encoder is currently being monitored.
| True | Encoder monitoring is active. |
| False | Encoder monitoring is stopped. |
Reimplemented from hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.
| GpioRotaryEncoderPins hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder.pins | ( | self | ) |
Return the GPIO pin assignment used by the encoder.
| None hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder.poll | ( | self | ) |
Dispatch accumulated rotary movement.
This method should be called periodically by the component using the encoder.
Reimplemented from hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.
| None hardware_io.rotary_encoder.gpio_rotary_encoder.GpioRotaryEncoder.start | ( | self, | |
| RotationCallback | rotated, | ||
| ButtonCallback | None | button_pressed = None, | ||
| ButtonCallback | None | button_released = None ) |
Start monitoring the rotary encoder.
| rotated | Callback receiving signed steps since the prior event; positive values indicate clockwise rotation. |
| button_pressed | Optional callback invoked on button press. |
| button_released | Optional callback invoked on button release. |
Reimplemented from hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf.