@@ -58,7 +58,7 @@ uint8_t LocalButtons::readButtons(uint64_t* buf){
5858}
5959
6060void LocalButtons::saveFlash (){
61- uint16_t dat = this ->mask & 0xff ;
61+ uint16_t dat = this ->mask & 0xffff ;
6262 Flash_Write (ADR_LOCAL_BTN_CONF, dat);
6363
6464 uint16_t dat2 = this ->polarity & 0x01 ;
@@ -68,7 +68,7 @@ void LocalButtons::saveFlash(){
6868void LocalButtons::restoreFlash (){
6969 uint16_t dat = 0 ;
7070 if (Flash_Read (ADR_LOCAL_BTN_CONF,&dat)){
71- this ->setMask (dat & 0xff );
71+ this ->setMask (dat & 0xffff );
7272 }
7373
7474 if (Flash_Read (ADR_LOCAL_BTN_CONF_2,&dat)){
@@ -125,3 +125,58 @@ CommandStatus LocalButtons::command(const ParsedCommand& cmd,std::vector<Command
125125
126126}
127127
128+ /* *
129+ * All DIN pins must be defined as inputs.
130+ * Not more than 16 pins can be defined
131+ */
132+ const std::array<InputPin,BUTTON_PINS> LocalButtons::button_pins {
133+ #if BUTTON_PINS > 0
134+ InputPin (DIN0_GPIO_Port, DIN0_Pin),
135+ #endif
136+ #if BUTTON_PINS > 1
137+ InputPin (DIN1_GPIO_Port, DIN1_Pin),
138+ #endif
139+ #if BUTTON_PINS > 2
140+ InputPin (DIN2_GPIO_Port, DIN2_Pin),
141+ #endif
142+ #if BUTTON_PINS > 3
143+ InputPin (DIN3_GPIO_Port, DIN3_Pin),
144+ #endif
145+ #if BUTTON_PINS > 4
146+ InputPin (DIN4_GPIO_Port, DIN4_Pin),
147+ #endif
148+ #if BUTTON_PINS > 5
149+ InputPin (DIN5_GPIO_Port, DIN5_Pin),
150+ #endif
151+ #if BUTTON_PINS > 6
152+ InputPin (DIN6_GPIO_Port, DIN6_Pin),
153+ #endif
154+ #if BUTTON_PINS > 7
155+ InputPin (DIN7_GPIO_Port, DIN7_Pin),
156+ #endif
157+ #if BUTTON_PINS > 8
158+ InputPin (DIN8_GPIO_Port, DIN8_Pin),
159+ #endif
160+ #if BUTTON_PINS > 9
161+ InputPin (DIN9_GPIO_Port, DIN9_Pin),
162+ #endif
163+ #if BUTTON_PINS > 10
164+ InputPin (DIN10_GPIO_Port, DIN10_Pin),
165+ #endif
166+ #if BUTTON_PINS > 11
167+ InputPin (DIN11_GPIO_Port, DIN11_Pin),
168+ #endif
169+ #if BUTTON_PINS > 12
170+ InputPin (DIN12_GPIO_Port, DIN12_Pin),
171+ #endif
172+ #if BUTTON_PINS > 13
173+ InputPin (DIN13_GPIO_Port, DIN13_Pin),
174+ #endif
175+ #if BUTTON_PINS > 14
176+ InputPin (DIN14_GPIO_Port, DIN14_Pin),
177+ #endif
178+ #if BUTTON_PINS > 15
179+ InputPin (DIN15_GPIO_Port, DIN15_Pin),
180+ #endif
181+
182+ };
0 commit comments