Health Thermometer Example - CGP Acute Technology 22/11/19
----------------------------------------------------------

This folder contains a modified main.c from the Nordic Semiconductor SDK15.3, Health Thermometer Example, taken from here:

	nRF5_SDK_15.3.0_59ac345\examples\ble_peripheral\ble_app_hts

and documented here:
	https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v15.3.0/ble_sdk_app_hts.html?cp=6_5_0_4_2_2_12	
	
It can be used to replace the original main.c then programmed into a PCA10040 development board.
The board then operates as a simple BLE advertising device and will work with the rest of the
"HTS Scanner" app. The user can push Button 1 to (re-)start advertising at will.

I made some code changes so the Button 1 is used to start the board advertising. Other changes stop Button 1 resetting
the board (wake from sleep?).

I made the following main code changes. Look for "CGP" in the sourec code for changes.

(a) in bsp_event_handler() change the BSP_EVENT_KEY_0 code so Button 1 starts advertising:
        case BSP_EVENT_KEY_0:
            if (m_conn_handle != BLE_CONN_HANDLE_INVALID)   {
                temperature_measurement_send();
            } else {
            	advertising_start(false);
            }

(b) in advertising_init() add this line to prevent advertising resuming after disconnect:
        init.config.ble_adv_on_disconnect_disabled = true;

(c) add "return;" as the first line in sleep_mode_enter() to prevent entering sleep mode (otherwise
    the button resets the application rather than works to start advertising):

(d) To make the LED1 behave correctly, add this to case BLE_ADV_EVT_IDLE:
        NRF_LOG_INFO("Idle.");
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
        
    and this to   case BLE_GAP_EVT_DISCONNECTED:
        NRF_LOG_INFO("Disconnected.");
        err_code = bsp_indication_set(BSP_INDICATE_IDLE);
        APP_ERROR_CHECK(err_code);
		