miyuki wrote on Friday, November 22, 2019:
I have a dumb question
What is propper way to start task with few tick delay after ISR is called
Do I just switch content to desired task and call delay from it ? Or is here some more elegant way to set task directly to start after defined amount of time ?
I have an 100Hz external interupt and need to wait some time to toggle output. With 1000Hz system tick granularity is as I need. Just want to know what is best way to implement it without unnesercary mess.
heinbali01 wrote on Friday, November 22, 2019:
There are many ways to go.
One way is like this:
void my_task( void *pvParameters )
for( ;; )
ulTaskNotifyTake( pdFALSE, ulMaxBlockTime );
vTaskDelay( pdMS_TO_TICKS( DELAY_MS ) );
and let the ISR wake up the task:
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
vTaskNotifyGiveFromISR( xTaskhandle, &xHigherPriorityTaskWoken );
portYIELD_FROM_ISR( xHigherPriorityTaskWoken );
richard_damon wrote on Saturday, November 23, 2019:
One option that might work is to use a timer, and have the ISR start the timer, and then when the timer expires its callback function will get called.
miyuki wrote on Monday, November 25, 2019:
Timer look in my opinion like more elegant solution