Actions

EmSys

Difference between revisions of "FreeRTOS Exercise Lab20"

From EdWiki

m
m
Line 6: Line 6:
 
* Display "You Pressed SW1 Button switch" in the Task 2 whenever SW1 is pressed
 
* Display "You Pressed SW1 Button switch" in the Task 2 whenever SW1 is pressed
  
 
+
== Code Snippet ==
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
/* Deferred interrupt processing Task */
 
/* Deferred interrupt processing Task */
Line 12: Line 12:
 
{
 
{
 
     for(;;) {
 
     for(;;) {
         vTaskSuspend(NULL);
+
         vTaskSuspend(NULL);               /* Wait for SW1 interrupt */
 
         printf("%s", "You Pressed SW1 Button switch\n\r");
 
         printf("%s", "You Pressed SW1 Button switch\n\r");
 
     }
 
     }
Line 22: Line 22:
 
     BaseType_t xSW1Yield;
 
     BaseType_t xSW1Yield;
  
     GPIO_PORTF_ICR_R = 0x10;       /* clear PF4 int */
+
     GPIO_PORTF_ICR_R = 0x10;               /* clear PF4 int */
  
 
     xSW1Yield = xTaskResumeFromISR(hPortF); /* hPortF is Handle of vPortF_Handler_Task */
 
     xSW1Yield = xTaskResumeFromISR(hPortF); /* hPortF is Handle of vPortF_Handler_Task */

Revision as of 09:27, 6 August 2019

FreeRTOS Exercise Lab30 - Deferred Interrupt Processing

  • Create Task 1 as a continuous processing task, and Task 2 as the task to which interrupt processing is deferred.
  • Install an Interrupt handler for SW1 Button switch (GPIO PortF)
    There are two user push buttons on the EK-TM4c123GXL LaunchPad Board.
  • Display "You Pressed SW1 Button switch" in the Task 2 whenever SW1 is pressed

Code Snippet

/* Deferred interrupt processing Task */
void vPortF_Handler_Task(void *pvParameters)
{
    for(;;) {
        vTaskSuspend(NULL);                /* Wait for SW1 interrupt */
        printf("%s", "You Pressed SW1 Button switch\n\r");
    }
}
 
/* PortF Interrupt Service Routine */
void vGPIO_PortF_ISR(void)
{
    BaseType_t xSW1Yield;
 
    GPIO_PORTF_ICR_R = 0x10;               /* clear PF4 int */
 
    xSW1Yield = xTaskResumeFromISR(hPortF); /* hPortF is Handle of vPortF_Handler_Task */
    portYIELD_FROM_ISR(xSW1Yield);
 
}


Prev.gif
Home.gif