API for temperature sensor in nrf51822
Dependents: BLE_TemperatureAdvertising BLE_TemperatureObserver TEMP_YM2
TMP_nrf51.cpp
00001 00002 /* mbed Microcontroller Library 00003 * Copyright (c) 2006-2015 ARM Limited 00004 * 00005 * Licensed under the Apache License, Version 2.0 (the "License"); 00006 * you may not use this file except in compliance with the License. 00007 * You may obtain a copy of the License at 00008 * 00009 * http://www.apache.org/licenses/LICENSE-2.0 00010 * 00011 * Unless required by applicable law or agreed to in writing, software 00012 * distributed under the License is distributed on an "AS IS" BASIS, 00013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00014 * See the License for the specific language governing permissions and 00015 * limitations under the License. 00016 */ 00017 00018 #include "TMP_nrf51.h" 00019 #include "nrf_soc.h" // for internal Thermo sensoer 00020 00021 /** 00022 * @brief Get the temperature value. 00023 * 00024 * @return Die temperature in °C 00025 * 00026 */ 00027 TMP_nrf51::tmpSensorValue_t TMP_nrf51::get() 00028 { 00029 int32_t p_temp; 00030 00031 sd_temp_get(&p_temp); 00032 00033 return (TMP_nrf51::tmpSensorValue_t) ((float)p_temp * 0.25); /* 0.25 is temperature sensor resolution */ 00034 }
Generated on Tue Jul 12 2022 18:14:20 by 1.7.2