Eighty percent of embedded system projects can be implemented using a main loop with function calls, and an interrupt routine or two. The remaining twenty percent, for various reasons, are better developed with other run-time patterns.
Control programs for devices used in open heart surgery, for example, sometimes reset themselves before each pass through the main control logic. This prevents effects of hidden bugs from accumulating and causing a malfunction.
State machines allow functions called from the main loop to handle greater complexity, and longer duration processes, than functions without state machines.
Event handlers support processes which occur at random times or repeat at different rates.
Message pumps send messages between computers, or pass encoded data, from user interface devices to view managers.
Fiber managers allow multi-processing capabilities without resorting to multi-tasking, or the tools listed above.
This books presents, with source code examples, eight different run time patterns. The example code is part of a demo program which runs on an STM32F746G DISCO board , and supports touchscreen interaction with moving color blobs on an LCD.
All source code is MIT Licensed, and has been tested on the STM32F7_DISCO board. Since that board supports the MBED interface, the program binary can be easily loaded into the board over it's USB port.