Hi, I want to ask about press button in keil.
I'm using "wkupct_enable_irq" function with 2 events. After 2 press It will trigger "app_button_press_cb" function and it works.
But the problem is it's not "double press".Currently, button will recognize 2 press in interval 3 seconds (first press in first seconds, second press in third seconds). I need the button recognize 2 press in interval 1 seconds(first and second press in first seconds) so it will become "double press"
Can I change the reset event timer? Or is there any function that will give me "double press"?
Thank you
Device:
Hi Kevleo94,
Could you please clarify if you are working on a custom code or on a ble example of sdk? I have modified the ble_app_sleepmode example of the SDK in order to wake up the device after double press of the button. I have changed the wkupct_enable_irq() function into the app_button_enable() with the following code :
wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN), // select pin (GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)
WKUPCT_PIN_POLARITY (GPIO_BUTTON_PORT GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW), // polarity low
2, // 2 events
40); // debouncing time = 40
With this way, I am able to wake up the device by double pressing the button in less than 1 second. The wkupct_enable_irq() function resets the event timer with the SetWord16(WKUP_RESET_CNTR_REG, 0) command. Have you modified the wkupct_enable_irq() function and as a result it adds a delay into your code? Could you please share how you implement the double press of the button in order to help you?
Thanks, PM_Dialog
This is my function
wkupct_enable_irq(WKUPCT_PIN_SELECT(GPIO_BUTTON_PORT, GPIO_BUTTON_PIN), // select pin (GPIO_BUTTON_PORT, GPIO_BUTTON_PIN)
WKUPCT_PIN_POLARITY (GPIO_BUTTON_PORT GPIO_BUTTON_PIN, WKUPCT_PIN_POLARITY_LOW), // polarity low
2, // 2 push
40); // debouncing time = 0
but I add sleep mode(Extended sleep mode) in my project, is that the problem?
Hi Kevleo94,
I have modified the ble_app_sleepmode example of the SDK as extended sleep mode, and I am able to wake up the device by “double pressing” the switch button. So, there is no problem, if you add extended sleep mode into your project and you should be able to wake up.
Thanks, PM_Dialog