Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of nRF51822 by
ble_sensorsim.h
00001 /* Copyright (c) 2012 Nordic Semiconductor. All Rights Reserved. 00002 * 00003 * The information contained herein is property of Nordic Semiconductor ASA. 00004 * Terms and conditions of usage are described in detail in NORDIC 00005 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT. 00006 * 00007 * Licensees are granted free, non-transferable use of the information. NO 00008 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from 00009 * the file. 00010 * 00011 */ 00012 00013 /** @file 00014 * 00015 * @defgroup ble_sdk_lib_sensorsim Sensor Data Simulator 00016 * @{ 00017 * @ingroup ble_sdk_lib 00018 * @brief Functions for simulating sensor data. 00019 * 00020 * @details Currently only a triangular waveform simulator is implemented. 00021 */ 00022 00023 #ifndef BLE_SENSORSIM_H__ 00024 #define BLE_SENSORSIM_H__ 00025 00026 #include <stdint.h> 00027 #include <stdbool.h> 00028 #include "nordic_global.h" 00029 00030 /**@brief Triangular waveform sensor simulator configuration. */ 00031 typedef struct 00032 { 00033 uint32_t min; /**< Minimum simulated value. */ 00034 uint32_t max; /**< Maximum simulated value. */ 00035 uint32_t incr; /**< Increment between each measurement. */ 00036 bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */ 00037 } ble_sensorsim_cfg_t; 00038 00039 /**@brief Triangular waveform sensor simulator state. */ 00040 typedef struct 00041 { 00042 uint32_t current_val; /**< Current sensor value. */ 00043 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */ 00044 } ble_sensorsim_state_t; 00045 00046 /**@brief Function for initializing a triangular waveform sensor simulator. 00047 * 00048 * @param[out] p_state Current state of simulator. 00049 * @param[in] p_cfg Simulator configuration. 00050 */ 00051 void ble_sensorsim_init(ble_sensorsim_state_t * p_state, 00052 const ble_sensorsim_cfg_t * p_cfg); 00053 00054 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator. 00055 * 00056 * @param[in,out] p_state Current state of simulator. 00057 * @param[in] p_cfg Simulator configuration. 00058 * 00059 * @return Simulator output. 00060 */ 00061 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state, 00062 const ble_sensorsim_cfg_t * p_cfg); 00063 00064 #endif // BLE_SENSORSIM_H__ 00065 00066 /** @} */
Generated on Tue Jul 12 2022 19:00:52 by
