Get the current period of a timer

cemer wrote on Monday, March 28, 2016:


Is there a way to read the current period of a timer? I am planning to change the period of some timers depending on the situation. However, it would also be good to see what is the current period before changing it.


rtel wrote on Tuesday, March 29, 2016:

There isn’t currently an API function to do this, although there is a feature request outstanding on it, so I have just added the following to timer.c, but not yet tested (or even compiled) it:

TickType_t xTimerGetPeriod( TimerHandle_t xTimer )
Timer_t *pxTimer = ( Timer_t * ) xTimer;

	configASSERT( xTimer );
	return pxTimer->xTimerPeriodInTicks;