aboutsummaryrefslogtreecommitdiff
path: root/embassy-embedded-hal
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2022-07-24 20:15:57 +0000
committerGitHub <[email protected]>2022-07-24 20:15:57 +0000
commit84cffc751ac0a38e6736959e68d441b99138d6d0 (patch)
tree486876e123cc27526c5eb92e38146514a5605a3b /embassy-embedded-hal
parent6b8cd6fbb3e4dd23750550c50b301ebba70c443a (diff)
parentc38755c5b737edbc88753c154feff93a5ced2a38 (diff)
Merge #876
876: Add defmt support to embassy-embedded-hal errors r=Dirbaio a=matoushybl `defmt::unwrap!()` should now work with shared buses. I tested it only with I2C as I don't have SPI in the target project. Co-authored-by: Matous Hybl <[email protected]>
Diffstat (limited to 'embassy-embedded-hal')
-rw-r--r--embassy-embedded-hal/Cargo.toml4
-rw-r--r--embassy-embedded-hal/src/shared_bus/mod.rs2
2 files changed, 5 insertions, 1 deletions
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index d2606d264..455786be9 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -15,4 +15,6 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
15embedded-hal-async = { version = "0.1.0-alpha.1", optional = true } 15embedded-hal-async = { version = "0.1.0-alpha.1", optional = true }
16embedded-storage = "0.3.0" 16embedded-storage = "0.3.0"
17embedded-storage-async = { version = "0.3.0", optional = true } 17embedded-storage-async = { version = "0.3.0", optional = true }
18nb = "1.0.0" \ No newline at end of file 18nb = "1.0.0"
19
20defmt = { version = "0.3", optional = true }
diff --git a/embassy-embedded-hal/src/shared_bus/mod.rs b/embassy-embedded-hal/src/shared_bus/mod.rs
index 76ee413d9..617d921e9 100644
--- a/embassy-embedded-hal/src/shared_bus/mod.rs
+++ b/embassy-embedded-hal/src/shared_bus/mod.rs
@@ -10,6 +10,7 @@ pub mod blocking;
10 10
11/// Error returned by I2C device implementations in this crate. 11/// Error returned by I2C device implementations in this crate.
12#[derive(Copy, Clone, Eq, PartialEq, Debug)] 12#[derive(Copy, Clone, Eq, PartialEq, Debug)]
13#[cfg_attr(feature = "defmt", derive(defmt::Format))]
13pub enum I2cDeviceError<BUS> { 14pub enum I2cDeviceError<BUS> {
14 /// An operation on the inner I2C bus failed. 15 /// An operation on the inner I2C bus failed.
15 I2c(BUS), 16 I2c(BUS),
@@ -28,6 +29,7 @@ where
28 29
29/// Error returned by SPI device implementations in this crate. 30/// Error returned by SPI device implementations in this crate.
30#[derive(Copy, Clone, Eq, PartialEq, Debug)] 31#[derive(Copy, Clone, Eq, PartialEq, Debug)]
32#[cfg_attr(feature = "defmt", derive(defmt::Format))]
31pub enum SpiDeviceError<BUS, CS> { 33pub enum SpiDeviceError<BUS, CS> {
32 /// An operation on the inner SPI bus failed. 34 /// An operation on the inner SPI bus failed.
33 Spi(BUS), 35 Spi(BUS),