Esp32 Tasks - communication and control

For general Flowcode discussion that does not belong in the other sections.
Post Reply
mnfisher
Valued Contributor
Posts: 1224
http://meble-kuchenne.info.pl
Joined: Wed Dec 09, 2020 9:37 pm
Has thanked: 119 times
Been thanked: 628 times

Flowcode v10 Esp32 Tasks - communication and control

Post by mnfisher »

A work in progress.

The esp32 makes it easy to have multiple tasks performing different functions. For example a task could update an LED display when required.

There are several options to communicate data to a task - for example to change the LED colour.

For example there are queues, semaphores and notifications.

Of these - notifications are simplest. I wrote a simple component - to allow notifications (which are a 32 bit value) to be passed to a task. The task is 'asleep' until it receives a notification - at which point it wakes, performs its task and then sleeps again until another instruction is passed.

Here is a very simple example - the main task creates a 'task' that prints the value of any notifications received to UART (note that it also has a delay which is not strictly necessary here - this is to allow testing of some of the notification types - which can 'fail' if the task is not ready)
Notify.fcpx
(1.69 KiB) Downloaded 512 times
TestNotify.fcfx
(9.35 KiB) Downloaded 503 times
Notify.fcfx
(9.41 KiB) Downloaded 490 times
I haven't included instructions for adding a component here...

Note that in more recent versions of FreeRTOS - the task can have an array of notifications. Tasks can receive notifications from other tasks or from ISRs.

Martin

Post Reply