2 #include "input_config.h"
5 uint8_t switch_last_state
= 0;
6 int switch_debounce_timeout
= 0;
8 void input_setup(void){
12 void input_loop(void){
14 //switch_states[0] |= !!(PINH&0x02);
15 for(int i
=0; i
<INPUT_COUNT
; i
++){
16 debounce_timeouts
[i
]--;
17 //A #define for the debounce time would be great
18 if(debounce_timeouts
[i
] == 0){
19 uint8_t new_switch_state
= switch_states
[i
]<<1;
20 if(!(switch_states
[i
]^new_switch_state
)){
23 uart_puthex(switch_states
[i
]&1);
24 debounce_timeouts
[i
] = 0xFF;
25 switch_states
[i
] = new_switch_state
&3;