CC1310 Sensor Controller 变更RTC事件时序

 •  Filed under MCU, TI, CC1310

在delay时间后以interval的周期运行Sensor Controller的RTC事件

#include DeviceFamily_constructPath(inc/hw_aon_rtc.h)

uint32_t scifOsalEnterCriticalSection(void);
void scifOsalLeaveCriticalSection(uint32_t key);

//delay应大于8
void SceRTCDelay(uint32_t delay,uint32_t interval){
    uint32_t key, sec, subsec,startTime;
    /* disable hwi to make sure startTime won't become past */
    key = scifOsalEnterCriticalSection();
    /* read current rtc value */
    sec = HWREG(AON_RTC_BASE + AON_RTC_O_SEC);
    subsec = HWREG(AON_RTC_BASE + AON_RTC_O_SUBSEC);
    /* calc next start time */
    startTime = ((sec << 16) | (subsec >> 16)) + delay;
    /* update the RTC cannel config */
    scifStartRtcTicks(startTime, interval);
    scifOsalLeaveCriticalSection(key);
}