Wallbot_CaaS
Dependencies: MPU6050 mbed PID
Fork of BLE_MPU6050_test6_challenge_sb 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 00029 /**@brief Triangular waveform sensor simulator configuration. */ 00030 typedef struct 00031 { 00032 uint32_t min; /**< Minimum simulated value. */ 00033 uint32_t max; /**< Maximum simulated value. */ 00034 uint32_t incr; /**< Increment between each measurement. */ 00035 bool start_at_max; /**< TRUE is measurement is to start at the maximum value, FALSE if it is to start at the minimum. */ 00036 } ble_sensorsim_cfg_t; 00037 00038 /**@brief Triangular waveform sensor simulator state. */ 00039 typedef struct 00040 { 00041 uint32_t current_val; /**< Current sensor value. */ 00042 bool is_increasing; /**< TRUE if the simulator is in increasing state, FALSE otherwise. */ 00043 } ble_sensorsim_state_t; 00044 00045 /**@brief Function for initializing a triangular waveform sensor simulator. 00046 * 00047 * @param[out] p_state Current state of simulator. 00048 * @param[in] p_cfg Simulator configuration. 00049 */ 00050 void ble_sensorsim_init(ble_sensorsim_state_t * p_state, 00051 const ble_sensorsim_cfg_t * p_cfg); 00052 00053 /**@brief Function for generating a simulated sensor measurement using a triangular waveform generator. 00054 * 00055 * @param[in,out] p_state Current state of simulator. 00056 * @param[in] p_cfg Simulator configuration. 00057 * 00058 * @return Simulator output. 00059 */ 00060 uint32_t ble_sensorsim_measure(ble_sensorsim_state_t * p_state, 00061 const ble_sensorsim_cfg_t * p_cfg); 00062 00063 #endif // BLE_SENSORSIM_H__ 00064 00065 /** @} */
Generated on Tue Jul 12 2022 18:33:09 by 1.7.2