此外,蓝牙好几个Demo应用软件中有个power_manage()的应用,小弟看了这是调用库函数
,关于这个函数nordic官网SDK提供的API手册说明如下:
uint32_t sd_app_evt_wait
|
(
|
void
|
|
)
|
|
Waits for an application event.
An application event is either an application interrupt or a pended
interrupt when the interrupt is disabled. When the interrupt is enabled
it will be taken immediately since this function will wait in thread
mode, then the execution will return in the application's main thread.
When an interrupt is disabled and gets pended it will return to the
application's thread main. The application must ensure that the pended
flag is cleared using sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
disabled interrupts, as the interrupt handler will clear the pending
flag automatically for enabled interrupts.
In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR).
See AlsoCMSIS_SCBNoteIf an application interrupt
has happened since the last time sd_app_evt_wait was called this
function will return immediately and not go to sleep. This is to avoid
race conditions that can occur when a flag is updated in the interrupt
handler and processed in the main loop.PostconditionAn application interrupt has happened or a interrupt pending flag is set.Return values
小弟英文水平有限,看了几遍也没看明白这个函数到底有什么作用?如何用? 哪位大哥大姐大神,百忙中能抽点空,帮看看讨论讨论,拜谢哪。
此外,蓝牙好几个Demo应用软件中有个power_manage()的应用,小弟看了这是调用库函数
,关于这个函数nordic官网SDK提供的API手册说明如下:
uint32_t sd_app_evt_wait
|
(
|
void
|
|
)
|
|
Waits for an application event.
An application event is either an application interrupt or a pended
interrupt when the interrupt is disabled. When the interrupt is enabled
it will be taken immediately since this function will wait in thread
mode, then the execution will return in the application's main thread.
When an interrupt is disabled and gets pended it will return to the
application's thread main. The application must ensure that the pended
flag is cleared using sd_nvic_ClearPendingIRQ in order to sleep using this function. This is only necessary for
disabled interrupts, as the interrupt handler will clear the pending
flag automatically for enabled interrupts.
In order to wake up from disabled interrupts, the SEVONPEND flag has to be set in the Cortex-M0 System Control Register (SCR).
See AlsoCMSIS_SCBNoteIf an application interrupt
has happened since the last time sd_app_evt_wait was called this
function will return immediately and not go to sleep. This is to avoid
race conditions that can occur when a flag is updated in the interrupt
handler and processed in the main loop.PostconditionAn application interrupt has happened or a interrupt pending flag is set.Return values
小弟英文水平有限,看了几遍也没看明白这个函数到底有什么作用?如何用? 哪位大哥大姐大神,百忙中能抽点空,帮看看讨论讨论,拜谢哪。
举报