diff --git a/atat/Cargo.toml b/atat/Cargo.toml index 9b77ba58..dda22b27 100644 --- a/atat/Cargo.toml +++ b/atat/Cargo.toml @@ -23,6 +23,8 @@ nb = "^1" heapless = { version = "^0.7.0", features = ["serde"] } serde_at = { path = "../serde_at", version = "^0.13.1-alpha.0", optional = true } atat_derive = { path = "../atat_derive", version = "^0.13.1-alpha.0", optional = true } +serde_bytes = { version = "0.11.5", default-features = false, optional = true } +heapless-bytes = { version = "0.3.0", optional = true } bbqueue = "0.5" log = { version = "^0.4", default-features = false, optional = true } @@ -39,9 +41,11 @@ stm32l4xx-hal = { git = "https://github.com/MathiasKoch/stm32l4xx-hal", branch = ] } [features] -default = ["derive"] +default = ["derive", "bytes"] derive = ["atat_derive", "serde_at"] +bytes = ["heapless-bytes", "serde_bytes"] + std = ["serde_at/std"] defmt-default = ["defmt"] diff --git a/atat/src/derive.rs b/atat/src/derive.rs index 44388cb2..d0e0e504 100644 --- a/atat/src/derive.rs +++ b/atat/src/derive.rs @@ -8,6 +8,11 @@ pub trait AtatLen { const LEN: usize; } +#[cfg(feature = "bytes")] +impl AtatLen for heapless_bytes::Bytes { + const LEN: usize = N; +} + macro_rules! impl_length { ($type:ty, $len:expr) => { #[allow(clippy::use_self)] diff --git a/atat/src/lib.rs b/atat/src/lib.rs index 411ed4d9..aab2e949 100644 --- a/atat/src/lib.rs +++ b/atat/src/lib.rs @@ -245,6 +245,9 @@ pub use bbqueue; #[cfg(feature = "bytes")] pub use serde_bytes; +#[cfg(feature = "bytes")] +pub use heapless_bytes; + #[cfg(feature = "derive")] pub use atat_derive; #[cfg(feature = "derive")]