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

Long button press to trigger an event

Hello Nordic team,

I am trying to develop a long button press handler, but I am unable to find the proper documentation or example code to help with that. I am not sure if I should use bsp.c or app_button.c. 

Reading through devzone has me more inclined to using app_button instead of bsp.c but I am unsure as to what the differences really are. Is there example code that can support my development??

Thanks for your time and support,

Tandon

Parents
  • Hi! I apologize for the slow response.

    I'm going to assume you're asking about the difference between the Board Support Package (BSP) and the Button Handler. Please correct me if my assumption is wrong.

    The BSP provides another layer of abstraction on top of the button handler, but it is mostly used for handling buttons in BLE examples, using the BSP BLE Button Module. If you are just writing a simple button handler, I would use the Button Handler library. 

    If you take a look at bsp.c, app_button.h is included in that. So it utilizes the functions in the button handler, but it provides another layer of abstraction. 

    Best regards,

    Heidi

  • Heidi,

    Your response has helped me a lot. I decided to go with button handler approach. However, I do have a query with that.

    Upon a button press - I seem to be getting 2 events. My guess is from HighToLow and LowToHigh. There is, unfortunately, no RC filter in place that can help with this. Tweaking the BUTTON_DETECTION_DELAY has also not been of much help. Are there any other approaches that might help? 

    Is it possible for me to initialize  GPIOTE_CONFIG_IN_SENSE_HITOLO and GPIOTE_CONFIG_IN_SENSE_LOTOHI, instead of a single GPIOTE_CONFIG_IN_SENSE_TOGGLE? Any direction or example would help me greatly.

    In my application, I need to detect a hold and press. A hold is detected with an app timer, I believe.

    Happy New Year and thanks in advance! 

Reply
  • Heidi,

    Your response has helped me a lot. I decided to go with button handler approach. However, I do have a query with that.

    Upon a button press - I seem to be getting 2 events. My guess is from HighToLow and LowToHigh. There is, unfortunately, no RC filter in place that can help with this. Tweaking the BUTTON_DETECTION_DELAY has also not been of much help. Are there any other approaches that might help? 

    Is it possible for me to initialize  GPIOTE_CONFIG_IN_SENSE_HITOLO and GPIOTE_CONFIG_IN_SENSE_LOTOHI, instead of a single GPIOTE_CONFIG_IN_SENSE_TOGGLE? Any direction or example would help me greatly.

    In my application, I need to detect a hold and press. A hold is detected with an app timer, I believe.

    Happy New Year and thanks in advance! 

Children
Related