Skip to content

Commit

Permalink
fixing bug in defmt, deriving bitfild defmt did not work so is done m…
Browse files Browse the repository at this point in the history
…anually
  • Loading branch information
Michael Aebli committed Jan 28, 2025
1 parent 16adc61 commit ab574fc
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "m-bus-parser"
version = "0.0.21"
version = "0.0.22"
edition = "2021"
description = "A library for parsing M-Bus frames"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ keywords = ["m-bus", "parser", "parse", "cli"]


[dependencies]
m-bus-parser = { path = "..", version = "0.0.21", features = ["std", "serde"] }
m-bus-parser = { path = "..", version = "0.0.22", features = ["std", "serde"] }
clap = { version = "4.5.4", features = ["derive"] }
2 changes: 1 addition & 1 deletion examples/cortex-m/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cortex-m = "0.7.7"
cortex-m-rt = "0.7.3"
cortex-m-semihosting = "0.5.0"
panic-halt = "0.2.0"
m-bus-parser = { path = "../../", version = "0.0.21" }
m-bus-parser = { path = "../../", version = "0.0.22" }
# Uncomment for the panic example.
# panic-itm = "0.4.1"

Expand Down
2 changes: 1 addition & 1 deletion python/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage = "https://maebli.github.io/"
repository = "https://github.com/maebli/m-bus-parser"

[dependencies]
m-bus-parser = { path = "..", version = "0.0.21", features = ["std", "serde"] }
m-bus-parser = { path = "..", version = "0.0.22", features = ["std", "serde"] }
serde_json = "1.0"
pyo3 = { version = "0.23.1", features = ["extension-module","generate-import-lib"] }
hex = "0.4.2"
Expand Down
9 changes: 8 additions & 1 deletion src/user_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ bitflags::bitflags! {
#[repr(transparent)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub struct StatusField: u8 {
const COUNTER_BINARY_SIGNED = 0b0000_0001;
const COUNTER_FIXED_DATE = 0b0000_0010;
Expand All @@ -92,6 +91,14 @@ bitflags::bitflags! {
}
}

#[cfg(feature = "defmt")]
impl defmt::Format for StatusField {
fn format(&self, f: defmt::Formatter) {
defmt::write!(f, "{:?}", self);
}
}


#[cfg(feature = "std")]
impl fmt::Display for StatusField {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
Expand Down

0 comments on commit ab574fc

Please sign in to comment.