diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp index cee1cfca9e..0bb0c400fe 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/btle.cpp @@ -234,7 +234,7 @@ static void btle_handler(ble_evt_t *p_ble_evt) /*! @brief Callback when an error occurs inside the SoftDevice */ void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name) { - ASSERT(false, (void) 0); + ASSERT_TRUE(false, (void) 0); } /*! diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp index 60ff8544c5..b7fbb61d77 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/btle/custom/custom_helper.cpp @@ -135,7 +135,7 @@ ble_uuid_t custom_convert_to_nordic_uuid(const UUID &uuid) #define CFG_CUSTOM_UUID_BASE "\x6E\x40\x00\x00\xB5\xA3\xF3\x93\xE0\xA9\xE5\x0E\x24\xDC\xCA\x9E" uint8_t uuid_type = custom_add_uuid_base(CFG_CUSTOM_UUID_BASE); - ASSERT(uuid_type > 0, ERROR_NOT_FOUND); + ASSERT_TRUE(uuid_type > 0, ERROR_NOT_FOUND); // We can now safely add the primary service and any characteristics // for our custom service ... diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h index c0bd8c0d66..71bacb3e81 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/common/assertion.h @@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void) //--------------------------------------------------------------------+ // Logical Assert //--------------------------------------------------------------------+ -#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__) #define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false") #define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true") diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp index 629f471c9f..77cb11b91d 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGap.cpp @@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons //} /* Send advertising data! */ - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_data_set(advData.getPayload(), advData.getPayloadLen(), scanResponse.getPayload(), @@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons /* Make sure the GAP Service appearance value is aligned with the *appearance from GapAdvertisingData */ - ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), BLE_ERROR_PARAM_OUT_OF_RANGE); /* ToDo: Perform some checks on the payload, for example the Scan Response can't */ @@ -196,7 +196,7 @@ ble_error_t nRF5xGap::startAdvertising(const GapAdvertisingParams ¶ms) adv_para.interval = params.getIntervalInADVUnits(); // advertising interval (in units of 0.625 ms) adv_para.timeout = params.getTimeout(); - ASSERT(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_start(&adv_para), BLE_ERROR_PARAM_OUT_OF_RANGE); return BLE_ERROR_NONE; } @@ -267,7 +267,7 @@ ble_error_t nRF5xGap::stopScan(void) { ble_error_t nRF5xGap::stopAdvertising(void) { /* Stop Advertising */ - ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); state.advertising = 0; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp index db0647583a..4c5365f1b7 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_MCU_NRF51822/source/nRF5xGattServer.cpp @@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(service.getUUID()); uint16_t serviceHandle; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &nordicUUID, &serviceHandle), @@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) } } - ASSERT ( ERROR_NONE == + ASSERT_TRUE ( ERROR_NONE == custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_char->getProperties(), @@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID()); - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_desc->getValuePtr(), @@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute: .p_value = buffer, }; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value), BLE_ERROR_PARAM_OUT_OF_RANGE); *lengthP = value.len; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp index afe6c77d8f..f004d86cb1 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/btle/btle.cpp @@ -292,7 +292,7 @@ static void btle_handler(ble_evt_t *p_ble_evt) /*! @brief Callback when an error occurs inside the SoftDevice */ void assert_nrf_callback(uint16_t line_num, const uint8_t *p_file_name) { - ASSERT(false, (void) 0); + ASSERT_TRUE(false, (void) 0); } /*! diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h index c0bd8c0d66..71bacb3e81 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/common/assertion.h @@ -125,7 +125,6 @@ static inline void debugger_breakpoint(void) //--------------------------------------------------------------------+ // Logical Assert //--------------------------------------------------------------------+ -#define ASSERT(...) ASSERT_TRUE(__VA_ARGS__) #define ASSERT_TRUE(condition , error) ASSERT_DEFINE( , (condition), error, "%s", "evaluated to false") #define ASSERT_FALSE(condition , error) ASSERT_DEFINE( ,!(condition), error, "%s", "evaluated to true") diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp index a2f59dd4da..f874bfefe5 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGap.cpp @@ -96,7 +96,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons //} /* Send advertising data! */ - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_data_set(advData.getPayload(), advData.getPayloadLen(), scanResponse.getPayload(), @@ -105,7 +105,7 @@ ble_error_t nRF5xGap::setAdvertisingData(const GapAdvertisingData &advData, cons /* Make sure the GAP Service appearance value is aligned with the *appearance from GapAdvertisingData */ - ASSERT(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_appearance_set(advData.getAppearance()), BLE_ERROR_PARAM_OUT_OF_RANGE); /* ToDo: Perform some checks on the payload, for example the Scan Response can't */ @@ -273,7 +273,7 @@ ble_error_t nRF5xGap::stopScan(void) { ble_error_t nRF5xGap::stopAdvertising(void) { /* Stop Advertising */ - ASSERT(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); + ASSERT_TRUE(ERROR_NONE == sd_ble_gap_adv_stop(), BLE_ERROR_PARAM_OUT_OF_RANGE); state.advertising = 0; diff --git a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp index 4f4c562920..7d079855cb 100644 --- a/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp +++ b/features/FEATURE_BLE/targets/TARGET_NORDIC/TARGET_NRF5/source/nRF5xGattServer.cpp @@ -52,7 +52,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(service.getUUID()); uint16_t serviceHandle; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &nordicUUID, &serviceHandle), @@ -88,7 +88,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) } } - ASSERT ( ERROR_NONE == + ASSERT_TRUE ( ERROR_NONE == custom_add_in_characteristic(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_char->getProperties(), @@ -123,7 +123,7 @@ ble_error_t nRF5xGattServer::addService(GattService &service) nordicUUID = custom_convert_to_nordic_uuid(p_desc->getUUID()); - ASSERT(ERROR_NONE == + ASSERT_TRUE(ERROR_NONE == custom_add_in_descriptor(BLE_GATT_HANDLE_INVALID, &nordicUUID, p_desc->getValuePtr(), @@ -177,7 +177,7 @@ ble_error_t nRF5xGattServer::read(Gap::Handle_t connectionHandle, GattAttribute: .p_value = buffer, }; - ASSERT( ERROR_NONE == + ASSERT_TRUE( ERROR_NONE == sd_ble_gatts_value_get(connectionHandle, attributeHandle, &value), BLE_ERROR_PARAM_OUT_OF_RANGE); *lengthP = value.len;