richard_damon wrote on Friday, May 16, 2014:
The tasks can do the every so often themselves by using vTaskDelay/vTaskDelayUntil to wait for their next activation time (you will need something that gives you absolute time for #2, and likely 32 bit ticks if you don’t want task 2 to need to wait up momentarily to see that it needs to go back to sleep for a while, unless your tick rate is slower the once a second (at 1 Hz, the max delay with 16 bit ticks is about 18 hours, and the tick rate is likely higher).
Having task 1 suspend after 2 minutes is a strange requirement. With a RTOS, normally a task will do the stuff it needs to do, and then wait until it needs to do it again. For it to abruptly stop (and presumably resume where it stopped 8 minutes later) is a very unusual type of situation. If task 1 is doing lots of small steps, then perhaps it could check an elapsed time after each on to decide if it should do the next or sit and wait. (Again this doesn’t sound very RTOSish, maybe if you start the REAL problem, and not how to implement your solution, we might be able to give better help.)