EasyManua.ls Logo

ST X-CUBE-MEMS1 - 2.2.4 Demo code; 2.2.5 Algorithm performance

ST X-CUBE-MEMS1
15 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
2.2.4 Demo code
The following demonstration code reads data from the accelerometer, temperature and pressure sensors and
detects the airplane mode code.
[…]
#define VERSION_STR_LENG 35
#define ALGO_FREQ 100
[…]
/*** Initialization ***/
char lib_version[VERSION_STR_LENG];
/* Airplane Detection API initialization function */
MotionAD_Initialize(ALGO_FREQ);
/* Optional: Get version */
MotionAD_GetLibVersion(lib_version);
[…]
/*** Using Airplane Detection algorithm ***/
Timer_OR_DataRate_Interrupt_Handler()
{
MAD_input_t data_in;
MAD_output_t data_out;
/* Get acceleration X/Y/Z in g */
MEMS_Read_AccValue(&data_in.Acc[0], &data_in.Acc[1], &data_in.Acc[2]);
/* Get presure in Pa */
MEMS_Read_PressValue(&data_in.Press);
/* Get temperature in °C */
MEMS_Read_TempValue(&data_in.Temp);
/* Airplane Detection algorithm update */
MotionAD_Update(&data_in, &data_out);
}
2.2.5 Algorithm performance
Table 2. Cortex-M4 and Cortex-M3: elapsed time (µs) algorithm
Cortex-M4 STM32F401RE at 84 MHz
Cortex-M3 STM32L152RE at 32 MHz
Min Avg Max Min Avg Max
4 24 95 36 110 371
UM2722
MotionAD middleware library for X-CUBE-MEMS1 software expansion for STM32Cube
UM2722 - Rev 2
page 6/15

Other manuals for ST X-CUBE-MEMS1

Related product manuals