X-NUCLEO-IKS01A1 Environmental/Motion sensors data transmitted via X-NUCLEO-IDB04A1 BLE board. Compatible with iOS/Android ST BlueMS V2.1 application.
Dependencies: BLE_API X_NUCLEO_IDB0XA1 X_NUCLEO_IKS01A1 mbed
Fork of Bluemicrosystem1 by
MotionFX_Manager.h
00001 /** 00002 ****************************************************************************** 00003 * @file MotionFX_Manager.h 00004 * @author Central Lab 00005 * @version V1.1.0 00006 * @date 20-January-2015 00007 * @brief This file includes sensor fusion interface functions 00008 ****************************************************************************** 00009 * @attention 00010 * 00011 * <h2><center>© COPYRIGHT(c) 2015 STMicroelectronics</center></h2> 00012 * 00013 * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 00014 * You may not use this file except in compliance with the License. 00015 * You may obtain a copy of the License at: 00016 * 00017 * http://www.st.com/software_license_agreement_liberty_v2 00018 * 00019 * Redistribution and use in source and binary forms, with or without modification, 00020 * are permitted provided that the following conditions are met: 00021 * 1. Redistributions of source code must retain the above copyright notice, 00022 * this list of conditions and the following disclaimer. 00023 * 2. Redistributions in binary form must reproduce the above copyright notice, 00024 * this list of conditions and the following disclaimer in the documentation 00025 * and/or other materials provided with the distribution. 00026 * 3. Neither the name of STMicroelectronics nor the names of its contributors 00027 * may be used to endorse or promote products derived from this software 00028 * without specific prior written permission. 00029 * 00030 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 00031 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 00032 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00033 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 00034 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00035 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 00036 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 00037 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 00038 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00039 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00040 * 00041 ****************************************************************************** 00042 */ 00043 00044 #ifndef _MOTIONFX_MANAGER_H_ 00045 #define _MOTIONFX_MANAGER_H_ 00046 00047 #ifdef __cplusplus 00048 extern "C" { 00049 #endif 00050 00051 //#define USE_SENSOR_FUSION_LIB /** uncomment only if STM32_OSX_MotionFX_Library is linked and licensed **/ 00052 00053 #include <cstdio> 00054 #include <stdint.h> 00055 #include <stdio.h> 00056 00057 #ifdef USE_SENSOR_FUSION_LIB 00058 #include "osx_motion_fx.h" 00059 #else 00060 00061 #define NUM_AXES 3 00062 #define QNUM_AXES 4 00063 00064 typedef struct 00065 { 00066 float mag[NUM_AXES]; /* calibrated mag [uT]/50 */ 00067 float acc[NUM_AXES]; /* acc [g] */ 00068 float gyro[NUM_AXES]; /* gyro [dps] */ 00069 } osxMFX_input; 00070 00071 typedef struct 00072 { 00073 float rotation_9X[NUM_AXES]; /* 9 axes yaw, pitch and roll */ 00074 float quaternion_9X[QNUM_AXES]; /* 9 axes quaternion */ 00075 float gravity_9X[NUM_AXES]; /* 9 axes device frame gravity */ 00076 float linear_acceleration_9X[NUM_AXES]; /* 9 axes device frame linear acceleration */ 00077 float heading_9X; /* 9 axes heading */ 00078 float rotation_6X[NUM_AXES]; /* 6 axes yaw, pitch and roll */ 00079 float quaternion_6X[QNUM_AXES]; /* 6 axes quaternion */ 00080 float gravity_6X[NUM_AXES]; /* 6 axes device frame gravity */ 00081 float linear_acceleration_6X[NUM_AXES]; /* 6 axes device frame linear acceleration */ 00082 float heading_6X; /* 6 axes heading */ 00083 } osxMFX_output; 00084 00085 typedef struct 00086 { 00087 signed short magOffX; /* X axis Offset */ 00088 signed short magOffY; /* Y axis Offset */ 00089 signed short magOffZ; /* Z axis Offset */ 00090 float magGainX; /* X axis Gain */ 00091 float magGainY; /* Y axis Gain */ 00092 float magGainZ; /* Z axis Gain */ 00093 float expMagVect; /* expected magnetic field */ 00094 } osxMFX_calibFactor; 00095 00096 unsigned char osx_MotionFX_compass_isCalibrated(void); 00097 void osx_MotionFX_compass_forceReCalibration(void); 00098 void osx_MotionFX_compass_saveAcc(int acc_x, int acc_y, int acc_z); 00099 void osx_MotionFX_compass_saveMag(int mag_x, int mag_y, int mag_z); 00100 int osx_MotionFX_compass_run(void); 00101 void osx_MotionFX_setCalibrationData(osxMFX_calibFactor* CalibrationData); 00102 void osx_MotionFX_getCalibrationData(osxMFX_calibFactor* CalibrationData); 00103 00104 #endif 00105 00106 00107 typedef struct { 00108 int32_t AXIS_X; 00109 int32_t AXIS_Y; 00110 int32_t AXIS_Z; 00111 } AxesRaw_t; 00112 00113 /* Exported functions ------------------------------------------------------- */ 00114 00115 bool MotionFX_manager_init(bool DS3_OnBoard, osxMFX_calibFactor & magOffset); 00116 void MotionFX_manager_run(AxesRaw_t *ACC_Value, AxesRaw_t *GYR_Value, AxesRaw_t *MAG_Value, osxMFX_calibFactor & magOffset); 00117 void MotionFX_manager_start_6X(void); 00118 void MotionFX_manager_stop_6X(void); 00119 void MotionFX_manager_start_9X(void); 00120 void MotionFX_manager_stop_9X(void); 00121 00122 void MotionFX_manager_setDependencies(uint8_t sf, int32_t sensorMask); 00123 void MotionFX_manager_resetDependencies(uint8_t sf, int32_t sensorMask); 00124 uint32_t MotionFX_manager_getDependencies(uint8_t sf); 00125 00126 osxMFX_output* MotionFX_manager_getDataOUT(void); 00127 osxMFX_input* MotionFX_manager_getDataIN(void); 00128 00129 /* Exported constants --------------------------------------------------------*/ 00130 00131 /* Delta time mSec for Deltafusion */ 00132 #define DELTATIMESENSORFUSION 0.01 00133 00134 #ifdef __cplusplus 00135 } 00136 #endif 00137 00138 #endif //_MOTIONFX_MANAGER_H_ 00139 00140 /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/
Generated on Sun Jul 17 2022 23:51:22 by 1.7.2