Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists