1.2.11.4.7 SYS_TIME_DelayMS Function
1.2.11.4.7 C
SYS_TIME_RESULT SYS_TIME_DelayMS ( uint32_t ms, SYS_TIME_HANDLE* handle )
1.2.11.4.7 Summary
This function is used to generate a delay of a given number of milliseconds.
1.2.11.4.7 Description
The function will internally create a single shot timer which will be auto deleted when the application calls SYS_TIME_DelayIsComplete routine and the delay has expired. The function will return immediately, requiring the caller to use SYS_TIME_DelayIsComplete routine to check the delay timer's status.
1.2.11.4.7 Precondition
The SYS_TIME_Initialize function must have been called before calling this function.
1.2.11.4.7 Parameters
| Parameters | Description |
|---|---|
| ms | The desired number of milliseconds to delay |
| handle | Address of the variable to receive the timer handle value |
1.2.11.4.7 Returns
SYS_TIME_SUCCESS - If the call succeeded.
SYS_TIME_ERROR - If the call failed.
1.2.11.4.7 Example
SYS_TIME_HANDLE timer = SYS_TIME_HANDLE_INVALID;
if (SYS_TIME_DelayMS(100, &timer) != SYS_TIME_SUCCESS)
{
// Handle error
}
else if(SYS_TIME_DelayIsComplete(timer) != true)
{
// Wait till the delay has not expired
while (SYS_TIME_DelayIsComplete(timer) == false);
}
1.2.11.4.7 Remarks
Will delay the requested number of milliseconds or longer depending on system performance. In Tick-based mode, the requested delay will be ceiled to the next timer tick. For example, if the timer tick is set to 700 µs and the requested delay is 2 ms, a delay of 2.1 ms will be generated.
Delay values of 0 will return SYS_TIME_ERROR.
Will return SYS_TIME_ERROR if the timer handle pointer is NULL.
