This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Buttons Interrupts

Hi!
I'm trying to trigger interrupts from the buttons of my Stellaris LM4F120 board!
I've already tryied to activate the interrupts from PF0 and PF4 pins (the buttons pins) but it didn't work

 

void ButtonIntHandler(){
                 GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, 0x02);
}

void main(){

            ROM_SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_XTAL_16MHZ |                                                                                               SYSCTL_OSC_MAIN);

            SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
            GPIOPinTypeGPIOInput (GPIO_PORTF_BASE, GPIO_PIN_0);
            GPIOPinIntEnable(GPIO_PORTF_BASE,GPIO_PIN_0);
            ButtonsInit();

            //activate leds
            GPIOPinTypeGPIOOutput (GPIO_PORTF_BASE, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
}


In the startup_ccs.c file:

extern void ButtonIntHandler(void);

ButtonIntHandler,             // GPIO Port F

what am I doing wrong?

is it possible to trigger a interrupt directly from the buttons??

THX!

  • Hi,

         The ButtonsInit() works with ButtonsPoll(). Both, has a common flag to be updated "g_ucButtonStates". You, can check the details at buttons.c. You, can also check how buttons C API's are used at qs-rgb example program,

         Maybe, you should consider a different approach to what you want to do. Do a search in the forum regarding this. I believe there are some posts with this topic.

    -kel