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.

TM4C1231H6PM: How to detect who trigger a interrupt in Tiva 123 ?

Part Number: TM4C1231H6PM
Other Parts Discussed in Thread: TM4C123GH6PM

I have a GPIOF_Handler function. Inside this function, i need to know if a sw1(PF4)  is pressed or if a sw2(PF0) is pressed, and then, execute a code properly. How i do this without using libraries? Using only 

"TM4C123GH6PM.h", <stdint.h> and <stdbool.h>?

Thank's

  • Why are you not using the libraries provided? Notice that in the "TM4C Forum General Guidelines" posted at the top of this forum, we discourage the use of direct register writes and encourage the use of the TivaWare library functions. The use of proven library functions reduces the chance of coding errors and reduces the support burden.

    That said, if your college professor requires that you avoid library calls, then use the library function as your example code. The function that returns the GPIO interrupt status is "GPIOIntStatus()". It can be found in the file:
    C:\ti\TivaWare_C_Series-2.1.4.178\driverlib\gpio.c
  • Thanks for your response, but that does not solve my problem. I need a simple example such as if (sw1 == pressed) {
    code here
    }
    else if (sw2 == pressed) {
    code here
    }
    Using only the libraries I mentioned initially.
    This code would be inside the function
    void GPIOF_Handler (void) {

    }
    Similar to
    void GPIOF_Handler (void) {
    if (sw1 == pressed) {
    // turn off the LED
    }
    else if (sw2 == pressed) {
    // turn on the LED
    }
    }
    Thank you.
  • Here is a CCS project that is similar to what you want. It does use TivaWare function calls.

    /cfs-file/__key/communityserver-discussions-components-files/908/EK_2D00_GPIO_5F00_Interrupts.zip