Skip to content

Commit

Permalink
fix(keypad): make keypad compatible with kernel 6.6 by using gpiozero
Browse files Browse the repository at this point in the history
  • Loading branch information
zytegalaxy authored and sassanh committed Apr 2, 2024
1 parent b001791 commit e3c95d6
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## Version 0.12.3

- fix(keypad): make keypad compatible with kernel 6.6 by using gpiozero

## Version 0.12.2

- feat(lightdm): add lightdm service
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ Note that as part of the installation process, these debian packages are install
- libgl1
- libmtdev1
- libzbar0
- python3
- python3-alsaaudio
- python3-dev
- python3-gpiozero
- python3-libcamera
- python3-alsaaudio
- python3-picamera2
- python3-pip
- python3-pyaudio
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ubo-app"
version = "0.12.2"
version = "0.12.3"
description = "Ubo main app, running on device initialization. A platform for running other apps."
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand Down
16 changes: 5 additions & 11 deletions ubo_app/services/020-keypad/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,12 @@ def disable_interrupt_for_higher_bits(
def init_i2c(self: Keypad) -> None:
if not IS_RPI:
return
# connect to the I2C bus
from RPi import GPIO
# Use GPIO to receive interrupt from the GPIO expander
from gpiozero import Button

GPIO.setmode(GPIO.BCM)
i2c = board.I2C()
# Set this to the GPIO of the interrupt:
GPIO.setup(INT_EXPANDER, GPIO.IN, pull_up_down=GPIO.PUD_UP)
btn = Button(INT_EXPANDER)
try:
import adafruit_aw9523

Expand Down Expand Up @@ -207,13 +206,8 @@ def init_i2c(self: Keypad) -> None:
self.event_queue = [Event(inputs=self.inputs, timestamp=time.time())]
time.sleep(0.5)

# Enable interrupt on the GPIO expander
GPIO.add_event_detect(
INT_EXPANDER,
GPIO.FALLING,
callback=self.key_press_cb,
bouncetime=1,
)
# Interrupt callback when any button is pressed
btn.when_pressed=self.key_press_cb

def key_press_cb(self: Keypad, _: object) -> None:
"""Handle key press dispatched by GPIO interrupt.
Expand Down
3 changes: 2 additions & 1 deletion ubo_app/system/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,10 @@ apt-get -y install \
libgl1 \
libmtdev1 \
libzbar0 \
python3-alsaaudio \
python3-dev \
python3-gpiozero \
python3-libcamera \
python3-alsaaudio \
python3-picamera2 \
python3-pip \
python3-pyaudio \
Expand Down

0 comments on commit e3c95d6

Please sign in to comment.