Timer set
I have a simple timer call back which just decrements a variable:
int timerx;
// the callback function:
void vTimerCb1Sec( TimerHandle_t pxTimer )
{
timerx–;
}
Now I need to set timerx:
void set1SecTimer(uint32_t val )
{
xTimerStop(xTimers1Sec,10);
timerx = val;
xTimerStart(xTimers1Sec,10);
}
Is it safe to do it without stop and start like this?
void set1SecTimer(uint32_t val )
{
timerx = val;
}
Thanks,
Johanan
Timer set
Probably not safe just to set timerx, but it can be done in a critical section no need to stop then start the timer.
taskENTERCRITICAL();
timerx = val;
taskEXITCRITICAL();
Timer set
Thanks Dave.