Part Number: LAUNCHXL-CC26X2R1
Hi TI team,
I used below code to init my timer and I also change timer to one day via the function of Timer_setTimeout. I want my function just to be triggered once everyday.
But I have no idea why it cannot work. It means my function was triggered less 10 minutes. My function should be triggered at one day.
By the way, I tried to change to 5 minutes and it could work and my function could be triggered at 5 minutes.
And I think the value of timer should be set over one day(86400000) via Timer_setTimeout because its type is uint_32
Could you help me to check it?
Thanks
#define ALARM_BATTERY_PERIOD 86400000
static Clock_Handle batterytimeClkHandle;
static Clock_Struct batterytimeClkStruct;
static void zclSampleSw_processbatterytimeTimeoutCallback(UArg a0);
static void zclSampleSw_initializeClocks(void)
{
batterytimeClkHandle = Timer_construct(
&batterytimeClkStruct,
zclSampleSw_processbatterytimeTimeoutCallback,
10000,
0, false, 0);
}
static void zclSampleSw_processbatterytimeTimeoutCallback(UArg a0)
{
(void)a0; // Parameter is not used
events |= SAMPLEAPP_BATTERY_EVT;
// Wake up the application thread when it waits for clock event
Semaphore_post(sem);
}
static void zclSampleSw_process_loop(void)
{
...
if(events & SAMPLEAPP_BATTERY_EVT)
{
zclSampleSw_battery_check();
events &= ~SAMPLEAPP_BATTERY_EVT;
if(Timer_isActive(&batterytimeClkStruct) != true)
{
Timer_setTimeout( batterytimeClkHandle, ALARM_BATTERY_PERIOD); //each 24 hours to check battery
Timer_start(&batterytimeClkStruct);
}
}
}
static void zclSampleSw_battery_check()
{
....
printf("battery\n");
fflush(stdout);
......
}