Openwear requires RC oscillator to be used

Fork of nRF51822 by Nordic Semiconductor

Committer:
Rohit Grover
Date:
Mon Jul 07 13:43:31 2014 +0100
Revision:
37:c29c330d942c
Parent:
0:eff01767de02
changes required to upgrade to V7 of the soft-device

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:eff01767de02 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
bogdanm 0:eff01767de02 2 *
bogdanm 0:eff01767de02 3 * The information contained herein is property of Nordic Semiconductor ASA.
bogdanm 0:eff01767de02 4 * Terms and conditions of usage are described in detail in NORDIC
bogdanm 0:eff01767de02 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
bogdanm 0:eff01767de02 6 *
bogdanm 0:eff01767de02 7 * Licensees are granted free, non-transferable use of the information. NO
bogdanm 0:eff01767de02 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
bogdanm 0:eff01767de02 9 * the file.
bogdanm 0:eff01767de02 10 *
bogdanm 0:eff01767de02 11 */
bogdanm 0:eff01767de02 12
bogdanm 0:eff01767de02 13 #ifndef NRF_TEMP_H__
bogdanm 0:eff01767de02 14 #define NRF_TEMP_H__
bogdanm 0:eff01767de02 15
bogdanm 0:eff01767de02 16 #include "nrf51.h"
bogdanm 0:eff01767de02 17
bogdanm 0:eff01767de02 18 /**
bogdanm 0:eff01767de02 19 * @defgroup nrf_temperature TEMP (temperature) abstraction
bogdanm 0:eff01767de02 20 * @{
bogdanm 0:eff01767de02 21 * @ingroup nrf_drivers temperature_example
bogdanm 0:eff01767de02 22 * @brief Temperature module init and read functions.
bogdanm 0:eff01767de02 23 *
bogdanm 0:eff01767de02 24 */
bogdanm 0:eff01767de02 25
bogdanm 0:eff01767de02 26
bogdanm 0:eff01767de02 27
bogdanm 0:eff01767de02 28 /**
bogdanm 0:eff01767de02 29 * @brief Function for preparing the temp module for temperature measurement.
bogdanm 0:eff01767de02 30 *
bogdanm 0:eff01767de02 31 * This function initializes the TEMP module and writes to the hidden configuration register.
bogdanm 0:eff01767de02 32 *
bogdanm 0:eff01767de02 33 * @param none
bogdanm 0:eff01767de02 34 */
bogdanm 0:eff01767de02 35 static __INLINE void nrf_temp_init(void)
bogdanm 0:eff01767de02 36 {
bogdanm 0:eff01767de02 37 /**@note Workaround for PAN_028 rev2.0A anomaly 31 - TEMP: Temperature offset value has to be manually loaded to the TEMP module */
bogdanm 0:eff01767de02 38 *(uint32_t *) 0x4000C504 = 0;
bogdanm 0:eff01767de02 39 }
bogdanm 0:eff01767de02 40
bogdanm 0:eff01767de02 41
bogdanm 0:eff01767de02 42
bogdanm 0:eff01767de02 43 #define MASK_SIGN (0x00000200UL)
bogdanm 0:eff01767de02 44 #define MASK_SIGN_EXTENSION (0xFFFFFC00UL)
bogdanm 0:eff01767de02 45
bogdanm 0:eff01767de02 46 /**
bogdanm 0:eff01767de02 47 * @brief Function for reading temperature measurement.
bogdanm 0:eff01767de02 48 *
bogdanm 0:eff01767de02 49 * The function reads the 10 bit 2's complement value and transforms it to a 32 bit 2's complement value.
bogdanm 0:eff01767de02 50 *
bogdanm 0:eff01767de02 51 * @param none
bogdanm 0:eff01767de02 52 */
bogdanm 0:eff01767de02 53 static __INLINE int32_t nrf_temp_read(void)
bogdanm 0:eff01767de02 54 {
bogdanm 0:eff01767de02 55 /**@note Workaround for PAN_028 rev2.0A anomaly 28 - TEMP: Negative measured values are not represented correctly */
bogdanm 0:eff01767de02 56 return ((NRF_TEMP->TEMP & MASK_SIGN) != 0) ? (NRF_TEMP->TEMP | MASK_SIGN_EXTENSION) : (NRF_TEMP->TEMP);
bogdanm 0:eff01767de02 57 }
bogdanm 0:eff01767de02 58
bogdanm 0:eff01767de02 59 /** @} */
bogdanm 0:eff01767de02 60
bogdanm 0:eff01767de02 61 #endif