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

don't we neeed to change the buttons_leds_init function?

HI,ALL

i notice that the buttons_leds_init is initiating the bsp function. just like LED and Buttons.

uint32_t err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                             APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                             bsp_event_handler);

All we have to do is to add event in the bsp_event_handler.

in most user cases, is it true that we do not change anything in the buttons_leds_init.

But i wanna know that when we should change the buttons_leds_init function.

Following is the buttons_leds_init function

static void buttons_leds_init(bool * p_erase_bonds)
{

    bsp_event_t startup_event;

    uint32_t err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                                 APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                                 bsp_event_handler);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_btn_ble_init(NULL, &startup_event);
    APP_ERROR_CHECK(err_code);

    *p_erase_bonds = (startup_event == BSP_EVENT_CLEAR_BONDING_DATA);
}
Parents
  • You should not need to change the buttons_leds_init function. If you make your own board you have to change the boards.h file to include the file with your own leds and buttons pin numbers and such.

    If you want custom functionality on buttons and leds I will recommend to use app_button and LEDS_ON/OFF/INVERT instead. You can disable the BSP module by defining BSP_DEFINES_ONLY and BSP_SIMPLE at compile time.

Reply
  • You should not need to change the buttons_leds_init function. If you make your own board you have to change the boards.h file to include the file with your own leds and buttons pin numbers and such.

    If you want custom functionality on buttons and leds I will recommend to use app_button and LEDS_ON/OFF/INVERT instead. You can disable the BSP module by defining BSP_DEFINES_ONLY and BSP_SIMPLE at compile time.

Children
No Data
Related