Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

pvTimerID vs TimerHandle_t

Posted by sagi2097 on March 14, 2014

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!

Alex


pvTimerID vs TimerHandle_t

Posted by rtel on March 14, 2014

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.

Look at the vTimerCallback() function in the example on the following page to see how this is done: http://www.freertos.org/FreeRTOS-timers-xTimerCreate.html

Regards.


pvTimerID vs TimerHandle_t

Posted by sagi2097 on March 14, 2014

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 TimerHandlet s' and get my own ID from the array Index? In the example there is the following concept: TimerHandlet timers[5]; for(int i=0;i<5;i++) timers[i]=xTimerCreate(..); wouldn't this allow me to recover the actual timer by running the array and comparing the handle?

Thank You

Alex


pvTimerID vs TimerHandle_t

Posted by rtel on March 14, 2014

Yes - that would be equally as valid.

Regards.


pvTimerID vs TimerHandle_t

Posted by richard_damon on March 15, 2014

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner