[OOP] Task await until IRQ is processed, how to pass data IRQ to task #162
-
Hi, After reading the register I have to schedule a Task to do processing with this read data. Right now I'm doing:
What would be the best way to achieve so? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi @hitech95 From the passing a value to the task perspective, you need to use LTS (local thread storage) https://github.com/arkhipenko/TaskScheduler/wiki/API-Task#void-setltspointervoid-aptr Every task has a 4 byte area to either store a int32 value or a pointer to a data structure where the data is.
|
Beta Was this translation helpful? Give feedback.
Hi @hitech95
From the scheduling perspective (meaning, scheduling the task to run ASAP) you are doing everything right - scheduling task to restart during interrupt. Depending where in the execution chain taskIRQ is, it might not be the very next task to be activated. You might want to assign those to a scheduler of a higher priority, then they will be evaluated for invocation more frequently.
Example here: https://github.com/arkhipenko/TaskScheduler/blob/master/examples/Scheduler_example11_Priority/Scheduler_example11_Priority.ino
From the passing a value to the task perspective, you need to use LTS (local thread storage)
Example here: https://github.com/arkhipenko/TaskScheduler/blob/mas…