diff --git a/Cargo.toml b/Cargo.toml index 963767a..bdd19c9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,6 +17,7 @@ rust-version = "1.65" default = [] defmt-03 = ["dep:defmt"] +serde = ["dep:serde"] nightly = ["dep:embedded-hal-async"] config-builder = ["dep:typed-builder"] @@ -26,6 +27,7 @@ embedded-hal = "0.2" embedded-hal-async = { version = "1.0.0-rc.3", optional = true } defmt = { version = "0.3", optional = true } +serde = { version = "1", default-features = false, features = ["derive"], optional = true } num-traits = { version = "0.2", default-features = false, features = ["libm"] } diff --git a/src/lib.rs b/src/lib.rs index aefa3cb..99ed73b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -459,6 +459,8 @@ impl Status { /// Sensor data #[derive(Debug, Copy, Clone)] #[cfg_attr(feature = "defmt-03", derive(defmt::Format))] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +/// Sensor data pub struct SensorData { ///The measured pressure: Pascals (Pa) pub pressure: f64,