This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

What can I do, if I want to press and hold button?

Hey guys, I have a question. Please tell me.

I use the BLE module implementation of the nrf51822. Now, I try to use sample program "ble_app_hids_mouse" for s110. I want to move with the button this program.

First question. I can move mouse. Mouse will move up, down, left, right and left click with the button. But I can not press and hold button. I don't know why.

Paste the code that I have made.

image description

But, printD and printDN is a function to be output to the UART.

Did I make a mistake something?

Second question. I change the APP_BUTTON_RELEASE from 0 to 1 on "app_button.h" . Because I want to press and hold button.

image description

Is this a mistake?

Please help me.

Parents
  • What happens if you push and hold the button? Does it print the state several times or does it go out of the event handler? What is the value of pstate? I would guess PIN26_STATE is defined as (1<<26)?

    You don't have to define APP_BUTTON_RELEASE as 1. You should also not change APP_BUTTON_ACTIVE_HIGH and APP_BUTTON_ACTIVE_LOW. The active state of the button is defined when you initialize it (see the app_button_cfg_t struct).

Reply
  • What happens if you push and hold the button? Does it print the state several times or does it go out of the event handler? What is the value of pstate? I would guess PIN26_STATE is defined as (1<<26)?

    You don't have to define APP_BUTTON_RELEASE as 1. You should also not change APP_BUTTON_ACTIVE_HIGH and APP_BUTTON_ACTIVE_LOW. The active state of the button is defined when you initialize it (see the app_button_cfg_t struct).

Children
No Data
Related