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