I am planning to develop cooperative multitasking in c language. I'm looking for suggestions on how to write a generic code for cooperative multitasking using a state machine.
There are many ways to develop it but suggest me any good option.
What is the feedback of embedded programmers on the choices I made?
- The code must be reusable. It must run on typical low-end embedded system with an 8-bit CPU clocked at 25 MHz, a few KB of RAM, and perhaps 32 KB of flash memory.
- System tick should be user defined. Default it should be 1ms
- Maximum 8 number of tasks can be created.
There are many ways to develop it but suggest me any good option.
- I would generate system tick using timer interrupt
- I would keeps track of time by counting ticks
- I would use switch case statement for task state.
- I would use a function to create the task.
- i would use list as an array of task
What is the feedback of embedded programmers on the choices I made?