Hello, I was wondering if having both TimerHandle_t and pvTimerID , has any special functionality , other than simplifying the way to refer/recognise a Timer. Maybe it is obvious and i am blind, but it seems to me that both are unique identifiers for the same Timer, so one could do all the functionality with just one of them.
Please enlighten my!
I’m not sure of the context in which you are asking your question. TimerHandle_t is the type of variables used to point to timer handles, whereas presumably the pvTimerID you are referring to is the ID that is assigned to the timer.
If so, then the ID is assigned to the timer to allow the same callback function to be used by multiple timers. When you are inside the callback function you can query the timer’s ID to see which time actually expired.
I assume I understand what you tell me… or better that is what I already thought. But then wouldn’t it be equivalent to run through the array of saved TimerHandle_t s’ and get my own ID from the array Index? In the example there is the following concept:
The difference is that YOU get to control the pvTimerID value, so it can point directly to data you want/need the timer to use.
The TimerHandle_t on the other hand is an opaque pointer to the Timer Control block, so to use that to identify the timer requires doing a time wasting search through a list of timers, but is just what FreeRTOS needs to process the timer.