Try this (don't forget to clear the alarm before exiting your app):
Err AlarmCallback(UInt16 almProcCmd, SysAlarmTriggeredParamType *paramP)
{
// at this point, app globals are not available, so pass
// what you need as a reference parameter
return 0;
}
void PrvSetCallbackAlarm(UInt32 milliseconds)
{
if (milliseconds)
{
milliseconds = milliseconds / 1000 + 1;
// Not stable if set for less than 2 seconds
if (milliseconds < 2)
milliseconds = 2;
// set alarm
AlmSetProcAlarm(AlarmCallback,0,TimGetSeconds() +
milliseconds);
}
else
{
// clear alarm
AlmSetProcAlarm(0,0,0);
}
}
--------------------
Jeff Loucks
Work 425-284-1128 [EMAIL PROTECTED]
Mobile 253-691-8812 [EMAIL PROTECTED]
Home 253-851-8908 [EMAIL PROTECTED]
-----Original Message-----
From: Marc A. Lepage [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 29, 2004 4:07 PM
To: Palm Developer Forum
Subject: Timer and Callback?
Is there an API for setting a callback to be called at time intervals
(e.g. every second)?
I looked but I could not find one.
Must I manually count ticks and call the callback myself?
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/