To get started with Seeed Tiny BLE, include detecting motion, button and battery level.

Dependencies:   BLE_API eMPL_MPU6050 mbed nRF51822

Committer:
yihui
Date:
Wed Apr 22 07:47:17 2015 +0000
Revision:
1:fc2f9d636751
update libraries; ; delete nRF51822/nordic-sdk/components/gpiote/app_gpiote.c to solve GPIOTE_IRQHandler multiply defined issue. temperarily change nRF51822 library to folder

Who changed what in which revision?

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