hillridge wrote on Tuesday, May 21, 2019:
Is there a recommended way to add the “until” functionality to other calls that use a wait time as a parameter?
For example, if I want a task to have a 1 second period, I can use this at the end of the infinite loop, assuming I set up xLAstWakeTime and the loop takes less than a second to execute:
vTaskDelayUntil(&xLastWakeTime, pdMS_TO_TICKS( 1000 ));
Instead, I would like to create a task with a one second period that will wake early if a notification is sent. Basically use a non-existant call to:
ulTaskNotifyTakeUntil(pdTRUE, pdMS_TO_TICKS( 1000 ));
I could technically do this by getting the tick count at the top of the loop as well as the bottom of the loop, subtract the difference from 1000ms worth of ticks, and use that as the delay parameter for ulTaskNotifyTake(), but then I need to account for overflows in the tick counter and the whole thing gets messy very quickly.
Should I be using a different method alltogether?