2.2.7 MotionFX APIs
The MotionFX APIs are:
• Cortex-M3, Cortex-M4 and Cortex-M7
– uint8_t MotionFX_GetLibVersion(char *version)
◦
retrieves the version of the library
◦ *version is a pointer to an array of 35 characters
◦ returns the number of characters in the version string
– void MotionFX_Initialize(void)
◦ performs MotionFX library initialization and setup of the internal mechanism.
◦ the CRC module in STM32 microcontroller (in RCC peripheral clock enable register) has to be
enabled before using the library
Note: This function must be called before using the sensor fusion library.
– voidMotionFX_setKnobs(MFX_knobs_t *knobs)
◦ sets the internal knobs
◦ *knobs parameter is a pointer to a structure with knobs
– void MotionFX_getKnobs(MFX_knobs_t *knobs)
◦ gets the current internal knobs
◦ *knobs parameter is a pointer to a structure with knobs
– MFX_engine_state_t MotionFX_getStatus_6X(void)
◦ gets the 6 axes library status
◦ returns 1 if enabled, 0 if disabled
– MFX_engine_state_t MotionFX_getStatus_9X(void)
◦ gets the 9 axes library status
◦ returns 1 if enabled, 0 if disabled
– void MotionFX_enable_6X(MFX_engine_state_t enable)
◦ enables or disables the 6 axes function (ACC + GYRO)
◦ enable parameter is 1 to enable, 0 to disable
– void MotionFX_enable_9X(MFX_engine_state_t enable)
◦ enables or disables the 9 axes function (ACC + GYRO+MAG)
◦ enable parameter is 1 to enable, 0 to disable
– void MotionFX_setGbias(float *gbias)
◦ sets the initial gbias
◦ *gbias parameter is a pointer to a float array containing the gyro bias value for each axis
– void MotionFX_getGbias(float *gbias)
◦ gets the initial gbias
◦ *gbias parameter is a pointer to a float array containing the gyro bias value for each axis
– void MotionFX_update(MFX_output_t *data_out, MFX_input_t *data_in, float
*eml_deltatime, float *eml_q_update)
◦ runs the Kalman filter update
◦ *data_out parameter is a pointer to output data structure
◦ *data_in parameter is a pointer to input data structure
◦ *eml_deltatime parameter is a pointer to delta time between two propagate calls [sec]
◦ *eml_q_update parameter is a pointer set to NULL
UM2220
MotionFX library
UM2220 - Rev 7
page 8/24