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
Functions
Section titled “Functions”getImu
Section titled “getImu”IImu & getImu()Platform-injected singleton (same pattern as getClock())
Used in Motion and vibration.
Declared in crosspad/platform/IImu.hpp:68.
crosspad::ImuData
Section titled “crosspad::ImuData”Portable IMU data snapshot.
Read-only struct returned by IImu::getData().
Used in Motion and vibration.
| Field | Type | Description |
|---|---|---|
accel_x | float | Acceleration X-axis (g) |
accel_y | float | Acceleration Y-axis (g) |
accel_z | float | Acceleration Z-axis (g) |
gyro_x | float | Gyroscope X-axis (dps) |
gyro_y | float | Gyroscope Y-axis (dps) |
gyro_z | float | Gyroscope Z-axis (dps) |
temperature | float | Temperature (Celsius) |
pitch | float | Fused pitch angle (degrees), Kalman-filtered where available. |
roll | float | Fused roll angle (degrees), Kalman-filtered where available. |
Declared in crosspad/platform/IImu.hpp:11.
Orientation
Section titled “Orientation”Coarse device orientation derived from accelerometer.
Used in Motion and vibration.
| Value | Value | Description |
|---|---|---|
FaceUp | ||
FaceDown | ||
LandscapeLeft | ||
LandscapeRight | ||
PortraitUp | ||
PortraitDown | ||
Unknown |
Declared in crosspad/platform/IImu.hpp:26.
crosspad::IImu
Section titled “crosspad::IImu”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
| Member | Description |
|---|---|
isAvailable | Whether IMU hardware is present and producing data. |
getData | Get latest IMU data snapshot (thread-safe, returns cached data from background task) |
getOrientation | Coarse orientation derived from accelerometer. |
isShaking | Detect sudden shake (gyro magnitude above threshold) |
isFreeFall | Detect free-fall condition (acceleration near zero) |
Methods
isAvailable
Section titled “isAvailable”virtual bool isAvailable() const =0Whether IMU hardware is present and producing data.
Used in Motion and vibration.
getData
Section titled “getData”virtual bool getData(ImuData &out) const =0Get latest IMU data snapshot (thread-safe, returns cached data from background task)
Used in Motion and vibration.
getOrientation
Section titled “getOrientation”virtual Orientation getOrientation() const =0Coarse orientation derived from accelerometer.
isShaking
Section titled “isShaking”virtual bool isShaking() const =0Detect sudden shake (gyro magnitude above threshold)
isFreeFall
Section titled “isFreeFall”virtual bool isFreeFall() const =0Detect free-fall condition (acceleration near zero)
Declared in crosspad/platform/IImu.hpp:47.