TaskManagerIO - Summary
TaskManagerIO provides scheduling, events and interrupt marshalling, all while remaining thread safe across a wide range of boards. By thread safe we mean that you can add tasks to task manager from another thread while it’s still running. However, the task manager itself will always run on one thread, making it easy for you to write code.
This library contains the original scheduling support class TaskManager that was previously built into IoAbstraction.
Known working devices and IDEs:
- Most AVR Arduino boards such as Uno, MEGA 2560 and Mighty core
- Most SAMD Arduino boards such as MKR, Nano IoT and Zero
- nrf52840 Arduino Nano 33 BLE devices
- ESP8266 devices such as NodeMCU / Huzzah
- ESP32 devices, both single and multi-core
- Devices running mbed RTOS V6 - fully tesed on STM32F439.
Getting started and scheduling things to be done
Task manager can schedule tasks to be done either now, or at some point in the future. Available in all versions of task manager.
- Task Manager scheduling guide
- Tutorial - programming an Arduino using tasks
- Timed blink example (packaged with IoAbstraction)
- Read the reference documentation
- Go to the code repo on github
Marshalling interrupts to task manager tasks
Task Manager can add an interrupt on your behalf that is marshalled into a task execution. Available in all versions of task manager.
Polling, Interrupt based and multi-threaded events
TaskManagerIO has a complete eventing framework built into it, on top of this many types of event based programs can be built.
Adding tasks from other threads
If you are using an RTOS such as FreeRTOS on ESP32 or mbed RTOS 6 you can safely add tasks and trigger events from other threads. However, you should never run the run loop from more than one thread at a time. You can however, start another task-manager on another thread.
Remember that one of TaskManagerIO’s main advantages is that your embedded apps don’t need to be concerned with the possibility of access across more than one thread, or raw interrupt handlers. Removing these from the mix allows code to be cleaner.
There’s an example of how to add tasks from another thread in the mbed example; which is packaged with the TaskManagerIO library.