commit f48d56ddeeddf74fd0ca588c3e91c5012b46efad
parent 4f34a9141c30fe196bd6a1d1e3b52b261b1a013c
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Wed, 5 Nov 2025 16:58:59 -0300
updated `README.md`
Diffstat:
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/README.md b/README.md
@@ -1,12 +1,19 @@
# Arduino Bare Metal Task Scheduler
This is a simple program that implements a task scheduler. It executes a series
-of tasks attached to the scheduler after their specified task period (in
-milliseconds) has passed.
+of tasks attached to the scheduler after their specified task period has passed
-In the example, four LEDs are controlled: two blink at different rates, and the
-other two following the states of two buttons (if the button is pressed the led
-is on, and if the button is not pressed the led is off).
+## In this example
+
+Four LEDs are controlled: two blink at different rates, and the other two
+controlled by two buttons. The first button implements a 150 ms button debounce,
+on idle the LED is off, when the button is pressed the LED toggles on and keeps
+on that state for 150 ms, independently of the button state, if the button is
+kept pressed the LED will keep on, if the button is released the LED will turn
+off. The second button is simpler, if the button is pressed the led is on, and
+if the button is not pressed the led is off
+
+## Scheduler usage
The tasks are assigned to the scheduler with the following statements:
@@ -23,16 +30,20 @@ scheduler_init(tasks, sizeof(tasks)/sizeof(tasks[0]));
```
The scheduler invokes the `on_update` field function when the specified period
-for that tasks has passed, the period being in milliseconds. When the period is
-zero, the function updates on every millisecond.
+for that task has passed, the period being in milliseconds. When the period is
+zero, the function updates on every millisecond. The `id` field is optional, in
+the example is used to change the period of the `READ_BTN_A` task, when the
+button is pressed the period is set to 150 ms, and on the next upadate it will
+be set back to 0 if the button has been released, if the button has not been
+released the period stays the same at 150 ms
The `scheduler_tick` must be called on every millisecond, this only signals the
scheduler that a tick has passed, all the tasks execution happens when the
-`scheduler_update` function get called.
+`scheduler_update` function get called
> **NOTE**: tasks are executed sequentially, so if one task takes more than 1 ms
> to execute and another task needs to run at the same time, the first task will
-> delay the other.
+> delay the other
## Dependencies