Select Page

Interrupt

Interrupt Assignment

  1. Create Task 1 as a continuous processing task.
    In Task 1, display “Task 1 is Running.”
  2. Install an Interrupt handler for SW1 Button switch (GPIO PortF)
    There are two user push buttons on the EK-TM4c123GXL LaunchPad Board.
  3. Toggle Green LED whenever SW1 Key pressed

Code Snippet

/* Task 1 is continuous processing Task */
void Task1(uint32_t entry_param)
{
    while(1) {
        printf("%s", "Task1 is Running ...\n\r");
        for(volatile auto uint32_t ul = 0; ul < 0xffff; ul++ ){ ; }
    }
}
 
/* PortF Interrupt Service Routine */
void gpiof_isr(void)
{
    GPIO_PORTF_ICR_R = 0x10;     /* clear PF4 int */
 
    /* Must be called at the start of interrupt handler that may call an
       OS primitive and make a thread ready.  */                         
    atomIntEnter();   
 
    /* Process GPIO Port F Interrupt */
 
    /* Must be called at the end of interrupt handler that may call an
        OS primitive and make a thread ready. */
    atomIntExit(0);    
}

References

  1. Introduction to atomthreads
  2. atomthreads kernel Reference
  3. atomthreads Documentation