| CMSIS-RTOS RTX Version 4.75 CMSIS-RTOS RTX: Real-Time Operating System for Cortex-M processor-based devices

- RTX

- Main Page
- Usage and Description
- Reference

Macros | Functions
Generic Wait Functions
CMSIS-RTOS API

Wait for a time period or unspecified events. More...

## Macros
#define | osFeature_Wait 0
| osWait function: 1=available, 0=not available

## Functions
osStatus | osDelay (uint32_t millisec)
| Wait for Timeout (Time Delay).

## Description

The Generic Wait function group provides means for a time delay and allow to wait for unspecified events.

## Macro Definition Documentation

#define osFeature_Wait 0

A CMSIS-RTOS implementation may support the generic wait function osWait.

- When osFeature_Wait is 1 a generic wait function osWait is available.
- When osFeature_Wait is 0 no generic wait function osWait is available.

## Function Documentation

osStatus osDelay | ( | uint32_t | millisec | ) |

Parameters

  [in] | millisec | time delay value

Returns
  status code that indicates the execution status of the function.

Wait for a specified time period in millisec.

Status and Error Codes

- osEventTimeout: the time delay is executed.
- osErrorISR: osDelay cannot be called from interrupt service routines.

Example

#include "cmsis_os.h"
void Thread_1 (void const *arg) { // Thread function
osStatus status; // capture the return status
uint32_t delayTime; // delay time in milliseconds
delayTime = 1000; // delay 1 second
:
status = osDelay (delayTime); // suspend thread execution
// handle error code
:
}