Nordic stack and drivers for the mbed BLE API

Dependents:   BLE_Health_Thermometer2

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 /** @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
bogdanm 0:eff01767de02 29 /**@brief Triangular waveform sensor simulator configuration. */
bogdanm 0:eff01767de02 30 typedef struct
bogdanm 0:eff01767de02 31 {
bogdanm 0:eff01767de02 32 uint32_t min; /**< Minimum simulated value. */
bogdanm 0:eff01767de02 33 uint32_t max; /**< Maximum simulated value. */
bogdanm 0:eff01767de02 34 uint32_t incr; /**< Increment between each measurement. */
bogdanm 0:eff01767de02 35 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 36 } ble_sensorsim_cfg_t;
bogdanm 0:eff01767de02 37
bogdanm 0:eff01767de02 38 /**@brief Triangular waveform sensor simulator state. */
bogdanm 0:eff01767de02 39 typedef struct
bogdanm 0:eff01767de02 40 {
bogdanm 0:eff01767de02 41 uint32_t current_val; /**< Current sensor value. */
bogdanm 0:eff01767de02 42 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */
bogdanm 0:eff01767de02 43 } ble_sensorsim_state_t;
bogdanm 0:eff01767de02 44
bogdanm 0:eff01767de02 45 /**@brief Function for initializing a triangular waveform sensor simulator.
bogdanm 0:eff01767de02 46 *
bogdanm 0:eff01767de02 47 * @param[out] p_state Current state of simulator.
bogdanm 0:eff01767de02 48 * @param[in] p_cfg Simulator configuration.
bogdanm 0:eff01767de02 49 */
bogdanm 0:eff01767de02 50 void ble_sensorsim_init(ble_sensorsim_state_t * p_state,
bogdanm 0:eff01767de02 51 const ble_sensorsim_cfg_t * p_cfg);
bogdanm 0:eff01767de02 52
bogdanm 0:eff01767de02 53 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator.
bogdanm 0:eff01767de02 54 *
bogdanm 0:eff01767de02 55 * @param[in,out] p_state Current state of simulator.
bogdanm 0:eff01767de02 56 * @param[in] p_cfg Simulator configuration.
bogdanm 0:eff01767de02 57 *
bogdanm 0:eff01767de02 58 * @return Simulator output.
bogdanm 0:eff01767de02 59 */
bogdanm 0:eff01767de02 60 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state,
bogdanm 0:eff01767de02 61 const ble_sensorsim_cfg_t * p_cfg);
bogdanm 0:eff01767de02 62
bogdanm 0:eff01767de02 63 #endif // BLE_SENSORSIM_H__
bogdanm 0:eff01767de02 64
bogdanm 0:eff01767de02 65 /** @} */