Skip to content

Commit 7efa52e

Browse files
committed
feat: add defmt::Format for SensorError
1 parent 5996e40 commit 7efa52e

File tree

3 files changed

+119
-0
lines changed

3 files changed

+119
-0
lines changed

Cargo.lock

Lines changed: 116 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ keywords = ["embedded", "no-std", "dht11", "dht20", "dht22"]
1212
autoexamples = false
1313

1414
[dependencies]
15+
defmt = { version = "1.0.1", optional = true }
1516
embedded-hal = "1.0.0"
1617

1718
[dev-dependencies]
@@ -21,6 +22,7 @@ embedded-hal-mock = "0.11.1"
2122
dht11 = []
2223
dht20 = []
2324
dht22 = []
25+
defmt = ["dep:defmt"]
2426
default = []
2527

2628
[lib]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ pub struct SensorReading<T> {
2020

2121
/// Possible errors when interacting with the sensor.
2222
#[derive(Debug)]
23+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2324
pub enum SensorError {
2425
ChecksumMismatch,
2526
Timeout,

0 commit comments

Comments
 (0)