Files
projekt1/mqtt_display/src/contracts.rs
2026-01-10 16:55:02 +01:00

36 lines
1.0 KiB
Rust

// src/contracts.rs
//! Cross-feature message contracts.
//!
//! This is the ONLY coupling point between features.
//! Features depend on these types, not on each other.
use heapless::String as HString;
/// IMU sensor reading from MPU6050
#[derive(Clone, Copy, Default, Debug)]
pub struct ImuReading {
/// Acceleration in g (earth gravity units)
pub accel_g: [f32; 3],
/// Angular velocity in degrees per second
pub gyro_dps: [f32; 3],
/// Temperature in Celsius
pub temp_c: f32,
/// Timestamp in milliseconds since boot
pub timestamp_ms: u64,
}
/// Commands that can be sent to the display actor
#[derive(Clone, Debug)]
pub enum DisplayCommand {
/// Show IMU sensor data
SetImu(ImuReading),
/// Show a status line (max 32 chars)
SetStatus(HString<32>),
/// Show an error message (max 64 chars)
ShowError(HString<64>),
/// Show MQTT connection status
SetMqttStatus { connected: bool, msg_count: u32 },
/// Clear the display to default state
Clear,
}