vTaskDelayUntil improvement

This commit is contained in:
Robin.Mueller 2020-06-23 13:45:00 +02:00
parent 359b10a4ea
commit aebba2bcd3
2 changed files with 10 additions and 2 deletions

View file

@ -799,6 +799,9 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* same xTimeIncrement parameter value will cause the task to execute with * same xTimeIncrement parameter value will cause the task to execute with
* a fixed interface period. * a fixed interface period.
* *
* @param xWasDelayed Can be used to check whether the task was actually delayed.
* Will be set to pdTRUE if the task way delayed and to pdFALSE otherwise.
*
* Example usage: * Example usage:
<pre> <pre>
// Perform an action every 10 ticks. // Perform an action every 10 ticks.
@ -821,7 +824,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* \defgroup vTaskDelayUntil vTaskDelayUntil * \defgroup vTaskDelayUntil vTaskDelayUntil
* \ingroup TaskCtrl * \ingroup TaskCtrl
*/ */
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION; void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement, BaseType_t * xWasDelayed ) PRIVILEGED_FUNCTION;
/** /**
* task. h * task. h

View file

@ -1251,7 +1251,7 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
#if ( INCLUDE_vTaskDelayUntil == 1 ) #if ( INCLUDE_vTaskDelayUntil == 1 )
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement ) void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime, const TickType_t xTimeIncrement, BaseType_t * xWasDelayed )
{ {
TickType_t xTimeToWake; TickType_t xTimeToWake;
BaseType_t xAlreadyYielded, xShouldDelay = pdFALSE; BaseType_t xAlreadyYielded, xShouldDelay = pdFALSE;
@ -1328,6 +1328,11 @@ static void prvAddNewTaskToReadyList( TCB_t *pxNewTCB )
{ {
mtCOVERAGE_TEST_MARKER(); mtCOVERAGE_TEST_MARKER();
} }
if(xWasDelayed != NULL)
{
*xWasDelayed = xShouldDelay;
}
} }
#endif /* INCLUDE_vTaskDelayUntil */ #endif /* INCLUDE_vTaskDelayUntil */