⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
Kevleo94
Offline
Last seen:2 years 9 months ago
加入:2017-09-05 07:18
double press reset

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:
PM_Dialog
Offline
Last seen:3 days 16 hours ago
Staff
加入:2018-02-08 11:03
Hi Kevleo94,

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

Kevleo94
Offline
Last seen:2 years 9 months ago
加入:2017-09-05 07:18
This is my function

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?

PM_Dialog
Offline
Last seen:3 days 16 hours ago
Staff
加入:2018-02-08 11:03
Hi Kevleo94,

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