– void MotionFX_propagate(MFX_output_t *data_out, MFX_input_t *data_in, float
*eml_deltatime)
◦
runs the Kalman filter propagate
◦ *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]
– void MotionFX_MagCal_init(int sampletime, unsigned short int enable)
◦ initializes the magnetometer calibration library
◦ sampletime parameter is a period in milliseconds [ms] between the update function calls
◦ enable parameter is to enable (1) or disable (0) library
– void MotionFX_MagCal_run(MFX_MagCal_input_t *data_in)
◦ runs the magnetometer calibration algorithm
◦ *data_in parameter is a pointer to input data structure
◦ the parameters for the structure type MFX_MagCal_input_t are:
• mag is uncalibrated magnetometer data [µT]/50
• time_stamp is the timestamp [ms]
– void MotionFX_MagCal_getParams(MFX_MagCal_output_t *data_out)
◦ gets magnetometer calibration parameters
◦ *data_out parameter is a pointer to output data structure
◦ the parameters for the structure type MFX_MagCal_output_t are:
• hi_bias is the hard iron offset array [µT]/50
• cal_quality is the calibration quality factor:
• MFX_MAGCALUNKNOWN = 0; accuracy of the calibration parameters is unknown
• MFX_MAGCALPOOR = 1; accuracy of the calibration parameters is poor, cannot be
trusted
• MFX_MAGCALOK = 2; accuracy of the calibration parameters is OK
• MFX_MAGCALGOOD = 3; accuracy of the calibration parameters is good
Storing and loading magnetometer calibration parameters
The following functions have to be implemented specifically for each target platform:
– char MotionFX_LoadMagCalFromNVM(unsigned short int dataSize, unsigned int
*data)
◦ the function is used to retrieve the calibration parameters from storage, the function is called
when magnetometer calibration library is enabled
◦ dataSize is the size of the data in bytes
◦ *data is the data location pointer
◦ returns 0 for correct loading, 1 otherwise
– char MotionFX_SaveMagCalInNVM(unsigned short int dataSize, unsigned int
*data)
◦ the function is used to store the calibration parameters and is called when the magnetometer
calibration library is disabled
◦ dataSize is the size of the data in bytes
◦ *data is the data location pointer
◦ returns 0 for correct saving, 1 otherwise
UM2220
MotionFX library
UM2220 - Rev 7
page 9/24