Projects Structure
Every project has a master_task
that determines cycles and when tasks can run
Each cycle can have a tasks run parallel to each other or one after the other
So run_can_rx_cycle
runs first, and run_gpio_cycle
, run_test_cycle
, and run_help_cycle
can run in parallel.
The wait_tasks
function just waits for all the tasks to finish.
Every task has it’s own starting semaphore, local to the task itself. They should define a run_task_cycle
function to give up that semaphore.
Naturally, the task has to wait on the semaphore each cycle.
However, each task will also post on s_end_task_sem
. All tasks will post on the same semaphore. This will be a counting semaphore.
If a task needs to be run in multiple speeds, then should be called in the fastest cycle speed, and define own counter to call what needs to be done in each speed.
Note: Each semaphore described is a counting semaphore. Especially the task_end
semaphore.
For Testing
Each master task should be wrapped in #ifdefines
This will let the test call run_master_cycle
however many times and wait for it to finish.