Skip to content

IImu

#include "crosspad/platform/IImu.hpp"

Generated from crosspad/platform/IImu.hpp in crosspad-core. Edit the header’s doxygen comments to change this page.

Recipes that use it: Motion and vibration

IImu & getImu()

Platform-injected singleton (same pattern as getClock())

Used in Motion and vibration.

Declared in crosspad/platform/IImu.hpp:68.

Portable IMU data snapshot.

Read-only struct returned by IImu::getData().

Used in Motion and vibration.

FieldTypeDescription
accel_xfloatAcceleration X-axis (g)
accel_yfloatAcceleration Y-axis (g)
accel_zfloatAcceleration Z-axis (g)
gyro_xfloatGyroscope X-axis (dps)
gyro_yfloatGyroscope Y-axis (dps)
gyro_zfloatGyroscope Z-axis (dps)
temperaturefloatTemperature (Celsius)
pitchfloatFused pitch angle (degrees), Kalman-filtered where available.
rollfloatFused roll angle (degrees), Kalman-filtered where available.

Declared in crosspad/platform/IImu.hpp:11.

Coarse device orientation derived from accelerometer.

Used in Motion and vibration.

ValueValueDescription
FaceUp
FaceDown
LandscapeLeft
LandscapeRight
PortraitUp
PortraitDown
Unknown

Declared in crosspad/platform/IImu.hpp:26.

Abstract IMU interface for portable motion data access.

On the firmware it wraps the BSP IMU driver (bsp_imu_*, with a Kalman filter).

The interface does NOT manage initialization or background tasks — those remain in the platform layer. This is read-only access to data that the platform’s IMU task produces.

Used in Motion and vibration.

Members

MemberDescription
isAvailableWhether IMU hardware is present and producing data.
getDataGet latest IMU data snapshot (thread-safe, returns cached data from background task)
getOrientationCoarse orientation derived from accelerometer.
isShakingDetect sudden shake (gyro magnitude above threshold)
isFreeFallDetect free-fall condition (acceleration near zero)

Methods

virtual bool isAvailable() const =0

Whether IMU hardware is present and producing data.

Used in Motion and vibration.

virtual bool getData(ImuData &out) const =0

Get latest IMU data snapshot (thread-safe, returns cached data from background task)

Used in Motion and vibration.

virtual Orientation getOrientation() const =0

Coarse orientation derived from accelerometer.

virtual bool isShaking() const =0

Detect sudden shake (gyro magnitude above threshold)

virtual bool isFreeFall() const =0

Detect free-fall condition (acceleration near zero)

Declared in crosspad/platform/IImu.hpp:47.