Description
Source
Call Graph
Start Line: 213
void ISR_Bp2(void)
{
static unsigned int lastPress = 0;
// Check if the button has been pressed
if (!PIO_Get(&pinPB2)) {
// Simple debounce method: limit push frequency to 1/DEBOUNCE_TIME
// (i.e. at least DEBOUNCE_TIME ms between each push)
if ((timestamp - lastPress) > DEBOUNCE_TIME) {
lastPress = timestamp;
// Disable LED#2 and TC0 if there were enabled
if (pLedStates[1]) {
pLedStates[1] = 0;
LED_Clear(1);
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKDIS;
}
// Enable LED#2 and TC0 if there were disabled
else {
pLedStates[1] = 1;
LED_Set(1);
AT91C_BASE_TC0->TC_CCR = AT91C_TC_CLKEN | AT91C_TC_SWTRG;
}
}
}
}