mirror of
https://github.com/Febbweiss/mopidy-touchscreen.git
synced 2026-03-04 14:15:41 +00:00
Merge pull request #1 from Febbweiss/gpio-fix
Fix GPIO callback and pygame keys
This commit is contained in:
@@ -30,13 +30,13 @@ class GPIOManager():
|
|||||||
|
|
||||||
# Down Button
|
# Down Button
|
||||||
GPIO.setup(pins['down'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
GPIO.setup(pins['down'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
GPIO.add_event_detect(pins['down'], GPIO.BOTH, callback=right,
|
GPIO.add_event_detect(pins['down'], GPIO.BOTH, callback=down,
|
||||||
bouncetime=30)
|
bouncetime=30)
|
||||||
|
|
||||||
# Enter Button
|
# Enter Button
|
||||||
GPIO.setup(pins['enter'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
GPIO.setup(pins['enter'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
|
||||||
GPIO.add_event_detect(pins['enter'], GPIO.BOTH,
|
GPIO.add_event_detect(pins['enter'], GPIO.BOTH,
|
||||||
callback=right,
|
callback=enter,
|
||||||
bouncetime=30)
|
bouncetime=30)
|
||||||
|
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ def left(channel):
|
|||||||
else:
|
else:
|
||||||
type = pygame.KEYDOWN
|
type = pygame.KEYDOWN
|
||||||
dict['unicode'] = None
|
dict['unicode'] = None
|
||||||
dict['key'] = pygame.K_RIGHT
|
dict['key'] = pygame.K_LEFT
|
||||||
event = pygame.event.Event(type, dict)
|
event = pygame.event.Event(type, dict)
|
||||||
pygame.event.post(event)
|
pygame.event.post(event)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user