/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
// ==== Generic Wait Functions ====
/**
\addtogroup CMSIS_RTOS_Wait Generic Wait Functions
\ingroup CMSIS_RTOS
\brief Wait for a certain period of time.
\details
The generic wait functions provide means for a time delay.
\note Generic wait functions cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
@{
*/
/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
/**
\fn osStatus_t osDelay (uint32_t ticks)
\details
The function \b osDelay waits for a time period specified in kernel \a ticks. For a value of \token{1}, the system waits
until the next timer tick occurs. That means that the actual time delay may be up to one timer tick less.
Possible \ref osStatus_t return values:
- \em osOK: the time delay is executed.
- \em osErrorISR: \ref osDelay cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
\note This function \b cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
Code Example
\code
#include "cmsis_os2.h"
void Thread_1 (void *arg) { // Thread function
osStatus_t status; // capture the return status
uint32_t delayTime; // delay time in milliseconds
delayTime = 1000; // delay 1 second
status = osDelay (delayTime); // suspend thread execution
}
\endcode
*/
/*=======0=========1=========2=========3=========4=========5=========6=========7=========8=========9=========0=========1====*/
/**
\fn osStatus_t osDelayUntil (uint64_t ticks)
\details
The function \b osDelayUntil waits until an absolute time (specified in kernel \a ticks) is reached.
Possible \ref osStatus_t return values:
- \em osOK: the time delay is executed.
- \em osParameter: the time is either in the past or cannot be handled (out of bounds).
- \em osErrorISR: \ref osDelayUntil cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
\note This function \b cannot be called from \ref CMSIS_RTOS_ISR_Calls "Interrupt Service Routines".
Code Example
\code
#include "cmsis_os2.h"
void Thread_1 (void *arg) { // Thread function
uint64_t tick;
tick = osKernelGetTickCount(); // retrieve the number of system ticks
for (;;) {
tick += 1000; // delay 1000 ticks periodically
osDelayUntil(tick);
// ...
}
}
\endcode
*/
/// @}