From f65cda6f3f696e2eaf4552bbec14c24655d86906 Mon Sep 17 00:00:00 2001 From: Lachezar Lechev Date: Wed, 27 Dec 2023 12:18:36 +0200 Subject: [PATCH] feat: serde features and derive for SensorData Signed-off-by: Lachezar Lechev --- Cargo.toml | 2 ++ src/lib.rs | 1 + 2 files changed, 3 insertions(+) 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