Hi to all of you!
I' m quite new to the world of "programming" and I' m trying to understand this piece of code written for the TM4C123GH6PM in the EK-TM4C123GXL Launchpad.
It' s the interrupt handler for the GPIO PORTF.
Though there are also some comments in the code below, I can't understand it completely.
The buttons used in the launchpad are: SW1 (connected to PF4) and SW2 (connected to PF0).
Here' s the code:
#define KEY_ENABLED_BUTTONS ( GPIO_INT_PIN_0 | GPIO_INT_PIN_4 )
static volatile uint32_t active_buttons;
static uint32_t fall_debounce;
void isr_keyboard (void)
{
uint32_t int_status = HWREG(GPIO_PORTF_BASE + GPIO_O_RIS);
uint32_t key_status = ~int_status | ~KEY_ENABLED_BUTTONS;
/* compute just-pressed button mask */
uint32_t pressed_buttons = ~(key_status | active_buttons);
/* record button state */
active_buttons |= pressed_buttons;
fall_debounce |= pressed_buttons;
/* Numb the port to debounce the key */
HWREG(GPIO_PORTF_BASE + GPIO_O_IM) &= ~pressed_buttons;
/* acknowledge interrupt */
HWREG(GPIO_PORTF_BASE + GPIO_O_ICR) = int_status;
}
Could you help me to it, explaining me what ever line does? Thank you.