I wish I had a minimal version of something like this for microcontrollers (ARM Cortex M0+ and M4). Implementing event-driven code with interrupts is always a pain, even with neatly structured state machines.
You can use Protothreads[1] for this which work on anything that runs C, as they are just using setjmp/longjmp.
I would recommend FreeRTOS instead, as it has proper prempetive scheduling, context switching and wide debugger support. It's actually only 4 files[2] so not very heavyweight in either memory or stuff to learn, and has decent abstractions for cross thread communication (queues etc). Then you can write continuous code and use preemption, rather than have to code everything as a state machine and co-operatively schedule, which is painful sometimes.