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

which gpiote_init() can be used?

Hi All, In ble_app_hrs example two function is defined for gpiote_init() 1) static void gpiote_init(void) { APP_GPIOTE_INIT(APP_GPIOTE_MAX_USERS); }

2)
    static void gpiote_init(void)
    {
         // Configure the GPIOTE Task to toggle the LED state.
           nrf_gpiote_task_config(GPIOTE_CHAN_FOR_LED_TASK,
                       ADVERTISING_LED_PIN_NO,
                       NRF_GPIOTE_POLARITY_TOGGLE,
                       NRF_GPIOTE_INITIAL_VALUE_LOW);
   }

    1)  i want to know is this two function any way linked with each other ?
    2) if i have to use this function in my code for nrf51288 to initialize gpiote
        then for which function i should go for?

can anyone please share information related to it. Thanks

Parents
  • Hi

    1. The gpiote_init function here is defined in the app_gpiote library which allocates buffers for a gpiote user and enables the gpiote interrupt. It is necessary to call the gpiote_init function in the app_gpiote library before calling app_button_init function because app_buttons library registers a user in the app_gpiote library.

    2. The gpiote_init function you are referring to in 2) is specific to enable LED blinking in this example (definition in led.c file in the project folder), which simply configures GPIOTE channel 0 to toggle a certain gpio pin when the GPIOTE.OUT task is called.

    To make things short, call gpiote_init function in app_gpiote library if you intend to use the app_button library (to enable button presses), or if you intend to register a gpiote user for any other purpose. gpiote_init in led.c is actually a private function since it is not defined in led.h.

Reply
  • Hi

    1. The gpiote_init function here is defined in the app_gpiote library which allocates buffers for a gpiote user and enables the gpiote interrupt. It is necessary to call the gpiote_init function in the app_gpiote library before calling app_button_init function because app_buttons library registers a user in the app_gpiote library.

    2. The gpiote_init function you are referring to in 2) is specific to enable LED blinking in this example (definition in led.c file in the project folder), which simply configures GPIOTE channel 0 to toggle a certain gpio pin when the GPIOTE.OUT task is called.

    To make things short, call gpiote_init function in app_gpiote library if you intend to use the app_button library (to enable button presses), or if you intend to register a gpiote user for any other purpose. gpiote_init in led.c is actually a private function since it is not defined in led.h.

Children
No Data
Related