I'm trying to figure out some things with some firmware that was written for us. I'm not all that familiar with C and I think there's some shorthand going on here that I'm just not getting. I don't understand how the code relates to the comments, particularly how you get 70ms from any of that. Can you help translate into English?
// so the button has to be held for 70 ms to be considered being pressed
// and then has to be released for 70ms to be considered un-pressed
State=(State<<1) | !input(USER_BUTTON) | 0xe000;
if(State==0xe000)
{
Debounced_Button_Pressed = TRUE;
time_button_held++;
}
else if (State==0xffff)
{
Debounced_Button_Pressed = FALSE;
}
This is within a timer interrupt function and apparently fires every 4.4ms
Thanks.