diff --git a/Cargo.toml b/Cargo.toml index 709ec83..1492f22 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -18,11 +18,13 @@ default = [] nightly = ["dep:embedded-hal-async"] defmt-03 = ["dep:defmt"] +serde = ["dep:serde"] [dependencies] 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"] } \ No newline at end of file diff --git a/src/lib.rs b/src/lib.rs index 3942455..f38bcd7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -530,6 +530,7 @@ pub enum OutputMode { #[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