If I want detect the buttons long press for mouse key hold, how to do?
If I want detect the buttons long press for mouse key hold, how to do?
Hi,
You could check out the app_button library in the SDK. With this library, you can set the interval a button should be pressed until you get an event.
Best regards Håkon
if I need do a event every 250ms when the button be pressed, how to do?
Hi,
Try looking at example "ble_app_hids_mouse" and look at function "buttons_init()".
This shows you how to setup detection delay.
Change define "BUTTON_DETECTION_DELAY" to:
APP_TIMER_TICKS(250, APP_TIMER_PRESCALER)
And then it's setup to 250 ms before it fires the event handler.
Best regards Håkon
I have tested it. But It only can implement the evnet one time when I hold the button not release. I want to implement the event every 250ms not only one time. Thank you!
Hi,
You should look at both app_button and app_timer to do the task that you describe. When you get the button-event, start the app_timer instance.
BR Håkon