The application uses bsp_button_is_pressed()
but this device has no buttons. This results in err_code
set to NRF_ERROR_INVALID_PARAM
and subsequently a system reset during device_manager_init
. The following patch hacks around this:
From da31ec91a991c5da4529f2d2afab5c4ff0489dc2 Mon Sep 17 00:00:00 2001
From: "Peter A. Bigot" <[email protected]>
Date: Wed, 7 Jan 2015 10:03:03 -0600
Subject: [PATCH] ble_app_hrs: bypass button requirement on pca10031
The nRF51-Dongle has no buttons; attempting to initialize them causes a
system reset. Disable the features that require buttons.
---
examples/ble_peripheral/ble_app_hrs/main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/examples/ble_peripheral/ble_app_hrs/main.c b/examples/ble_peripheral/ble_app_hrs/main.c
index 9bf03f4..7578d4d 100644
--- a/examples/ble_peripheral/ble_app_hrs/main.c
+++ b/examples/ble_peripheral/ble_app_hrs/main.c
@@ -643,6 +643,7 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
if (p_ble_evt->evt.gap_evt.params.timeout.src == BLE_GAP_TIMEOUT_SRC_ADVERTISEMENT)
{
+#if (BUTTONS_NUMBER > 0)
err_code = bsp_indication_set(BSP_INDICATE_IDLE);
APP_ERROR_CHECK(err_code);
@@ -653,6 +654,7 @@ static void on_ble_evt(ble_evt_t * p_ble_evt)
// Go to system-off mode (this function will not return; wakeup will cause a reset).
err_code = sd_power_system_off();
APP_ERROR_CHECK(err_code);
+#endif /* BUTTONS_NUMBER */
}
break;
@@ -793,9 +795,11 @@ static void device_manager_init(void)
err_code = pstorage_init();
APP_ERROR_CHECK(err_code);
+#if (BUTTONS_NUMBER > 0)
// Clear all bonded centrals if the Bonds Delete button is pushed.
err_code = bsp_button_is_pressed(BOND_DELETE_ALL_BUTTON_ID,&(init_data.clear_persistent_data));
APP_ERROR_CHECK(err_code);
+#endif /* BUTTONS_NUMBER */
err_code = dm_init(&init_data);
APP_ERROR_CHECK(err_code);
--
1.9.1