雷竞技电竞平台Dialog Semiconductor客户支持-按键唤醒 https://support.dialog-semiconductor.com/resource-keywords/%E6%8C%89%E9%94%AE%E5%94%A4%E9%86%92 按键唤醒 https://support.dialog-semiconductor.com/%E6%8C%89%E9%94%AE%E5%94%A4%E9%86%92 < div class = "字段field-name-taxonomy-forums field-type-taxonomy-term-reference field-label-above”> < div class = "字段标签" >论坛:,< / div > < div class = "字段条目" > < div class =”field-item甚至“rel = " sioc: has_container " > < a href = " /论坛/ dialog-smartbond-bluetooth-low-energy - % E2 % 80% 93 -软件-对话框- 9 csmartbond % E2 % % E2 % 80% 80% 9 d % E7%B3%BB % E5 % 88% 97% e4%bd % 8 8 e % E5 % % E8 % 9 f % E8 % 80% 97% 93% 9 E2 % d % E7 % 89% 99% 80% 94% e8%bd % AF % E4%BB % B6”“=“sioc:容器sioc:论坛”属性=“rdfs: label skos: prefLabel”数据类型= " " >对话框Smartbond蓝牙低能量-软件/ /对话框“Smartbond”系列低功耗蓝牙——软件< / > < / div > < / div > < / div > < div class =”字段field-name-body field-type-text-with-summary field-label-hidden”> < div class = "字段条目" > < div class =”field-item甚至“财产=“内容:编码”> < p >我用DA14580做一个项目,需要实现这样的功能:< br / > 1,如果DA14580在睡眠状态,按键长按2 s,蓝牙广播;如果DA14580在广播状态,按一键长按2 s,系统睡眠。

int app_wakeup_handler(ke_msg_id_t const msgid,
void *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{

if(power_on_flag==1)
{
power_on_flag= 0;
app_timer_set(APP_LED_TIMER, TASK_APP, 10);
}
power_on_flag= 1;
app_timer_set(APP_LED_TIMER, TASK_APP, 1)
app_timer_set(APP_LED_TIMER, TASK_APP, 1)
app_timer_set(APP_LED_TIMER, TASK_APP,10); < / p > < p > app_adv_start (); < / p > < p >} < br / >} < / p > < p >空白app_button_enable (void) < br / > {< br / > wkupct_register_callback (app_button_press_process);

if(GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN))
{
wkupct_enable_irq(0x200, 0x200, 1,40);/ / P1_1,极性低,1事件,消除抖动时间= 40 ms < br / >} < / p > < p >} < / p > < p >空白app_button_press_process (void) < br / > {< br / >如果(GetBits16 (SYS_STAT_REG PER_IS_DOWN)) < br / > {< br / > periph_init (); < br / >} < / p > < p >如果(app_ble_ext_wakeup_get ()) < br / > {< / p > < p > / /唤醒BLE这里< / p > < p > #如果(EXT_SLEEP_ENABLED) < br / > app_set_extended_sleep (); < br / > # elif (DEEP_SLEEP_ENABLED) < br / > app_set_deep_sleep();其他< br / > # < br / > app_disable_sleep (); < br / > # endif < / p > < p > SetBits32 (GP_CONTROL_REG,BLE_WAKEUP_REQ 1); < br / > app_ble_ext_wakeup_off (); < / p > < p >} < / p > < p > app_button_enable (); < br / > SysTick_Config (160000 - 1), < br / >} < / p > < p >空白SysTick_Handler (void) < br / > {< / p > < p >如果(GPIO_GetPinStatus (GPIO_BUTTON_PORT GPIO_BUTTON_PIN) = = 0) < br / > {< / p > < p > key_press_time_count + +; < br / >} < br / >其他< br / > {< / p > < p > key_press_time_count = 0; < br / > app_button_enable (); < br / > SysTick→CTRL, = ~ (SysTick_CTRL_TICKINT_Msk);< / p > < p >} < / p > < p >如果(power_on_flag = = 1) < br / > {< / p > < p >如果(key_press_time_count = = 300) / / 3 s < br / > {< br / > key_press_time_count = 0; < br / > SysTick→CTRL, = ~ (SysTick_CTRL_TICKINT_Msk); < br / > ke_msg_send_basic (APP_WAKEUP_MSG TASK_APP 0); < / p > < p >} < br / >} < br / >其他< br / > {< br / >如果(key_press_time_count = = 200) / / 2 s < br / > {< br / > key_press_time_count = 0; < br / > SysTick→CTRL, = ~ (SysTick_CTRL_TICKINT_Msk); < br / > ke_msg_send_basic (APP_WAKEUP_MSG TASK_APP,0), < br / >} < br / >} < / p > < p >} < / p > < p >我现在遇到的问题是:在睡眠状态下,我如果按按键的时间小于2 s(本次可以进入app_button_press_process),那么我再次按按键程序没有进入app_button_press_process函数。
如果每次按按键时间都大于2s,整个系统工作正常。< / p > < p >小于2 s程序会执行SysTick_Handler中的这段< br / > {< / p > < p > key_press_time_count = 0; < br / > app_button_enable (); < br / > SysTick→CTRL, = ~ (SysTick_CTRL_TICKINT_Msk);< / p > < p >} < / p > < p >我如果这段程序中的“SysTick→CTRL, = ~ (SysTick_CTRL_TICKINT_Msk); ”屏蔽掉,系统也可以正常工作。

要实现我上门提到的功能有什么需要注意的地方吗? 用什么方法可以实现啊?

Keywords: 
Device: 
2016年2月24日星期三16:24:47 +0000 awesley 2737, https://support.dialog-semiconductor.com https://support.dialog-semiconductor.com/%E6%8C%89%E9%94%AE%E5%94%A4%E9%86%92#comments