TI中文支持网
TI专业的中文技术问题搜集分享网站

cc2650 RTC唤醒

进入standby mode后,如何基于ti-RTOS设置为RTC唤醒?请给个参考例子。

regards

Yan:

ttttt ,

可以参考simpleBLEPeripheral工程里面的Util_constructClock()的用法哦。

ttttt hhhh:

回复 Yan:

hi Y,

//要求任务处理完后立刻进入standby mode,隔几秒后RTC唤醒MCU,再处理任务,再进入睡眠模式,如此循环。

//以下为大致处理流程:连接上后任务开始处理用户自定义事件,处理完后让MCU进入睡眠模式,5秒后再唤醒MCU。//1.但睡眠后没能唤醒MCU,这如何解决?//2.听说应用层不能直接调PowerCtrlStateSet()这个函数,该如何处理?#define PERIODIC_WKUP_EVT 0x0010#define PROCESS_SOMTHING_EVT 0x0011

static Clock_Struct periodicWakupClock;

void periodicWakupClockHandler(UArg arg ){ events |= arg; Semaphore_post(sem);}

static void SimpleBLEPeripheral_taskFxn(UArg a0, UArg a1){ SimpleBLEPeripheral_init(); Util_constructClock(&periodicWakupClock, periodicWakupClockHandler, 5000, 0, false, PERIODIC_WKUP_EVT); for (;;) { // Waits for a signal to the semaphore associated with the calling thread. // Note that the semaphore associated with a thread is signaled when a // message is queued to the message receive queue of the thread or when // ICall_signal() function is called onto the semaphore. ICall_Errno errno = ICall_wait(ICALL_TIMEOUT_FOREVER); … if (events & PERIODIC_WKUP_EVT) { events &= ~PERIODIC_WKUP_EVT; } if(events & PROCESS_SOMTHING_EVT) { events &= ~PROCESS_SOMTHING_EVT; //start do something. //……. //……. //……. //handle done. //睡眠前,开启时钟,以便5s后唤醒MCU。 Util_startClock(&periodicWakupClock); PowerCtrlStateSet(PWRCTRL_STANDBY); } … } }

连接上后,唤醒任务开始处理事件,以便处理完后进入standby mode,在SimpleBLEPeripheral_processStateChangeEvt()中添加case GAPROLE_CONNECTED:…

events |= PROCESS_SOMTHING_EVT;Semaphore_post(sem);

…break;

赞(0)
未经允许不得转载:TI中文支持网 » cc2650 RTC唤醒
分享到: 更多 (0)