Skip to content

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.

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.

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.

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.

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.

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 structure
  • threshold — Free fall threshold in g (typically 0.3 - 0.5)

Returns

true if in free fall, false otherwise

Declared in imu_utils.h:77.

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 structure
  • threshold — Shake threshold in dps (typically 100 - 200)

Returns

true if being shaken, false otherwise

Declared in imu_utils.h:90.

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.

Detect device orientation.

ValueValueDescription
BSP_IMU_ORIENTATION_UNKNOWN0
BSP_IMU_ORIENTATION_FACE_UPDisplay facing up.
BSP_IMU_ORIENTATION_FACE_DOWNDisplay facing down.
BSP_IMU_ORIENTATION_UPRIGHTStanding upright.
BSP_IMU_ORIENTATION_UPSIDE_DOWNUpside down.
BSP_IMU_ORIENTATION_LEFT_SIDEOn left side.
BSP_IMU_ORIENTATION_RIGHT_SIDEOn right side.

Declared in imu_utils.h:99.