def init_rotary_encoders(self):
""" Rotary encoders (RE) initializer.
This is executed only if RE enabled in config.txt. Two REs are configured this way:
1. Volume Control: GPIO16 - Volume Up, GPIO26 - Volume Down, GPIO13 - Mute
2. Tuning: GPIO12 - Move Right, GPIO6 - Move Left, GPIO5 - Select
RE events will be wrapped into keyboard events with the following assignment:
Volume Up - '+' key on numeric keypad, Volume Down - '-' key on keypad, Mute - 'x' key
"""
if not self.config[USAGE][USE_ROTARY_ENCODERS]:
return
from event.rotary import RotaryEncoder
RotaryEncoder(16, 26, 13, pygame.K_KP_PLUS, pygame.K_KP_MINUS, pygame.K_x)
RotaryEncoder(12, 6, 5, pygame.K_RIGHT, pygame.K_LEFT, pygame.K_RETURN)
评论列表
文章目录