Closed dhebbeker closed 7 months ago
My current attempt (f61d16bf3f29ddf3fdf1f871570fb94ebd1a93bd) is problematic as using functions from the C++ Standard Library within an ISR can cause problems.
For debouncing I may simply use millis()
. But the question remains on how to do the actual work if I don't want to do this in the context of the ISR nor by starting a std::thread
directly from within an ISR.
See also:
xQueueOverwriteFromISR()
from ISR: https://github.com/sandeepmistry/arduino-LoRa/issues/224#issuecomment-488434092xTaskNotifyFromISR()
ulTaskNotifyTake()
vTaskNotifyGiveFromISR
👀I moved the thread management outside of the ISR into a separate thread which continuously polls for signals set by the ISR. The signals are set by the ISR using std::atomic_flag
which are lock-free.
This works in general. But it means that we have a polling thread which is not a good design (comment 1, comment 2, article (did not read yet)). It may become a problem when we want to use sleep modes for the processor for power saving. 🔋
This is closed in favour of #116 which does not rely on polling.
Introduce a new
Worker
class which is a wrapper around astd::thread
and:join()
Resolves #113.