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.

Several buttons interrupts

Greetings, i'm trying to find a way to use several buttons as an interrupt, for example:

Use the PA6 and PA7 as diferent interrupts. 

My problem is, in the startup how should i define them? i only have GPIO Port A and not GPIO Port A6 or 7.

Is there a way or i have to define the interruption several times as the example of onebuttonup, onebuttondown?

I'm using Tm4C123GXL

Interruptions maybeare better, but if i can use them as Rising edge GPIOPinInput without interruption its good to.

i already tried like this:

ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
GPIOPinTypeGPIOInput(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7);
GPIOPadConfigSet(GPIO_PORTA_BASE,GPIO_PIN_6 | GPIO_PIN_7, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
GPIOIntTypeSet(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7, GPIO_FALLING_EDGE);

if (!GPIOPinRead(GPIO_PORTA_BASE, GPIO_PIN_6)){
UARTprintf("\nReceived: %d\n ", count);
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 2);

count++;

}

  • Hello Victor,

    The Per Pin Interrupt capability is limited to port P and Q only. So if you plan to use any other port for per pin interrupt vector then it would not be possible.

    You can however use the same interrupt vector for different interrupt conditions by reading the Interrupt Status and then forming logical condition for every pin and clearing it only if the condtion is true. E,g,

    In a port interrupt handler

    ui32IntStatus = GPIOPinIntStatus(GPIO_BASE_ADDR, true)

    if(ui32IntStatus & PIN1 == PIN1)

    {

     do something.

     GPIOPinIntClear(GPIO_BASE_ADDR,PIN1);

    }

    Regards

    Amit