Can I use timer like this?


#1

Dear all:

I have a question, Can I use adl_tmrSubscribe like below example?

adl_tmr_t *tChkGPRS;
void adl_main ( adl_InitType_e InitType )
{
//some program…
tChkGPRS=(adl_tmr_t *)adl_tmrSubscribe(FALSE,100,ADL_TMR_TYPE_100MS,GPRSlive_TimerHandle);
}

void GPRSlive_TimerHandle(u8 id)
{
//some program…
tChkGPRS=(adl_tmr_t *)adl_tmrSubscribe(FALSE,100,ADL_TMR_TYPE_100MS,GPRSlive_TimerHandle);
}

My means is, subscribe the same timerhandle in the timerhandle(but the timerhandle is not cyclic?)

Sometime I need this function to check GPRS is online or not, but my program have some questions(sometimes timerhandle should be work, but it stop, and don’t wake up again).

I think maybe this structure is wrong~ Can you help me?
Thank you very much! :slight_smile:


#2

Yes, acutally I saw some samples from Wavecom doing the same


#3

I’m not sure if it is acceptable in your application but in many cases it is simpler to use cyclic timer and do a conditional unsubscribe instead of conditional subscribe to non-cyclic timer. This is what I would try I encounted any problem with that code. Still it worthy to know that this code construction should work.


#4

Yepp. BTDT. Haven’t tried with heavy duty timer routines…
Normally the func is already left when it’s called another time by a new timer event. So THIS should be no problem. But I haven’t tried it with true reentrance.

Heinz


#5

hi,

     i heared that we can call only 32 timer subscribes in the program. in your code it is not possible ie without unsubscribe your timer may be called so many  times so it will get hang

with regards,
sssampath@gmail.com


#6

I think the limit is actually 32 simulataneous subscriptions… :question: