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

About BSP button and related events

Hi all,

I have two questions about BSP buttons management.

I see that the BSP supports the short press and long press for a button. However it seems to handle only one of the features at time, is it right ? I can't handle both short and long press for a button but I need to configure only one action calling bsp_event_to_button_action_assign.

In the bsp.h there are some bsp events already defined (the bsp_event_t enum) related to some BLE operations (bond, disconnect, advertising and so on). How can I add any new custom events ?

However I see that these already defined events are part of BSP even if IMHO they should be part of bsp_btn_ble because they are strictly related to BLE operations but the BSP is for handling hardware not necessary BLE.

Thanks, Paolo.

Parents
  • Hi Paolo,

    Firstly have a look at the introductory tutorial to BSP. You are right that some lights are seemingly assigned to advertising etc., however it is only assigned so that that specific LED will become lit if the relevant function is called.

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
    

    So if you don't want the BSP to this, don't call bsp_indication_set().

    To add custom events you add the action you want to do to the BSP event handler. For instance you can wait for 1s and check if the button is still pressed.

    Hopefully this answers your question. Best regards,

    Øyvind

Reply
  • Hi Paolo,

    Firstly have a look at the introductory tutorial to BSP. You are right that some lights are seemingly assigned to advertising etc., however it is only assigned so that that specific LED will become lit if the relevant function is called.

    err_code = bsp_indication_set(BSP_INDICATE_ADVERTISING);
    APP_ERROR_CHECK(err_code);
    

    So if you don't want the BSP to this, don't call bsp_indication_set().

    To add custom events you add the action you want to do to the BSP event handler. For instance you can wait for 1s and check if the button is still pressed.

    Hopefully this answers your question. Best regards,

    Øyvind

Children
No Data
Related