Nordic stack and drivers for the mbed BLE API Modified for HRM1017 for library 0.1.0
Fork of nRF51822 by
nrf_temp.h
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 #ifndef NRF_TEMP_H__ 00014 #define NRF_TEMP_H__ 00015 00016 #include "nrf51.h" 00017 00018 /** 00019 * @defgroup nrf_temperature TEMP (temperature) abstraction 00020 * @{ 00021 * @ingroup nrf_drivers temperature_example 00022 * @brief Temperature module init and read functions. 00023 * 00024 */ 00025 00026 00027 00028 /** 00029 * @brief Function for preparing the temp module for temperature measurement. 00030 * 00031 * This function initializes the TEMP module and writes to the hidden configuration register. 00032 * 00033 * @param none 00034 */ 00035 static __INLINE void nrf_temp_init(void) 00036 { 00037 /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */ 00038 *(uint32_t *) 0x4000C504 = 0; 00039 } 00040 00041 00042 00043 #define MASK_SIGN (0x00000200UL) 00044 #define MASK_SIGN_EXTENSION (0xFFFFFC00UL) 00045 00046 /** 00047 * @brief Function for reading temperature measurement. 00048 * 00049 * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value. 00050 * 00051 * @param none 00052 */ 00053 static __INLINE int32_t nrf_temp_read(void) 00054 { 00055 /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */ 00056 return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP); 00057 } 00058 00059 /** @} */ 00060 00061 #endif
Generated on Tue Jul 12 2022 14:11:57 by 1.7.2