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

Interrupt in BLE Central example: The location of a specific callback?

Hello Nordic Devzone.:

When studying the 8.0 BLE Central multilink example (s120 softdevice), I looked into the component relevant to button pressing interrupts, app_button.c, I reckon that the member "button_handler" of the struct:

typedef struct
{
    uint8_t              pin_no;           /**< Pin to be used as a button. */
    uint8_t              active_state;     /**< APP_BUTTON_ACTIVE_HIGH or APP_BUTTON_ACTIVE_LOW. */
    nrf_gpio_pin_pull_t  pull_cfg;         /**< Pull-up or -down configuration. */
    app_button_handler_t button_handler;   /**< Handler to be called when button is pushed. */
} app_button_cfg_t;

is a callback function pointer that will later be pointed to the appropriate function during run time. The problem is, I can't seem to find the line where such a pointing process happens, or in other words, where is the line of code tell the pointer to point specifically at the correct handler function?

Regarding how the function pointer works, I could have made a wrong guess, but based on my experience, it usually is the case.

Erik

Parents Reply Children
Related