libhal / libhal-soft

Library for generic soft drivers officially supported by libhal
Apache License 2.0
0 stars 1 forks source link

Add `hal::soft::timer_spliter<N>` #29

Open kammce opened 3 months ago

kammce commented 3 months ago

The idea of timer_spliter is to take a single timer and split it into multiple timers. It would take size_t template parameter which is used to create memory for N number of callbacks for each timer.

The timer spliter would have to manage associating scheduled timeouts with the time given and when an interrupt occurs will track down the associated scheduled callbacks and execute them then set the schedule to the next callback. This is effectively a form of a scheduler or event loop (see js).

kammce commented 3 months ago

The motivation for this feature is when an device runs out of timers and can handle the overhead of using timer_spliter.