Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions rotary_encoder/_rotary_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class MissingGPIOLibraryError(Exception):


try:
import rotary_encoder_gpio_core as gpio # type: ignore
import RPi.GPIO as gpio # type: ignore
except ImportError as e:
raise MissingGPIOLibraryError(
"Could not import RPi.GPIO. If this code is running on a raspberry pi, "
Expand Down Expand Up @@ -110,19 +110,17 @@ def _did_dial_move(self) -> bool:
return True
return False

def _on_clk_changed(self, channel: object, is_on: int) -> None:
self.clk_state = bool(is_on)
def _on_clk_changed(self, channel: object) -> None:
self.clk_state = self._get_clk_state()
if self._did_dial_move() and self.on_counter_clockwise_turn is not None:
self.callback_handler(self.on_counter_clockwise_turn) # type: ignore

def _on_dt_changed(self, channel: object, is_on: int) -> None:
self.dt_state = bool(is_on)
def _on_dt_changed(self, channel: object) -> None:
self.dt_state = self._get_dt_state()
if self._did_dial_move() and self.on_clockwise_turn is not None:
self.callback_handler(self.on_clockwise_turn) # type: ignore

def _on_sw_changed(self, channel: object, is_on: int) -> None:
# Here the is_on is unreliable because it's too fast, and the button
# might still be in the transition.
def _on_sw_changed(self, channel: object) -> None:
is_on = gpio.input(self.sw_pin)
if not is_on and self.on_button_down is not None:
self.callback_handler(self.on_button_down) # type: ignore
Expand Down
6 changes: 0 additions & 6 deletions rotary_encoder_gpio_core/.gitignore

This file was deleted.

20 changes: 0 additions & 20 deletions rotary_encoder_gpio_core/LICENCE.txt

This file was deleted.

7 changes: 0 additions & 7 deletions rotary_encoder_gpio_core/README.md

This file was deleted.

32 changes: 0 additions & 32 deletions rotary_encoder_gpio_core/build.py

This file was deleted.

7 changes: 0 additions & 7 deletions rotary_encoder_gpio_core/poetry.lock

This file was deleted.

16 changes: 0 additions & 16 deletions rotary_encoder_gpio_core/pyproject.toml

This file was deleted.

25 changes: 0 additions & 25 deletions rotary_encoder_gpio_core/rotary_encoder_gpio_core/__init__.py

This file was deleted.

Loading