2.2.2 MotionAD APIs
The MotionAD library APIs are:
• uint8_t MotionAD_GetLibVersion(char *version)
– retrieves the library version
– *version is a pointer to an array of 35 characters
– returns the number of characters in the version string
• void MotionAD_Initialize(int xl_odr)
– performs MotionAD 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
– xl_odr is an accelerometer ODR in Hz (nearest int)
• void MotionAD_Update(MAD_input_t *data_in, MAD_output_t *data_out)
– executes airplane detection algorithm
– *data_in parameter is a pointer to a structure with input data
– the parameters for the structure type MAD_input_t are:
◦ Acc[3] is the array of accelerometer sensor values in X, Y, Z axes in g (float)
◦ Press is the pressure sensor value in Pa (unsigned int)
◦ Temp is the temperature sensor value in °C (float)
◦ *data_out parameter is a pointer to an enum with the following values:
• MAD_ONLAND = 0
• MAD_TAKEOFF = 1
• MAD_LANDING = 2
UM2722
MotionAD middleware library for X-CUBE-MEMS1 software expansion for STM32Cube
UM2722 - Rev 2
page 4/15