Skip to main content
VCasa.3
Associate II
February 8, 2023
Solved

Calling osDelay from a function called inside a Task

Hello,

I have a doubdt and I haven't found the solution on the internet (probably I haven't asked properly or I have been missunderstood)

The thing is that I have a peripheral driver,with a function to write and read to and from SPI, and between them, I have a delay.

If I have a Task, and from this task I call that function, with the delay being osDelay(), will it work, as the normal behabiour of calling osDelay from the task itself (allowing other tasks to run during the delay).

Thank you so much!

This topic has been closed for replies.
KnarfB
KnarfBBest answer
Super User
February 8, 2023

osDelay() is the correct funtion for OS-aware delay.

https://www.keil.com/pack/doc/CMSIS/RTOS2/html/group__CMSIS__RTOS__Wait.html

Doesn't matter if its called directly in the task loop or indirectly from a function in a task loop.

hth

KnarfB

2 replies

KnarfB
KnarfBBest answer
Super User
February 8, 2023

osDelay() is the correct funtion for OS-aware delay.

https://www.keil.com/pack/doc/CMSIS/RTOS2/html/group__CMSIS__RTOS__Wait.html

Doesn't matter if its called directly in the task loop or indirectly from a function in a task loop.

hth

KnarfB

VCasa.3
VCasa.3Author
Associate II
February 8, 2023

Perfect, thank you!