From 38692dfcb96770a176d68cdf07ef81bcded362ab Mon Sep 17 00:00:00 2001 From: Wilfried Chauveau Date: Mon, 9 May 2022 10:22:41 +0100 Subject: [PATCH] Add defmt feature (as optional dep) and allow i2c::Error to be formatted (#328) --- rp2040-hal/Cargo.toml | 2 ++ rp2040-hal/src/i2c.rs | 1 + 2 files changed, 3 insertions(+) diff --git a/rp2040-hal/Cargo.toml b/rp2040-hal/Cargo.toml index 6ea6523..7b29844 100644 --- a/rp2040-hal/Cargo.toml +++ b/rp2040-hal/Cargo.toml @@ -30,6 +30,8 @@ critical-section = { version = "0.2.4", features = ["custom-impl"] } futures = { version = "0.3", default-features = false, optional = true } chrono = { version = "0.4", default-features = false, optional = true } +defmt = { version = ">=0.2.0, <0.4", optional = true } + [dev-dependencies] cortex-m-rt = "0.7" panic-halt = "0.2.0" diff --git a/rp2040-hal/src/i2c.rs b/rp2040-hal/src/i2c.rs index 463f287..6ceefe2 100644 --- a/rp2040-hal/src/i2c.rs +++ b/rp2040-hal/src/i2c.rs @@ -66,6 +66,7 @@ pub mod peripheral; /// I2C error #[non_exhaustive] #[derive(Debug)] +#[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// I2C abort with error Abort(u32),