in detail:
在SDK 3.0.6中,我使用了一个按钮P23来启动系统。
void app_button_enable(void)
{
wkupct_register_callback(app_button_press_cb);
//if (!(GPIO_GetPinStatus(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN))) //按钮是p23
wkupct_enable_irq(0x80000, 0, 1, 10);// P2_3,极性低,1 0 x40000 < br / >} < / p > < p > app_button_press_cb (void)我添加这个< br / >: < / p > < p > havekey_flag = 1; < / p > < p >如果(keytimescn> = 1) < br / > {< br / > keytimescn = 0; < br / > ke_timer_clear (SCAN_KEY_TIMER TASK_APP); < br / >} < / p > < p > keytimescn + +; < / p > < p >如果(PW_ON_OFF ! = 0) / /关机雕像权力在< br / > {< br / > / / ke_timer_init (); < / p > < p >GPIO_SetInactive (GPIO_TI_LED_PORT GPIO_TI_LED_PIN);//fot tip enter here the led is on
ke_timer_set(SOTF_PW_TIMER,TASK_APP,200);
}
else
{//搜索400MS_key
GPIO_SetInactive (GPIO_ALERT_LED_PORT, GPIO_ALERT_LED_PIN);/ / fot提示进入这里的领导是< br / > button_type = BUTTONTYPE_400MS; < br / > ke_timer_set (SCAN_KEY_TIMER TASK_APP 40); < br / > / / app_force_active_mode (); < br / >} < / p > < p >这里我以前添加味精< br / > enum APP_MSG < br / > {< br / > APP_MODULE_INIT_CMP_EVT = KE_FIRST_MSG (TASK_APP) < / p > < p > SOTF_PW_TIMER, < br /> ............< br /> ............
}
/* Default State handlers definition. */
EXTERN const struct ke_msg_handler app_default_state[] =
{
{SOTF_PW_TIMER, (ke_msg_func_t)poweron_soft_handler},
{GAPM_DEVICE_READY_IND, (ke_msg_func_t)gapm_device_ready_ind_handler},
.............
...........
}
In handler function:
int poweron_soft_handler(ke_msg_id_t const msgid,
void const *param,
ke_task_id_t const dest_id,
ke_task_id_t const src_id)
{
GPIO_SetInactive( GPIO_ALERT_LED_PORT, GPIO_ALERT_LED_PIN); //fot tip enter here. the led is on
{//soft poweron is the first prio
PW_ON_OFF =0;
been_tip_flag =0;
app_adv_start();
led_been_loop =TIP_LOOP_LEDON;
ke_timer_set(LEN_BEEN_TIP_TIMER,TASK_APP,1);
}
ke_timer_clear(SOTF_PW_TIMER,TASK_APP);
return (KE_MSG_CONSUMED);
}
I press key P23 to high one time last 6s { greater than in set here (ke_timer_set(SOTF_PW_TIMER,TASK_APP,200) 2s};
have enter the step:
GPIO_SetInactive(GPIO_TI_LED_PORT,GPIO_TI_LED_PIN); //fot tip enter here the led is on
but sometimes the step is not in:
GPIO_SetInactive( GPIO_ALERT_LED_PORT, GPIO_ALERT_LED_PIN); //fot tip enter here. the led is on
so the system is not poweron everytime.
my question is :
ke_timer_set(SOTF_PW_TIMER,TASK_APP,200); //only here call SOTF_PW_TIMER's function
but sometimes this function
poweron_soft_handler
is not call succeed.
why?
additional:
I have view this
http://support.dialog-semiconductor.com/faq/how-use-ketimer-during-wakeu...
but in 3.0.6 have no this MSG
struct create_new_timer_struct *req = KE_MSG_ALLOC(APP_CREATE_NEW_TIMER, TASK_APP, TASK_APP,
create_new_timer_struct);
create_new_timer_struct
and
APP_CREATE_NEW_TIMER
not included in my used SDK(3.0.6).