Reads rotary encoder events from an Adafruit Seesaw I2C device. More...
Public Member Functions | |
| None | __init__ (self, int address=DEFAULT_ADDRESS, *, Any|None i2c=None, int button_pin=DEFAULT_BUTTON_PIN, float poll_interval=DEFAULT_POLL_INTERVAL, bool reverse_direction=False, float debounce_seconds=0.03) |
| Args: address: I2C address of the Seesaw device. | |
| 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. | |
| Public Member Functions inherited from hardware_io.rotary_encoder.rotary_encoder_if.RotaryEncoderIf | |
| None | poll (self) |
| Perform implementation-specific polling work. | |
Reads rotary encoder events from an Adafruit Seesaw I2C device.
Rotation and button events are monitored in a background thread.
| None hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder.__init__ | ( | self, | |
| int | address = DEFAULT_ADDRESS, | ||
| * | , | ||
| Any | None | i2c = None, | ||
| int | button_pin = DEFAULT_BUTTON_PIN, | ||
| float | poll_interval = DEFAULT_POLL_INTERVAL, | ||
| bool | reverse_direction = False, | ||
| float | debounce_seconds = 0.03 ) |
Args: address: I2C address of the Seesaw device.
i2c: Optional initialized I2C bus. When omitted, board.I2C() is used.
button_pin: Seesaw GPIO pin connected to the encoder button.
poll_interval: Delay between hardware reads, in seconds.
reverse_direction: Reverse the reported rotation direction.
debounce_seconds: Time that the button state must remain stable before a button event is emitted.
| bool hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder.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.
| None hardware_io.rotary_encoder.seesaw_rotary_encoder.SeesawRotaryEncoder.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.