/* TODO: Add any necessary local functions. */ void APP_TimerAlarmSetup ( void ) { uint32_t tmrFreq, countsPerAlarmPeriod, timerPeriod; uint16_t countMax; tmrFreq = DRV_TMR_CounterFrequencyGet(appData.tmrDrvHandle); // timer increment rate // number of timer counts needed for 1 alarm period // alarm period = timer increment rate * # of seconds per alarm period countsPerAlarmPeriod = tmrFreq * APP_ALARM_PERIOD / 1000; // number of timer interrupts needed per alarm period (16-bit timer) countMax = (countsPerAlarmPeriod/65536) + 1; // +1 to round up timerPeriod = countsPerAlarmPeriod / countMax; // timer period value appData.tmrPeriod = timerPeriod; appData.alarmCountMax = countMax; }