テスト用です。

Dependencies:   mbed

Committer:
jksoft
Date:
Tue Oct 11 11:09:42 2016 +0000
Revision:
0:8468a4403fea
SB??ver;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jksoft 0:8468a4403fea 1 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved.
jksoft 0:8468a4403fea 2 *
jksoft 0:8468a4403fea 3 * The information contained herein is property of Nordic Semiconductor ASA.
jksoft 0:8468a4403fea 4 * Terms and conditions of usage are described in detail in NORDIC
jksoft 0:8468a4403fea 5 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
jksoft 0:8468a4403fea 6 *
jksoft 0:8468a4403fea 7 * Licensees are granted free, non-transferable use of the information. NO
jksoft 0:8468a4403fea 8 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
jksoft 0:8468a4403fea 9 * the file.
jksoft 0:8468a4403fea 10 *
jksoft 0:8468a4403fea 11 */
jksoft 0:8468a4403fea 12
jksoft 0:8468a4403fea 13 /** @file
jksoft 0:8468a4403fea 14 *
jksoft 0:8468a4403fea 15 * @defgroup ble_sdk_lib_sensorsim Sensor Data Simulator
jksoft 0:8468a4403fea 16 * @{
jksoft 0:8468a4403fea 17 * @ingroup ble_sdk_lib
jksoft 0:8468a4403fea 18 * @brief Functions for simulating sensor data.
jksoft 0:8468a4403fea 19 *
jksoft 0:8468a4403fea 20 * @details Currently only a triangular waveform simulator is implemented.
jksoft 0:8468a4403fea 21 */
jksoft 0:8468a4403fea 22
jksoft 0:8468a4403fea 23 #ifndef BLE_SENSORSIM_H__
jksoft 0:8468a4403fea 24 #define BLE_SENSORSIM_H__
jksoft 0:8468a4403fea 25
jksoft 0:8468a4403fea 26 #include <stdint.h>
jksoft 0:8468a4403fea 27 #include <stdbool.h>
jksoft 0:8468a4403fea 28
jksoft 0:8468a4403fea 29 /**@brief Triangular waveform sensor simulator configuration. */
jksoft 0:8468a4403fea 30 typedef struct
jksoft 0:8468a4403fea 31 {
jksoft 0:8468a4403fea 32 uint32_t min; /**< Minimum simulated value. */
jksoft 0:8468a4403fea 33 uint32_t max; /**< Maximum simulated value. */
jksoft 0:8468a4403fea 34 uint32_t incr; /**< Increment between each measurement. */
jksoft 0:8468a4403fea 35 bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */
jksoft 0:8468a4403fea 36 } ble_sensorsim_cfg_t;
jksoft 0:8468a4403fea 37
jksoft 0:8468a4403fea 38 /**@brief Triangular waveform sensor simulator state. */
jksoft 0:8468a4403fea 39 typedef struct
jksoft 0:8468a4403fea 40 {
jksoft 0:8468a4403fea 41 uint32_t current_val; /**< Current sensor value. */
jksoft 0:8468a4403fea 42 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */
jksoft 0:8468a4403fea 43 } ble_sensorsim_state_t;
jksoft 0:8468a4403fea 44
jksoft 0:8468a4403fea 45 /**@brief Function for initializing a triangular waveform sensor simulator.
jksoft 0:8468a4403fea 46 *
jksoft 0:8468a4403fea 47 * @param[out] p_state Current state of simulator.
jksoft 0:8468a4403fea 48 * @param[in] p_cfg Simulator configuration.
jksoft 0:8468a4403fea 49 */
jksoft 0:8468a4403fea 50 void ble_sensorsim_init(ble_sensorsim_state_t * p_state,
jksoft 0:8468a4403fea 51 const ble_sensorsim_cfg_t * p_cfg);
jksoft 0:8468a4403fea 52
jksoft 0:8468a4403fea 53 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator.
jksoft 0:8468a4403fea 54 *
jksoft 0:8468a4403fea 55 * @param[in,out] p_state Current state of simulator.
jksoft 0:8468a4403fea 56 * @param[in] p_cfg Simulator configuration.
jksoft 0:8468a4403fea 57 *
jksoft 0:8468a4403fea 58 * @return Simulator output.
jksoft 0:8468a4403fea 59 */
jksoft 0:8468a4403fea 60 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state,
jksoft 0:8468a4403fea 61 const ble_sensorsim_cfg_t * p_cfg);
jksoft 0:8468a4403fea 62
jksoft 0:8468a4403fea 63 #endif // BLE_SENSORSIM_H__
jksoft 0:8468a4403fea 64
jksoft 0:8468a4403fea 65 /** @} */