BLE ADV sensor for 2-pin interrupt (i.e. window/door sensor w/ reed switch)

Dependencies:   BLE_API mbed nRF51822

Basic door/window sensor for nRF51822 BLE modules.

Committer:
electronichamsters
Date:
Sun Aug 27 05:48:45 2017 +0000
Revision:
12:9bb01e063498
Parent:
5:f4d74a8cad43
make periodic updates based on i/o events.  comments.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 5:f4d74a8cad43 1 /* mbed Microcontroller Library
rgrover1 5:f4d74a8cad43 2 * Copyright (c) 2006-2015 ARM Limited
rgrover1 5:f4d74a8cad43 3 *
rgrover1 5:f4d74a8cad43 4 * Licensed under the Apache License, Version 2.0 (the "License");
rgrover1 5:f4d74a8cad43 5 * you may not use this file except in compliance with the License.
rgrover1 5:f4d74a8cad43 6 * You may obtain a copy of the License at
rgrover1 5:f4d74a8cad43 7 *
rgrover1 5:f4d74a8cad43 8 * http://www.apache.org/licenses/LICENSE-2.0
rgrover1 5:f4d74a8cad43 9 *
rgrover1 5:f4d74a8cad43 10 * Unless required by applicable law or agreed to in writing, software
rgrover1 5:f4d74a8cad43 11 * distributed under the License is distributed on an "AS IS" BASIS,
rgrover1 5:f4d74a8cad43 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
rgrover1 5:f4d74a8cad43 13 * See the License for the specific language governing permissions and
rgrover1 5:f4d74a8cad43 14 * limitations under the License.
rgrover1 5:f4d74a8cad43 15 */
rgrover1 5:f4d74a8cad43 16
rgrover1 5:f4d74a8cad43 17 #include "TMP_nrf51.h"
rgrover1 5:f4d74a8cad43 18 #include "nrf_soc.h" // for internal thermometer sensor
rgrover1 5:f4d74a8cad43 19
rgrover1 5:f4d74a8cad43 20 /**
rgrover1 5:f4d74a8cad43 21 * @brief Get the temperature value.
rgrover1 5:f4d74a8cad43 22 *
rgrover1 5:f4d74a8cad43 23 * @return Die temperature in °C
rgrover1 5:f4d74a8cad43 24 */
rgrover1 5:f4d74a8cad43 25 TMP_nrf51::TempSensorValue_t TMP_nrf51::get(void)
rgrover1 5:f4d74a8cad43 26 {
rgrover1 5:f4d74a8cad43 27 int32_t p_temp;
rgrover1 5:f4d74a8cad43 28 sd_temp_get(&p_temp);
rgrover1 5:f4d74a8cad43 29
rgrover1 5:f4d74a8cad43 30 return ((TempSensorValue_t)p_temp * 0.25); /* 0.25 is temperature sensor resolution */
rgrover1 5:f4d74a8cad43 31 }