Detecting a button double click?

We are new to Nordic and have been making great progress with our nrf52840DK board and successfully running many of the Nordic SDK examples. We can't seem to find a single example of an API that will notify on a variety of button events (more than just a single click). Our code needs to respond differently for single-click, double-click, press-and-hold. Sure seems that the Nordic SDK would have something for that. Yes? Any help would be appreciated.

Thanks,

Steve K, PuzL Labs, LLC

  • Hi Steve,

    I am not sure that we have these right now, but I will just ask around and confirm this. But you could combine the button detection with timers so as to detect a long press or double click etc. You can try a similar implementation as mentioned in this ticket, but for the nRF Connect SDK.

    Best Regards,

    Priyanka

  • Hi Steve,

    My bad. Looks like this is now possible using the CAF library. Please take a look at the click events.

    Regards,

    Priyanka

  • Hi Priyanka,

    Thank you, I took a look at your response and went looking within my Nordic SDK installation to find examples that might show the use of the "CAF: Buttons module". I couldn’t find anything. Also, the link you provided for “click events” resolved to documentation for SDK v2.4.99 and I’m wondering if my older (but still fairly recent) SDK v2.4.1 installation doesn’t have the "CAF: Buttons module". Maybe it's something very new. Anyhow, I’m still a bit confused and could probably still use a little guidance. Thanks in advance.

    Steve K.
    PuzL Labs, LLC

  • Hi.

    The same can be found for v2.4.1 as well: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.4.1/nrf/libraries/caf/caf_overview.html#:~:text=pressed%20or%20released.-,CAF%20click%20events,%EF%83%81,-Header%20file%3A 

    Our applications like the nRF Desktop application, asset tracker etc use the CAF buttons library.

    Regards,

    Priyanka

  • Hi Priyanka,

    Thanks, good to know that v2.4.1 supports sensing button click events. I went looking within my v2.4.1 Nordic SDK installation to find a code example that might show the use of the "CAF: Buttons module". I couldn’t find anything. Being new to Nordic I guess it's possible I am looking in the wrong place. If you happen to have a tip I'd be grateful. Thanks in advance.

    Regards,

    Steve K, PuzL Labs, LLC

1 2 3