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

How to ? : Button Press Event Register & Enable a selected button to wake up the NRF52 DK from Deep Sleep

I am new to NRF (The usual song Slight smile)

Here's what I am trying to do :

Connect my button on P0.16 or P0.17 of my NRF52 DK Board , and when I press the button connected to P0.17 a function be called to wake up the chip from DEEP Sleep , and when I press another button , another function be called to do something else the other one be not able to wake up the chip.

I had a look at the GPIOTE Library , then I had a look at the BSP Library , I think they all have overlapping functionalities,

I was expecting some api along these lines.

esp_sleep_enable_ext0_wakeup(GPIO_NUM_X, level) // coming straight from ESP32 Arduino ! https://randomnerdtutorials.com/esp32-external-wake-up-deep-sleep/

My ESP32 uses this call to get up from sleep (My P0.17 Requirement.
I am having trouble understanding how to register a button callback.
A very simple example by someone on the forum would help me get started.
Also APP_GPIOTE_INIT(MAX_USERS); whats the USER here ? (I am a total noob here.) does it corresponds to different button registering for a different callback like my P0.16 for some other function , P0.17 for wakeup.
Conclusion : Help me get started on GPIOTE Package.

An simple example would be much appreciated.

Getting Started is not getting me started ,someone on the forum said :) .
Thank You.

Parents
  • Did you take a look at the documentation:
    https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/lib_gpiote.html?cp=5_1_3_19 

    MAX_USERS simply specify how many callback handlers you want to be called.

    Just make sure you understand that wakeup from deep sleep will cause chip reset, while app_gpiote is typically used in system ON idle when you want action to occur when the chip for instance is in "normal" sleep, e.g. wait for event (maintaining connection and should take appropriate action based on user input).

  • Why do we have BSP and app_gpiote , do they have overlapping functionalities , if yes which one to be used ? , do we have brief examples on either of them (Like Examples and not API documentation) , looking at the api docs , I don't understand what to start or initialize with to use the other functions in the API, I tried to use app_gpiote lib which has some functions to register a callback on button events , then along the docs I found even BSP Lib has few to register callbacks ? , Am I wrong to interpret the functionality of those APIs ,

    An example of each lib just to get the basic functionality would act as a building block to further use the API for me and other users here , if any like me Innocent ,

    Thank You , for your reply.

Reply
  • Why do we have BSP and app_gpiote , do they have overlapping functionalities , if yes which one to be used ? , do we have brief examples on either of them (Like Examples and not API documentation) , looking at the api docs , I don't understand what to start or initialize with to use the other functions in the API, I tried to use app_gpiote lib which has some functions to register a callback on button events , then along the docs I found even BSP Lib has few to register callbacks ? , Am I wrong to interpret the functionality of those APIs ,

    An example of each lib just to get the basic functionality would act as a building block to further use the API for me and other users here , if any like me Innocent ,

    Thank You , for your reply.

Children
Related