A very simple BLE temperature beacon.
Dependencies: BLE_API mbed nRF51822
Fork of BLE_TemperatureAdvertising by
TMP_nrf51/TMP_nrf51.cpp@7:0a8bbb6dea16, 2016-01-12 (annotated)
- Committer:
- andresag
- Date:
- Tue Jan 12 10:12:43 2016 +0000
- Revision:
- 7:0a8bbb6dea16
- Parent:
- 5:f4d74a8cad43
Update example to latest BLE API.
Who changed what in which revision?
User | Revision | Line number | New 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 | } |