Hi Dialog,
I am making a software denounce with a timer to check the button press, since I am using the two interruptions at the same time for the button Pin and the sensor pin for different denounce time.
I have set a timer "APP_DOUBOUNCE_PRESS_TIMER" to check the button pin is stable pressed with press denounce after 20ms, once the button is pressed down and interruption comes.
ke_timer_set(APP_DOUBOUNCE_PRESS_TIMER, TASK_APP, 2);
I have also made a timer "APP_DOUBOUNCE_RELEASE_TIMER" to check the button pin is stable released with release denounce after 20ms, once the button is released up.
ke_timer_set(APP_DOUBOUNCE_RELEASE_TIMER, TASK_APP, 2);
The problem is that if I called the timer to check the button pin high or low with denounce timer, however sometimes the denounce function do not run immediately (the denounce function which is called may runs 5mins later, my system wakeup each 2.6s )
When I try to use the force wakeup before calling the deboucing function seems to be fine, any idea for this issue?
1. I have find here also,https://support.dialog-semiconductor.com/faq/how-use-ketimer-during-wake...
but if I try to use a pp_easy_timer() instead of ke_timer_set(), may I avoid to force wakeup?
2. if I force to wakup a calling "ke_timer_set(APP_DOUBOUNCE_PRESS_TIMER, TASK_APP, 2)"; does the system will still have chance to miss "ke_timer_set(APP_DOUBOUNCE_PRESS_TIMER, TASK_APP, 2)"?
2.1 For example, the system still in sleeping mode will miss the "ke_timer_set(APP_DOUBOUNCE_PRESS_TIMER, TASK_APP, 2)"
2.2或系统调用另一个application with ke_timer_set(), does it will collision with the "ke_timer_set(APP_DOUBOUNCE_PRESS_TIMER, TASK_APP, 2)" I am calling now?
Hi liuluan002,
I am sorry but i cant understand what you are trying to say, i think i get what you are trying to do, but i dont get the problem, you call a kernel timer to read the state of your pin and the callback doesn't occur ? Nevertheless if you want to use the kernel timer you MUST wake up the ble core, only then you can be certain that the scheduler will schedule the timer, thats why the app_easy_timer() API checks if the BLE core is awake and if its not it forces it to wake up and sends a message (APP_TIMER_CREATE) in order for the timer to be created when the BLE core is awake. The app_easy_timer() is an API that makes sure that the timer will be set no matter what, you can check the app_easy_timer() in order to check what it does.
Also i dont think that the ke_timers is a good way to perform debouncing since they depend on the BLE core and also they have a resolution of 10ms, i suppose that you can use the systick timer for doing that.
Thanks MT_dialog