184***724
当设备进入sleep mode 被唤醒,唤醒是怎么通知到应用层的?
Darren
在睡眠模式下,芯片支持以下模块的唤醒触发:
• Bluetooth LE controller
• LPCOMP module
• RTC counter
• Sleep timer
• AON GPIO peripheral
•
A reset
在sleep mode模式下配置相应的唤醒源,当芯片检测到相应条件被触发时,会以中断的方式通知到用户层,可参考如下示例:
该示例是系统每100ms周期性的唤醒系统
void app_rtc_evt_handler(app_rtc_evt_t * p_evt)
{
if (p_evt->type == APP_RTC_EVT_TICK_ALARM)
{
printf("RTC Wakeup");
}
}
void app_rtc_wakeup(void)
{
pwr_mgmt_mode_set(PMR_MGMT_SLEEP_MODE);
app_rtc_init(app_rtc_evt_handler);
app_rtc_setup_tick(100);
}
int main(void)
{
......../*其他代码实现。例如UART初始化灯操作*/
app_rtc_wakeup();
while(1)
{
pwr_mgmt_schedule();
}
}
打开微信,使用“扫一扫”即可关注