3 years, 1 month ago.

Ticker with Different Priority

How can I use multiple tickers with different priorities?

For example, I would like the Ticker1 has higher priority than Ticker2 in the program.

For the L031K6 board, the TIM21 for the ticker event (for class Ticker and Timer). As a result, Ticker1...TickerN have the same priority.

I am wondering that is it possible to have a Ticker using other general purpose timer, say the LPTIM1, TIM2 or TIM22 on the MCU?

As far as I know, the TIM2 and TIM22 are used for the PWM purpose. Since I am not using any PWM pins, can I use these two timer to create a ticker?

Thank you very much in advance.

1 Answer

3 years, 1 month ago.

A ticker triggers an interrupt, which runs in the highest priority. So even if you'd use another timer peripheral I don't think this would matter.

Do you need hardware interrupt? You could create multiple mbed-events event queues (at different priorities) and schedule events there.