Motion and Environmental sensor reader application connected via BLE to ST BlueMS iOS/Android application.

Dependencies:   HTS221 LIS3MDL LPS22HB LSM303AGR LSM6DSL

Fork of MOTENV_Mbed by ST Expansion SW Team

This application supports three different sets of ST hardware boards:

  • STEVAL-STLKT01V1 (aka SensorTile)
  • X-NUCLEO-IDB05A1 and X-NUCLEO-IKS01A2 expansion boards
  • B-L475E-IOT01A IoT Discovery board

    and runs over four different target configurations:

  • Nucleo F401RE + X-NUCLEO-IDB05A1 + X-NUCLEO-IKS01A2 (set target NUCLEO_F401RE)
  • DISCO_L475VG_IOT01A (set target DISCO_L475VG_IOT01A)
  • Nucleo L476RG + CRADLE + SENSORTILE (set compile target NUCLEO_L476RG)
  • Nucleo L476RG + CRADLE_EXPANSION_BOARD + SENSORTILE (set compile target NUCLEO_L476RG, remove macro MINI_CRADLE from mbed_app.json)

The first 2 configurations do not require any HW modifications (just use the above indicated targets).

Third configuration (CRADLE ) only requires to remove the two ST-LINK jumpers and JP6 from the Nucleo L476RG board in order to allow flashing the SensorTile through the Nucleo Jtag controller. Once flashed, if the battery is properly plugged and charged, the SensorTile could be mounted in the plastic enclosure being able to run as a small stand alone wearable device. Please note that this configuration do not provide a serial console for printf.

To enable last configuration (CRADLE_EXPANSION_BOARD), follow the steps below:

  • On Nucleo L476RG
    • open the two "ST-LINK" jumpers
    • open the MCU power supply jumper JP6
    • close the solder bridges SB63 and SB62 (to enable the serial console)
  • On SensorTile Arduino Cradle close the solder bridges SB21 and SB10 (to enable the serial console) and move the jumper J2 to the 5V position
  • Plug the Sensor Tile on the Arduino Cradle
  • Plug the Cradle on the Nucleo Arduino connector and connect the debug flat cable between Cradle and Nucleo Jtag connector (the cradle pin1 -identified by a dot- must be connected to the Nucleo pin1 (dot) of SWD CN4 jtag connector)
  • Plug the Nucleo USB cable on PC (a new COM port should appear); no need to plug the micro USB cable on the cradle.
  • Open a PC terminal to see the messages
  • Compile from mbed CLI or on-line compiler removing macro MINI_CRADLE from mbed_app.json file and selecting NUCLEO_ L476RG target
  • Flash the board with the binary

For all configurations on an Android or iOS device download and open the ST BlueMS application and connect to "MotEnvMbedOS" BLE device to see the sensor data.

For all configurations is also possible to add a 9 axis MotionFX sensor fusion library, which is part of the X-CUBE-MEMS package at this link.
The library comes in three flavours, choose your preferred according to the toolchain used (IAR, Keil or GC, Keil version should be used for the online compiler) and copy it in the Middlewares\ST\STM32_MotionFX_Library\Lib directory changing the file extension according to the toolchain used (.a for GCC, .ar for Keil).
In the file mbed_app.json add the macro definition "USE_SENSOR_FUSION_LIB" to the chosen target.
If compiling from CLI and using GCC_ARM toolchain option, in the file \mbed-os\tools\toolchains\gcc.py change the compiling option from

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=softfp")

to

        if target.core == "Cortex-M4F":
            self.cpu.append("-mfpu=fpv4-sp-d16")
            self.cpu.append("-mfloat-abi=hard")

and compile.

Committer:
mapellil
Date:
Thu Oct 19 07:43:37 2017 +0000
Revision:
36:7abc45e9b0a5
Parent:
20:b97e14ade434
Updated libs

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mapellil 0:e93a11b4e044 1 /**
mapellil 20:b97e14ade434 2 ******************************************************************************
mapellil 20:b97e14ade434 3 * @file MotionFX_Manager.c
mapellil 20:b97e14ade434 4 * @author MEMS Application Team
mapellil 20:b97e14ade434 5 * @version V2.0.0
mapellil 20:b97e14ade434 6 * @date 01-May-2017
mapellil 20:b97e14ade434 7 * @brief This file includes sensor fusion interface functions
mapellil 20:b97e14ade434 8 ******************************************************************************
mapellil 20:b97e14ade434 9 * @attention
mapellil 20:b97e14ade434 10 *
mapellil 20:b97e14ade434 11 * <h2><center>&copy; COPYRIGHT(c) 2017 STMicroelectronics</center></h2>
mapellil 20:b97e14ade434 12 *
mapellil 20:b97e14ade434 13 * Redistribution and use in source and binary forms, with or without modification,
mapellil 20:b97e14ade434 14 * are permitted provided that the following conditions are met:
mapellil 20:b97e14ade434 15 * 1. Redistributions of source code must retain the above copyright notice,
mapellil 20:b97e14ade434 16 * this list of conditions and the following disclaimer.
mapellil 20:b97e14ade434 17 * 2. Redistributions in binary form must reproduce the above copyright notice,
mapellil 20:b97e14ade434 18 * this list of conditions and the following disclaimer in the documentation
mapellil 20:b97e14ade434 19 * and/or other materials provided with the distribution.
mapellil 20:b97e14ade434 20 * 3. Neither the name of STMicroelectronics nor the names of its contributors
mapellil 20:b97e14ade434 21 * may be used to endorse or promote products derived from this software
mapellil 20:b97e14ade434 22 * without specific prior written permission.
mapellil 20:b97e14ade434 23 *
mapellil 20:b97e14ade434 24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
mapellil 20:b97e14ade434 25 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
mapellil 20:b97e14ade434 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
mapellil 20:b97e14ade434 27 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
mapellil 20:b97e14ade434 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
mapellil 20:b97e14ade434 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
mapellil 20:b97e14ade434 30 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
mapellil 20:b97e14ade434 31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
mapellil 20:b97e14ade434 32 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
mapellil 20:b97e14ade434 33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
mapellil 20:b97e14ade434 34 *
mapellil 20:b97e14ade434 35 ******************************************************************************
mapellil 20:b97e14ade434 36 */
mapellil 0:e93a11b4e044 37
mapellil 0:e93a11b4e044 38 /* Includes ------------------------------------------------------------------*/
mapellil 20:b97e14ade434 39 #include "mbed.h"
mapellil 20:b97e14ade434 40 #include "main.h"
mapellil 0:e93a11b4e044 41 #include "MotionFX_Manager.h"
mapellil 0:e93a11b4e044 42
mapellil 0:e93a11b4e044 43 #ifdef USE_SENSOR_FUSION_LIB
mapellil 0:e93a11b4e044 44
mapellil 20:b97e14ade434 45 /** @addtogroup MOTION_FX_Applications
mapellil 20:b97e14ade434 46 * @{
mapellil 20:b97e14ade434 47 */
mapellil 20:b97e14ade434 48
mapellil 20:b97e14ade434 49 /** @addtogroup DATALOG_FUSION
mapellil 20:b97e14ade434 50 * @{
mapellil 20:b97e14ade434 51 */
mapellil 20:b97e14ade434 52
mapellil 20:b97e14ade434 53 /** @addtogroup FX_Driver FX_Driver
mapellil 20:b97e14ade434 54 * @{
mapellil 20:b97e14ade434 55 */
mapellil 20:b97e14ade434 56
mapellil 20:b97e14ade434 57 /* Extern variables ----------------------------------------------------------*/
mapellil 0:e93a11b4e044 58
mapellil 20:b97e14ade434 59 /* Private defines -----------------------------------------------------------*/
mapellil 20:b97e14ade434 60 #define SAMPLETODISCARD 15
mapellil 20:b97e14ade434 61 #define GBIAS_ACC_TH_SC_6X (2.0f*0.000765f)
mapellil 20:b97e14ade434 62 #define GBIAS_GYRO_TH_SC_6X (2.0f*0.002f)
mapellil 20:b97e14ade434 63 #define GBIAS_MAG_TH_SC_6X (2.0f*0.001500f)
mapellil 20:b97e14ade434 64 #define GBIAS_ACC_TH_SC_9X (2.0f*0.000765f)
mapellil 20:b97e14ade434 65 #define GBIAS_GYRO_TH_SC_9X (2.0f*0.002f)
mapellil 20:b97e14ade434 66 #define GBIAS_MAG_TH_SC_9X (2.0f*0.001500f)
mapellil 0:e93a11b4e044 67
mapellil 20:b97e14ade434 68 /* Private variables ---------------------------------------------------------*/
mapellil 20:b97e14ade434 69 MFX_knobs_t iKnobs;
mapellil 20:b97e14ade434 70 MFX_knobs_t *ipKnobs = &iKnobs;
mapellil 0:e93a11b4e044 71
mapellil 0:e93a11b4e044 72 static volatile int sampleToDiscard = SAMPLETODISCARD;
mapellil 0:e93a11b4e044 73 static int discardedCount = 0;
mapellil 0:e93a11b4e044 74
mapellil 20:b97e14ade434 75 /* Public Functions ----------------------------------------------------------*/
mapellil 0:e93a11b4e044 76
mapellil 0:e93a11b4e044 77 /**
mapellil 20:b97e14ade434 78 * @brief Initialises MotionFX algorithm
mapellil 20:b97e14ade434 79 * @param handle handle to gyroscope sensor
mapellil 20:b97e14ade434 80 * @retval none
mapellil 20:b97e14ade434 81 */
mapellil 20:b97e14ade434 82
mapellil 20:b97e14ade434 83 void MotionFX_manager_init(unsigned char instance)
mapellil 0:e93a11b4e044 84 {
mapellil 20:b97e14ade434 85 char LibVersion[36];
mapellil 20:b97e14ade434 86
mapellil 20:b97e14ade434 87 __CRC_CLK_ENABLE();
mapellil 20:b97e14ade434 88 MotionFX_initialize();
mapellil 20:b97e14ade434 89 uint8_t len = MotionFX_GetLibVersion(LibVersion);
mapellil 20:b97e14ade434 90 LibVersion [len+1] = '\0';
mapellil 20:b97e14ade434 91 //printf ("MotionFX library Version: %s\n\r", LibVersion);
mapellil 20:b97e14ade434 92
mapellil 20:b97e14ade434 93 MotionFX_getKnobs(ipKnobs);
mapellil 20:b97e14ade434 94
mapellil 20:b97e14ade434 95 ipKnobs->gbias_acc_th_sc_6X = GBIAS_ACC_TH_SC_6X;
mapellil 20:b97e14ade434 96 ipKnobs->gbias_gyro_th_sc_6X = GBIAS_GYRO_TH_SC_6X;
mapellil 20:b97e14ade434 97 ipKnobs->gbias_mag_th_sc_6X = GBIAS_MAG_TH_SC_6X;
mapellil 20:b97e14ade434 98
mapellil 20:b97e14ade434 99 ipKnobs->gbias_acc_th_sc_9X = GBIAS_ACC_TH_SC_9X;
mapellil 20:b97e14ade434 100 ipKnobs->gbias_gyro_th_sc_9X = GBIAS_GYRO_TH_SC_9X;
mapellil 20:b97e14ade434 101 ipKnobs->gbias_mag_th_sc_9X = GBIAS_MAG_TH_SC_9X;
mapellil 0:e93a11b4e044 102
mapellil 20:b97e14ade434 103 // BSP_GYRO_Get_Instance(handle, &instance);
mapellil 20:b97e14ade434 104
mapellil 20:b97e14ade434 105 switch (instance)
mapellil 20:b97e14ade434 106 {
mapellil 20:b97e14ade434 107 #if (defined (USE_IKS01A1))
mapellil 20:b97e14ade434 108 case LSM6DS0_G_0:
mapellil 20:b97e14ade434 109 ipKnobs->acc_orientation[0] = 'e';
mapellil 20:b97e14ade434 110 ipKnobs->acc_orientation[1] = 'n';
mapellil 20:b97e14ade434 111 ipKnobs->acc_orientation[2] = 'u';
mapellil 20:b97e14ade434 112
mapellil 20:b97e14ade434 113 ipKnobs->gyro_orientation[0] = 'e';
mapellil 20:b97e14ade434 114 ipKnobs->gyro_orientation[1] = 'n';
mapellil 20:b97e14ade434 115 ipKnobs->gyro_orientation[2] = 'u';
mapellil 20:b97e14ade434 116 break;
mapellil 20:b97e14ade434 117
mapellil 20:b97e14ade434 118 case LSM6DS3_G_0:
mapellil 20:b97e14ade434 119 ipKnobs->acc_orientation[0] = 'n';
mapellil 20:b97e14ade434 120 ipKnobs->acc_orientation[1] = 'w';
mapellil 20:b97e14ade434 121 ipKnobs->acc_orientation[2] = 'u';
mapellil 20:b97e14ade434 122
mapellil 20:b97e14ade434 123 ipKnobs->gyro_orientation[0] = 'n';
mapellil 20:b97e14ade434 124 ipKnobs->gyro_orientation[1] = 'w';
mapellil 20:b97e14ade434 125 ipKnobs->gyro_orientation[2] = 'u';
mapellil 20:b97e14ade434 126 break;
mapellil 20:b97e14ade434 127
mapellil 20:b97e14ade434 128 default:
mapellil 20:b97e14ade434 129 return;
mapellil 20:b97e14ade434 130
mapellil 20:b97e14ade434 131 #elif (defined (USE_IKS01A2))
mapellil 20:b97e14ade434 132 case LSM6DSL_G_0:
mapellil 20:b97e14ade434 133 ipKnobs->acc_orientation[0] = 'n';
mapellil 20:b97e14ade434 134 ipKnobs->acc_orientation[1] = 'w';
mapellil 20:b97e14ade434 135 ipKnobs->acc_orientation[2] = 'u';
mapellil 20:b97e14ade434 136
mapellil 20:b97e14ade434 137 ipKnobs->gyro_orientation[0] = 'n';
mapellil 20:b97e14ade434 138 ipKnobs->gyro_orientation[1] = 'w';
mapellil 20:b97e14ade434 139 ipKnobs->gyro_orientation[2] = 'u';
mapellil 20:b97e14ade434 140 break;
mapellil 20:b97e14ade434 141
mapellil 20:b97e14ade434 142 default:
mapellil 20:b97e14ade434 143 return;
mapellil 20:b97e14ade434 144
mapellil 20:b97e14ade434 145 #else
mapellil 20:b97e14ade434 146 #error Not supported platform
mapellil 20:b97e14ade434 147 #endif
mapellil 20:b97e14ade434 148 }
mapellil 0:e93a11b4e044 149
mapellil 20:b97e14ade434 150 #if (defined (USE_IKS01A1))
mapellil 20:b97e14ade434 151 ipKnobs->mag_orientation[0] = 's';
mapellil 20:b97e14ade434 152 ipKnobs->mag_orientation[1] = 'e';
mapellil 20:b97e14ade434 153 ipKnobs->mag_orientation[2] = 'u';
mapellil 20:b97e14ade434 154 #elif (defined (USE_IKS01A2))
mapellil 20:b97e14ade434 155 ipKnobs->mag_orientation[0] = 'n';
mapellil 20:b97e14ade434 156 ipKnobs->mag_orientation[1] = 'e';
mapellil 20:b97e14ade434 157 ipKnobs->mag_orientation[2] = 'u';
mapellil 20:b97e14ade434 158 #else
mapellil 20:b97e14ade434 159 #error Not supported platform
mapellil 20:b97e14ade434 160 #endif
mapellil 20:b97e14ade434 161
mapellil 20:b97e14ade434 162 ipKnobs->output_type = MFX_ENGINE_OUTPUT_ENU;
mapellil 20:b97e14ade434 163 ipKnobs->LMode = 1;
mapellil 20:b97e14ade434 164 ipKnobs->modx = 1;
mapellil 20:b97e14ade434 165
mapellil 20:b97e14ade434 166 MotionFX_setKnobs(ipKnobs);
mapellil 20:b97e14ade434 167
mapellil 20:b97e14ade434 168 MotionFX_enable_6X(MFX_ENGINE_DISABLE);
mapellil 20:b97e14ade434 169 MotionFX_enable_9X(MFX_ENGINE_DISABLE);
mapellil 20:b97e14ade434 170 }
mapellil 20:b97e14ade434 171
mapellil 20:b97e14ade434 172
mapellil 20:b97e14ade434 173 /**
mapellil 20:b97e14ade434 174 * @brief Run sensor fusion algorithm
mapellil 20:b97e14ade434 175 * @param None
mapellil 20:b97e14ade434 176 * @retval None
mapellil 20:b97e14ade434 177 */
mapellil 20:b97e14ade434 178 void MotionFX_manager_run(MFX_input_t *data_in, MFX_output_t *data_out, float delta_time)
mapellil 20:b97e14ade434 179 {
mapellil 20:b97e14ade434 180 if(discardedCount == sampleToDiscard)
mapellil 20:b97e14ade434 181 {
mapellil 20:b97e14ade434 182 MotionFX_propagate(data_out, data_in, delta_time);
mapellil 20:b97e14ade434 183 MotionFX_update(data_out, data_in, delta_time, NULL);
mapellil 20:b97e14ade434 184 }
mapellil 20:b97e14ade434 185 else
mapellil 20:b97e14ade434 186 {
mapellil 0:e93a11b4e044 187 discardedCount++;
mapellil 0:e93a11b4e044 188 }
mapellil 0:e93a11b4e044 189 }
mapellil 0:e93a11b4e044 190
mapellil 0:e93a11b4e044 191
mapellil 0:e93a11b4e044 192 /**
mapellil 20:b97e14ade434 193 * @brief Start 6 axes MotionFX engine
mapellil 20:b97e14ade434 194 * @param None
mapellil 20:b97e14ade434 195 * @retval None
mapellil 20:b97e14ade434 196 */
mapellil 20:b97e14ade434 197 void MotionFX_manager_start_6X(void)
mapellil 0:e93a11b4e044 198 {
mapellil 20:b97e14ade434 199 MotionFX_enable_6X(MFX_ENGINE_ENABLE);
mapellil 20:b97e14ade434 200 }
mapellil 0:e93a11b4e044 201
mapellil 20:b97e14ade434 202
mapellil 20:b97e14ade434 203 /**
mapellil 20:b97e14ade434 204 * @brief Stop 6 axes MotionFX engine
mapellil 20:b97e14ade434 205 * @param None
mapellil 20:b97e14ade434 206 * @retval None
mapellil 20:b97e14ade434 207 */
mapellil 20:b97e14ade434 208 void MotionFX_manager_stop_6X(void)
mapellil 20:b97e14ade434 209 {
mapellil 20:b97e14ade434 210 MotionFX_enable_6X(MFX_ENGINE_DISABLE);
mapellil 0:e93a11b4e044 211 }
mapellil 0:e93a11b4e044 212
mapellil 20:b97e14ade434 213
mapellil 0:e93a11b4e044 214 /**
mapellil 20:b97e14ade434 215 * @brief Start 9 axes MotionFX engine
mapellil 20:b97e14ade434 216 * @param None
mapellil 20:b97e14ade434 217 * @retval None
mapellil 20:b97e14ade434 218 */
mapellil 20:b97e14ade434 219 void MotionFX_manager_start_9X(void)
mapellil 20:b97e14ade434 220 {
mapellil 20:b97e14ade434 221 MotionFX_enable_9X(MFX_ENGINE_ENABLE);
mapellil 20:b97e14ade434 222 }
mapellil 20:b97e14ade434 223
mapellil 20:b97e14ade434 224
mapellil 20:b97e14ade434 225 /**
mapellil 20:b97e14ade434 226 * @brief Stop 9 axes MotionFX engine
mapellil 20:b97e14ade434 227 * @param None
mapellil 20:b97e14ade434 228 * @retval None
mapellil 20:b97e14ade434 229 */
mapellil 20:b97e14ade434 230 void MotionFX_manager_stop_9X(void)
mapellil 20:b97e14ade434 231 {
mapellil 20:b97e14ade434 232 MotionFX_enable_9X(MFX_ENGINE_DISABLE);
mapellil 20:b97e14ade434 233 }
mapellil 20:b97e14ade434 234
mapellil 20:b97e14ade434 235
mapellil 20:b97e14ade434 236 /**
mapellil 20:b97e14ade434 237 * @brief Run magnetometer calibration algorithm
mapellil 20:b97e14ade434 238 * @param None
mapellil 20:b97e14ade434 239 * @retval None
mapellil 20:b97e14ade434 240 */
mapellil 20:b97e14ade434 241 void MotionFX_manager_MagCal_run(MFX_MagCal_input_t *data_in, MFX_MagCal_output_t *data_out)
mapellil 20:b97e14ade434 242 {
mapellil 20:b97e14ade434 243 MotionFX_MagCal_run(data_in);
mapellil 20:b97e14ade434 244 MotionFX_MagCal_getParams(data_out);
mapellil 0:e93a11b4e044 245 }
mapellil 0:e93a11b4e044 246
mapellil 0:e93a11b4e044 247
mapellil 0:e93a11b4e044 248 /**
mapellil 20:b97e14ade434 249 * @brief Start magnetometer calibration
mapellil 20:b97e14ade434 250 * @param None
mapellil 20:b97e14ade434 251 * @retval None
mapellil 20:b97e14ade434 252 */
mapellil 20:b97e14ade434 253 void MotionFX_manager_MagCal_start(int sampletime)
mapellil 0:e93a11b4e044 254 {
mapellil 20:b97e14ade434 255 MotionFX_MagCal_init(sampletime, 1);
mapellil 0:e93a11b4e044 256 }
mapellil 0:e93a11b4e044 257
mapellil 0:e93a11b4e044 258
mapellil 0:e93a11b4e044 259 /**
mapellil 20:b97e14ade434 260 * @brief Stop magnetometer calibration
mapellil 20:b97e14ade434 261 * @param None
mapellil 20:b97e14ade434 262 * @retval None
mapellil 20:b97e14ade434 263 */
mapellil 20:b97e14ade434 264 void MotionFX_manager_MagCal_stop(int sampletime)
mapellil 0:e93a11b4e044 265 {
mapellil 20:b97e14ade434 266 MotionFX_MagCal_init(sampletime, 0);
mapellil 0:e93a11b4e044 267 }
mapellil 0:e93a11b4e044 268
mapellil 0:e93a11b4e044 269
mapellil 0:e93a11b4e044 270 /**
mapellil 20:b97e14ade434 271 * @brief Load calibration parameter from memory
mapellil 20:b97e14ade434 272 * @param dataSize length ot the data
mapellil 20:b97e14ade434 273 * @param data pointer to the data
mapellil 20:b97e14ade434 274 * @retval (1) fail, (0) success
mapellil 20:b97e14ade434 275 */
mapellil 20:b97e14ade434 276 char MotionFX_LoadMagCalFromNVM(unsigned short int dataSize, unsigned int *data)
mapellil 0:e93a11b4e044 277 {
mapellil 20:b97e14ade434 278 #if (defined (MOTION_FX_STORE_CALIB_FLASH))
mapellil 20:b97e14ade434 279 RecallCalibrationFromMemory(dataSize / 4, (uint32_t*) data);
mapellil 20:b97e14ade434 280 return 0;
mapellil 20:b97e14ade434 281 #else
mapellil 20:b97e14ade434 282 return 1;
mapellil 20:b97e14ade434 283 #endif
mapellil 0:e93a11b4e044 284 }
mapellil 0:e93a11b4e044 285
mapellil 20:b97e14ade434 286
mapellil 20:b97e14ade434 287 /**
mapellil 20:b97e14ade434 288 * @brief Save calibration parameter to memory
mapellil 20:b97e14ade434 289 * @param dataSize length ot the data
mapellil 20:b97e14ade434 290 * @param data pointer to the data
mapellil 20:b97e14ade434 291 * @retval (1) fail, (0) success
mapellil 20:b97e14ade434 292 */
mapellil 20:b97e14ade434 293 char MotionFX_SaveMagCalInNVM(unsigned short int dataSize, unsigned int *data)
mapellil 0:e93a11b4e044 294 {
mapellil 20:b97e14ade434 295 #if (defined (MOTION_FX_STORE_CALIB_FLASH))
mapellil 20:b97e14ade434 296 SaveCalibrationToMemory(dataSize / 4, (uint32_t*) data);
mapellil 20:b97e14ade434 297 return 0;
mapellil 20:b97e14ade434 298 #else
mapellil 20:b97e14ade434 299 return 1;
mapellil 20:b97e14ade434 300 #endif
mapellil 0:e93a11b4e044 301 }
mapellil 0:e93a11b4e044 302
mapellil 20:b97e14ade434 303 /**
mapellil 20:b97e14ade434 304 * @}
mapellil 20:b97e14ade434 305 */
mapellil 0:e93a11b4e044 306
mapellil 20:b97e14ade434 307 /**
mapellil 20:b97e14ade434 308 * @}
mapellil 20:b97e14ade434 309 */
mapellil 0:e93a11b4e044 310
mapellil 20:b97e14ade434 311 /**
mapellil 20:b97e14ade434 312 * @}
mapellil 20:b97e14ade434 313 */
mapellil 20:b97e14ade434 314 #endif
mapellil 20:b97e14ade434 315 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/