Nordic stack and drivers for the mbed BLE API

Fork of nRF51822 by Nordic Semiconductor

Committer:
bogdanm
Date:
Wed Mar 26 14:38:17 2014 +0000
Revision:
0:eff01767de02
Child:
37:c29c330d942c
Initial import of the nRF51822 code

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 /** @file
bogdanm 0:eff01767de02 14 *
bogdanm 0:eff01767de02 15 * @defgroup ble_sdk_lib_sensorsim Sensor Data Simulator
bogdanm 0:eff01767de02 16 * @{
bogdanm 0:eff01767de02 17 * @ingroup ble_sdk_lib
bogdanm 0:eff01767de02 18 * @brief Functions for simulating sensor data.
bogdanm 0:eff01767de02 19 *
bogdanm 0:eff01767de02 20 * @details Currently only a triangular waveform simulator is implemented.
bogdanm 0:eff01767de02 21 */
bogdanm 0:eff01767de02 22
bogdanm 0:eff01767de02 23 #ifndef BLE_SENSORSIM_H__
bogdanm 0:eff01767de02 24 #define BLE_SENSORSIM_H__
bogdanm 0:eff01767de02 25
bogdanm 0:eff01767de02 26 #include <stdint.h>
bogdanm 0:eff01767de02 27 #include <stdbool.h>
bogdanm 0:eff01767de02 28 #include "nordic_global.h"
bogdanm 0:eff01767de02 29
bogdanm 0:eff01767de02 30 /**@brief Triangular waveform sensor simulator configuration. */
bogdanm 0:eff01767de02 31 typedef struct
bogdanm 0:eff01767de02 32 {
bogdanm 0:eff01767de02 33 uint32_t min; /**< Minimum simulated value. */
bogdanm 0:eff01767de02 34 uint32_t max; /**< Maximum simulated value. */
bogdanm 0:eff01767de02 35 uint32_t incr; /**< Increment between each measurement. */
bogdanm 0:eff01767de02 36 bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */
bogdanm 0:eff01767de02 37 } ble_sensorsim_cfg_t;
bogdanm 0:eff01767de02 38
bogdanm 0:eff01767de02 39 /**@brief Triangular waveform sensor simulator state. */
bogdanm 0:eff01767de02 40 typedef struct
bogdanm 0:eff01767de02 41 {
bogdanm 0:eff01767de02 42 uint32_t current_val; /**< Current sensor value. */
bogdanm 0:eff01767de02 43 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */
bogdanm 0:eff01767de02 44 } ble_sensorsim_state_t;
bogdanm 0:eff01767de02 45
bogdanm 0:eff01767de02 46 /**@brief Function for initializing a triangular waveform sensor simulator.
bogdanm 0:eff01767de02 47 *
bogdanm 0:eff01767de02 48 * @param[out] p_state Current state of simulator.
bogdanm 0:eff01767de02 49 * @param[in] p_cfg Simulator configuration.
bogdanm 0:eff01767de02 50 */
bogdanm 0:eff01767de02 51 void ble_sensorsim_init(ble_sensorsim_state_t * p_state,
bogdanm 0:eff01767de02 52 const ble_sensorsim_cfg_t * p_cfg);
bogdanm 0:eff01767de02 53
bogdanm 0:eff01767de02 54 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator.
bogdanm 0:eff01767de02 55 *
bogdanm 0:eff01767de02 56 * @param[in,out] p_state Current state of simulator.
bogdanm 0:eff01767de02 57 * @param[in] p_cfg Simulator configuration.
bogdanm 0:eff01767de02 58 *
bogdanm 0:eff01767de02 59 * @return Simulator output.
bogdanm 0:eff01767de02 60 */
bogdanm 0:eff01767de02 61 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state,
bogdanm 0:eff01767de02 62 const ble_sensorsim_cfg_t * p_cfg);
bogdanm 0:eff01767de02 63
bogdanm 0:eff01767de02 64 #endif // BLE_SENSORSIM_H__
bogdanm 0:eff01767de02 65
bogdanm 0:eff01767de02 66 /** @} */