File tree Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Expand file tree Collapse file tree 2 files changed +45
-0
lines changed Original file line number Diff line number Diff line change 1+ import json
2+
3+ from helper .Constants import Constants
4+
5+ c = Constants ()
6+
7+
8+ class GpioHelper :
9+ GPIO_SETTINGS_PATH = f"{ c .settings_path ()} /gpio-pin-mapping.json"
10+
11+ def get_mappings (self ) -> dict :
12+ with open (self .GPIO_SETTINGS_PATH ) as file :
13+ data = json .load (file )
14+ return data
15+
16+ def rotary_volume_up (self ) -> int :
17+ return self .get_mappings ()["ROTARY_VOLUME_UP" ]
18+
19+ def rotary_volume_down (self ) -> int :
20+ return self .get_mappings ()["ROTARY_VOLUME_DOWN" ]
21+
22+ def rotary_volume_press (self ) -> int :
23+ return self .get_mappings ()["ROTARY_VOLUME_PRESS" ]
24+
25+ def rotary_bass_up (self ) -> int :
26+ return self .get_mappings ()["ROTARY_BASS_UP" ]
27+
28+ def rotary_bass_down (self ) -> int :
29+ return self .get_mappings ()["ROTARY_BASS_DOWN" ]
30+
31+ def rotary_pitch_up (self ) -> int :
32+ return self .get_mappings ()["ROTARY_PITCH_UP" ]
33+
34+ def rotary_pitch_down (self ) -> int :
35+ return self .get_mappings ()["ROTARY_PITCH_DOWN" ]
Original file line number Diff line number Diff line change 1+ {
2+ "ROTARY_VOLUME_UP" : 6 ,
3+ "ROTARY_VOLUME_DOWN" : 12 ,
4+ "ROTARY_VOLUME_PRESS" : 13 ,
5+ "ROTARY_BASS_UP" : 4 ,
6+ "ROTARY_BASS_DOWN" : 14 ,
7+ "ROTARY_PITCH_UP" : 11 ,
8+ "ROTARY_PITCH_DOWN" : 8 ,
9+ "START_PARTY_MODE_BUTTON" : 21
10+ }
You can’t perform that action at this time.
0 commit comments