Surely the example shown on the web page would be easier and simpler to write in plain C? By using the loop tick style approach that games use? That’s what I have always done when working on no-OS-to-the-metal code. For low-power usage I pause the loop (if there is hardware/OS support for it) or use an interrupt to trigger a single loop step. And prioritising tasks can be done by only running certain steps every 2/3/4/N ticks. It’s simple. It works.