5543b2a9cc
This is useful in situations where the ThreadSafeFlag is reused and needs to be cleared of any previous, unwanted event. For example, clear the flag at the start of an operation, trigger the operation (eg an I2C write), then (a)wait for an external event to set the flag (eg a pin IRQ). Further events may trigger the flag again but these are unwanted and should be cleared before the next cycle starts.
33 lines
270 B
Plaintext
33 lines
270 B
Plaintext
yield
|
|
task 1
|
|
set event
|
|
yield
|
|
wait task
|
|
task 1 done
|
|
----
|
|
yield
|
|
task 2
|
|
set event
|
|
yield
|
|
schedule
|
|
schedule done
|
|
wait task
|
|
task 2 done
|
|
----
|
|
set event
|
|
yield
|
|
task 3
|
|
task 3 done
|
|
wait task
|
|
----
|
|
set event
|
|
yield
|
|
clear event
|
|
yield
|
|
yield
|
|
task 4
|
|
set event
|
|
yield
|
|
wait task
|
|
task 4 done
|