working everything properly well
This commit is contained in:
35
mqtt_display/src/contracts.rs
Normal file
35
mqtt_display/src/contracts.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
// 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,
|
||||
}
|
||||
Reference in New Issue
Block a user