Skip to content

Commit

Permalink
Bring in defmt derive for error types
Browse files Browse the repository at this point in the history
  • Loading branch information
jbeaurivage committed Nov 3, 2022
1 parent b921d9c commit bf2dd1b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ version = "0.3"
default-features = false
version = "1.0"

[dependencies.defmt]
version = "0.3"
optional = true

[dependencies.embedded-hal-async]
version = "0.1.0-alpha.3"
optional = true
Expand Down Expand Up @@ -251,6 +255,7 @@ unproven = ["embedded-hal/unproven"]
use_rtt = ["jlink_rtt"]
usb = ["usb-device"]
dma = ["unproven"]
defmt = ["dep:defmt"]
max-channels = ["dma"]
sdmmc = ["embedded-sdmmc"]
rtic = ["rtic-monotonic", "fugit"]
Expand Down
1 change: 1 addition & 0 deletions hal/src/dmac/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ pub use dma_controller::*;
pub use transfer::*;

#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
/// Runtime errors that may occur when dealing with DMA transfers.
pub enum Error {
/// Supplied buffers both have lengths > 1 beat, but not equal to each other
Expand Down
1 change: 1 addition & 0 deletions hal/src/sercom/i2c/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ impl Status {

/// Errors available for I2C transactions
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
BusError,
ArbitrationLost,
Expand Down
1 change: 1 addition & 0 deletions hal/src/sercom/spi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ impl TryFrom<Status> for () {
/// The SPI peripheral only has two error types, buffer overflow and transaction
/// length error.
#[derive(Debug)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
Overflow,
LengthError,
Expand Down
1 change: 1 addition & 0 deletions hal/src/sercom/uart/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ bitflags! {

/// Errors available for UART transactions
#[derive(Debug, Clone, Copy)]
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum Error {
/// Detected a parity error
ParityError,
Expand Down

0 comments on commit bf2dd1b

Please sign in to comment.