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 <hyblmatous@gmail.com>
This commit is contained in:
commit
84cffc751a
4 changed files with 7 additions and 3 deletions
|
@ -15,4 +15,6 @@ embedded-hal-1 = { package = "embedded-hal", version = "1.0.0-alpha.8" }
|
||||||
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true }
|
embedded-hal-async = { version = "0.1.0-alpha.1", optional = true }
|
||||||
embedded-storage = "0.3.0"
|
embedded-storage = "0.3.0"
|
||||||
embedded-storage-async = { version = "0.3.0", optional = true }
|
embedded-storage-async = { version = "0.3.0", optional = true }
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
|
|
||||||
|
defmt = { version = "0.3", optional = true }
|
||||||
|
|
|
@ -10,6 +10,7 @@ pub mod blocking;
|
||||||
|
|
||||||
/// Error returned by I2C device implementations in this crate.
|
/// Error returned by I2C device implementations in this crate.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum I2cDeviceError<BUS> {
|
pub enum I2cDeviceError<BUS> {
|
||||||
/// An operation on the inner I2C bus failed.
|
/// An operation on the inner I2C bus failed.
|
||||||
I2c(BUS),
|
I2c(BUS),
|
||||||
|
@ -28,6 +29,7 @@ where
|
||||||
|
|
||||||
/// Error returned by SPI device implementations in this crate.
|
/// Error returned by SPI device implementations in this crate.
|
||||||
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
#[derive(Copy, Clone, Eq, PartialEq, Debug)]
|
||||||
|
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
|
||||||
pub enum SpiDeviceError<BUS, CS> {
|
pub enum SpiDeviceError<BUS, CS> {
|
||||||
/// An operation on the inner SPI bus failed.
|
/// An operation on the inner SPI bus failed.
|
||||||
Spi(BUS),
|
Spi(BUS),
|
||||||
|
|
|
@ -18,7 +18,7 @@ flavors = [
|
||||||
|
|
||||||
time = ["embassy/time"]
|
time = ["embassy/time"]
|
||||||
|
|
||||||
defmt = ["dep:defmt", "embassy/defmt", "embassy-usb?/defmt", "embedded-io?/defmt"]
|
defmt = ["dep:defmt", "embassy/defmt", "embassy-usb?/defmt", "embedded-io?/defmt", "embassy-embedded-hal/defmt"]
|
||||||
|
|
||||||
# Enable nightly-only features
|
# Enable nightly-only features
|
||||||
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"]
|
nightly = ["embassy/nightly", "embedded-hal-1", "embedded-hal-async", "embassy-usb", "embedded-storage-async", "dep:embedded-io", "embassy-embedded-hal/nightly"]
|
||||||
|
|
|
@ -72,7 +72,7 @@ quote = "1.0.15"
|
||||||
stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]}
|
stm32-metapac = { version = "0.1.0", path = "../stm32-metapac", default-features = false, features = ["metadata"]}
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"]
|
defmt = ["dep:defmt", "bxcan/unstable-defmt", "embassy/defmt", "embassy-embedded-hal/defmt", "embedded-io?/defmt", "embassy-usb?/defmt"]
|
||||||
sdmmc-rs = ["embedded-sdmmc"]
|
sdmmc-rs = ["embedded-sdmmc"]
|
||||||
net = ["embassy-net" ]
|
net = ["embassy-net" ]
|
||||||
memory-x = ["stm32-metapac/memory-x"]
|
memory-x = ["stm32-metapac/memory-x"]
|
||||||
|
|
Loading…
Reference in a new issue