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

Hardfault ble_nus_send_data - SDK 17

Hi,

I've noticed that there was an issue with ble_nus in SDK 15.3 - detailed in this post.

I'm using SDK 17, and in my application, I don't check data_handler != NULL. When BLE_GATTS_EVT_HVN_TX_COMPLETE occurs, I just define ble_nus_evt_t evt and calls p_nus->data_handler. Probably took it from an example, I can't remember.

Is it safe? Should I use something else?

Thanks!

Parents Reply
  • I do not really understand the question. If you look at the whole macro it looks like this copied from your previous post and just modified white spaces a bit to make it clearer (note that it is not from SDK 17 which you referred to, but some older SDK):

    #define BLE_NUS_DEF(_name) \
    static ble_nus_t _name; \
    NRF_SDH_BLE_OBSERVER(_name ## _obs, BLE_NUS_BLE_OBSERVER_PRIO, OnBleNusEvent, &_name)

    Lets say you call BLE_NUS_DEF like this:

    BLE_NUS_DEF(my_nus_instance)

    The preprocessor would then translate this to the following (note that I am ignoring that it does the same with NRF_SDH_BLE_OBSERVER here, but it follows the same principle):

    static ble_nus_t my_nus_instance;
    NRF_SDH_BLE_OBSERVER(_name ## _obs, BLE_NUS_BLE_OBSERVER_PRIO, OnBleNusEvent, &_name)

    So you now got a instance of ble_nus_t called my_nus_instance.

    I suggest you read up on the C preprocessor if you need to understand more about this.

Children
Related