This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

timers and arguments

Hi,

I'm trying to pass an object to a timer I have in my code.

I've configured the timer through the BIOS config file (statically)

...

timer0Params.arg = "&arg0";

...

and in the ISR of the timer

...

Void myTimer( UArg myArg)
{
myStruct_t *pMyPointer = (myStruct*)myArg;

...

Where can I set arg0 = the correct object to be passed in?  Should the timer be configured dynamically at run time instead?

thanks

  • Yes, I would suggest constructing the timer at runtime. You can set timer arg to the address of the Timer object structure.

    Untested example:
    
    *.c:
    
    Timer_Handle timer0Handle; Timer_Struct timer0; main() { Timer_Params params; ... Timer_Params_init (&params); params.arg = &timer0; params.period = <period>; ... Timer_construct (&timer0, 0, &myTimerFunc, &params, &eb); ...
    timer0Handle = Timer_handle (&timer0); }

    Best,

    Ashish