vTaskDelayUntil improvement (#77)

* vTaskDelayUntil improvement

* suggestions implemented

* xTaskDelayUntil #define added

* doc small fix

* small formatting stuff

* more small formatting stuff

* Update lexicon.txt

Co-authored-by: Carl Lundin <53273776+lundinc2@users.noreply.github.com>
Co-authored-by: Carl Lundin <lundinc@amazon.com>
This commit is contained in:
Spacefish 2020-10-09 02:46:47 +02:00 committed by GitHub
parent 3d4d17178f
commit 3260e228c3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 16 deletions

View file

@ -781,7 +781,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
/**
* task. h
* <pre>
* void vTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );
* BaseType_t xTaskDelayUntil( TickType_t *pxPreviousWakeTime, const TickType_t xTimeIncrement );
* </pre>
*
* INCLUDE_vTaskDelayUntil must be defined as 1 for this function to be available.
@ -799,7 +799,7 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* each time it executes].
*
* Whereas vTaskDelay () specifies a wake time relative to the time at which the function
* is called, vTaskDelayUntil () specifies the absolute (exact) time at which it wishes to
* is called, xTaskDelayUntil () specifies the absolute (exact) time at which it wishes to
* unblock.
*
* The constant portTICK_PERIOD_MS can be used to calculate real time from the tick
@ -808,13 +808,16 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* @param pxPreviousWakeTime Pointer to a variable that holds the time at which the
* task was last unblocked. The variable must be initialised with the current time
* prior to its first use (see the example below). Following this the variable is
* automatically updated within vTaskDelayUntil ().
* automatically updated within xTaskDelayUntil ().
*
* @param xTimeIncrement The cycle time period. The task will be unblocked at
* time *pxPreviousWakeTime + xTimeIncrement. Calling vTaskDelayUntil with the
* time *pxPreviousWakeTime + xTimeIncrement. Calling xTaskDelayUntil with the
* same xTimeIncrement parameter value will cause the task to execute with
* a fixed interface period.
*
* @return Value which can be used to check whether the task was actually delayed.
* Will be pdTRUE if the task way delayed and pdFALSE otherwise.
*
* Example usage:
* <pre>
* // Perform an action every 10 ticks.
@ -828,17 +831,23 @@ void vTaskDelay( const TickType_t xTicksToDelay ) PRIVILEGED_FUNCTION;
* for( ;; )
* {
* // Wait for the next cycle.
* vTaskDelayUntil( &xLastWakeTime, xFrequency );
* BaseType_t xWasDelayed = xTaskDelayUntil( &xLastWakeTime, xFrequency );
*
* // Perform action here.
* // Perform action here. xWasDelayed value can be used to determine
* // whether a deadline was missed if the code here took too long.
* }
* }
* </pre>
* \defgroup vTaskDelayUntil vTaskDelayUntil
* \defgroup xTaskDelayUntil xTaskDelayUntil
* \ingroup TaskCtrl
*/
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement ) PRIVILEGED_FUNCTION;
#define vTaskDelayUntil( pxPreviousWakeTime, xTimeIncrement ) \
{ \
xTaskDelayUntil ( pxPreviousWakeTime , xTimeIncrement ); \
}
/**
* task. h

View file

@ -2976,6 +2976,7 @@ xtaskcreate
xtaskcreaterestricted
xtaskcreaterestrictedstatic
xtaskcreatestatic
xtaskdelayuntil
xtaskdetails
xtaskendscheduler
xtaskgetapplicationtasktag
@ -3076,6 +3077,7 @@ xvalueofinsertion
xvtorconst
xwaitforallbits
xwantedsize
xwasdelayed
xwritevalue
xxr
xyieldpending

View file

@ -1246,7 +1246,7 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
#if ( INCLUDE_vTaskDelayUntil == 1 )
void vTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
BaseType_t xTaskDelayUntil( TickType_t * const pxPreviousWakeTime,
const TickType_t xTimeIncrement )
{
TickType_t xTimeToWake;
@ -1324,6 +1324,8 @@ static void prvAddNewTaskToReadyList( TCB_t * pxNewTCB )
{
mtCOVERAGE_TEST_MARKER();
}
return xShouldDelay;
}
#endif /* INCLUDE_vTaskDelayUntil */