Where is the RtosTimer in mbedOS 6.3?

I am reviewing the basics with Mbed Studio (1.3.1 with mbedOS-6.4). In particular, I am reviewing the multitasking libraries, and I am running into issues with RTOS timer.

I am following an Mbed Textbook from before Mbed Studio, so maybe this class has been moved from the rtos.h file.

In any case, it would be helpful to know how the real time timers work in acquiring things like ADC readings.
Thank you

Hi Daniel,

I recommend looking at https://os.mbed.com/docs/mbed-os/v6.6/apis/index.html. At the bottom of that page, you can find a list of deprecated APIs.

RtosTimer was replaced in Mbed OS 6+ with EventQueue.

Arek - Mbed Studio team

What is the reason of the deprecation of this feature? RTOS timers are very useful when porting libraries which require timing functions. Creating fancy EventQueues and Events for these functions are usually overkill and a simple RTOS timer would be much more handy. In fact I ended up including cmsis_os.h and used osTimerNew etc. for a recent port, which worked flawlessly. I wish it was possible to do it using the Mbed APIs.

PS: Could we move this to the main Mbed OS category?


Sure. I’ve moved it into Mbed OS.

A simple example of using CMSIS OS timer in Mbed is below. Maybe it can help you Daniel to acquire ADC readings:

#include "mbed.h"

DigitalOut led1(LED1);

void togleLed1(void const *param)
    led1 = !led1;

int main()
    osTimerDef(timer0_handle, togleLed1);

    // The third parameter is a pointer to a variable to be passed to the callback (`togleLed` in this example)
    // which is not utilized in this example.
    osTimerId timer0 = osTimerCreate(osTimer(timer0_handle), osTimerPeriodic, (void *)0);

    osTimerStart(timer0, 500);


Thanks. I hope someone from the maintainers can explain this design decision.