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

How to use nRF51 DK buttons for my purposes only

All the SDK health device examples appear to have a rather complicated relation between the BSP buttons and the behavior of the device (advertising, connected, etc.) which means the BSP module must have intimate knowledge of these states somehow. Then it does all other kinds of things that I do not want it to do. In other words pressing button 1 does different things depending upon the state to the extent I get a BSP DISCONNECT EVENT!!!

All I want is to respond to a button press as I want to do it. I do NOT want the buttons to assume ahead of time that I am using button one to wake or sleep or disconnect if its a long push and I am connected, etc. I want a simple event that says I just pressed button one or button two etc. I have four buttons on my DK. What I do in response to those events is up to me. Being able to do that allows me to simulate what the actual device will do when I work with the real sensor on the production unit.

My guess is that I ditch the BSP button module and just use the app_button module, but it's probably not that simple. Any where I can get guidance?

Parents Reply
  • For the moment I just used the debugger and trapped the event when I pressed the various buttons on the DK. I found that I could use the events for buttons 3 and 4 as they had simple identifiers. I can use those and do what I need to do. In the end none of this code will be of use in the production device - this is just for testing. So the less work I do here the happier I am.

    I will just need to catch button event BSP_EVENT_KEY_2

Children
No Data
Related