imu_utils.h
Generated from imu_utils.h in platform-idf. Edit the header’s doxygen comments to change this page.
Utility functions for IMU data processing.
Functions
Section titled “Functions”bsp_imu_get_accel_magnitude
Section titled “bsp_imu_get_accel_magnitude”static inline float bsp_imu_get_accel_magnitude(const bsp_imu_data_t *data)Calculate total acceleration magnitude.
Parameters
data— Pointer to IMU data structure
Returns
Total acceleration magnitude in g
Declared in imu_utils.h:27.
bsp_imu_get_gyro_magnitude
Section titled “bsp_imu_get_gyro_magnitude”static inline float bsp_imu_get_gyro_magnitude(const bsp_imu_data_t *data)Calculate total gyroscope magnitude.
Parameters
data— Pointer to IMU data structure
Returns
Total gyroscope magnitude in dps
Declared in imu_utils.h:40.
bsp_imu_get_pitch
Section titled “bsp_imu_get_pitch”static inline float bsp_imu_get_pitch(const bsp_imu_data_t *data)Calculate pitch angle from accelerometer data.
Parameters
data— Pointer to IMU data structure
Returns
Pitch angle in degrees
Declared in imu_utils.h:53.
bsp_imu_get_roll
Section titled “bsp_imu_get_roll”static inline float bsp_imu_get_roll(const bsp_imu_data_t *data)Calculate roll angle from accelerometer data.
Parameters
data— Pointer to IMU data structure
Returns
Roll angle in degrees
Declared in imu_utils.h:65.
bsp_imu_is_free_fall
Section titled “bsp_imu_is_free_fall”static inline bool bsp_imu_is_free_fall(const bsp_imu_data_t *data, float threshold)Detect if device is in free fall.
Parameters
data— Pointer to IMU data structurethreshold— Free fall threshold in g (typically 0.3 - 0.5)
Returns
true if in free fall, false otherwise
Declared in imu_utils.h:77.
bsp_imu_is_shaking
Section titled “bsp_imu_is_shaking”static inline bool bsp_imu_is_shaking(const bsp_imu_data_t *data, float threshold)Detect if device is being shaken.
Parameters
data— Pointer to IMU data structurethreshold— Shake threshold in dps (typically 100 - 200)
Returns
true if being shaken, false otherwise
Declared in imu_utils.h:90.
bsp_imu_get_orientation
Section titled “bsp_imu_get_orientation”static inline bsp_imu_orientation_t bsp_imu_get_orientation(const bsp_imu_data_t *data)Get device orientation.
Parameters
data— Pointer to IMU data structure
Returns
Device orientation
Declared in imu_utils.h:115.
bsp_imu_orientation_t
Section titled “bsp_imu_orientation_t”Detect device orientation.
| Value | Value | Description |
|---|---|---|
BSP_IMU_ORIENTATION_UNKNOWN | 0 | |
BSP_IMU_ORIENTATION_FACE_UP | Display facing up. | |
BSP_IMU_ORIENTATION_FACE_DOWN | Display facing down. | |
BSP_IMU_ORIENTATION_UPRIGHT | Standing upright. | |
BSP_IMU_ORIENTATION_UPSIDE_DOWN | Upside down. | |
BSP_IMU_ORIENTATION_LEFT_SIDE | On left side. | |
BSP_IMU_ORIENTATION_RIGHT_SIDE | On right side. |
Declared in imu_utils.h:99.