diff --git a/hal/CHANGELOG.md b/hal/CHANGELOG.md index dbee9c919c66..d6d686cc7297 100644 --- a/hal/CHANGELOG.md +++ b/hal/CHANGELOG.md @@ -1,5 +1,6 @@ # Unreleased Changes +- Implement `Debug, Clone, Copy, Eq, PartialEq` for all HAL error types (#691). - Replace homebrew time library with `fugit` (#672) - Add `defmt` feature and derive `defmt::Format` for error types (#684, obsoletes #522). - Add `mcan` integration (#654) diff --git a/hal/src/dmac/mod.rs b/hal/src/dmac/mod.rs index 77570e03c30a..43d2377f2046 100644 --- a/hal/src/dmac/mod.rs +++ b/hal/src/dmac/mod.rs @@ -257,7 +257,7 @@ pub use channel::*; pub use dma_controller::*; pub use transfer::*; -#[derive(Debug)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] /// Runtime errors that may occur when dealing with DMA transfers. pub enum Error { diff --git a/hal/src/sercom/i2c/flags.rs b/hal/src/sercom/i2c/flags.rs index 279b3bfbdf94..4ee40561afbf 100644 --- a/hal/src/sercom/i2c/flags.rs +++ b/hal/src/sercom/i2c/flags.rs @@ -73,7 +73,7 @@ impl Status { } /// Errors available for I2C transactions -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { BusError, diff --git a/hal/src/sercom/spi.rs b/hal/src/sercom/spi.rs index 4601f173c309..1aff6b95b1ff 100644 --- a/hal/src/sercom/spi.rs +++ b/hal/src/sercom/spi.rs @@ -442,7 +442,7 @@ impl TryFrom for () { /// /// The SPI peripheral only has two error types, buffer overflow and transaction /// length error. -#[derive(Debug)] +#[derive(Clone, Copy, Debug, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { Overflow, diff --git a/hal/src/sercom/uart/flags.rs b/hal/src/sercom/uart/flags.rs index 992d5c9ed05b..dc6de64c590d 100644 --- a/hal/src/sercom/uart/flags.rs +++ b/hal/src/sercom/uart/flags.rs @@ -76,7 +76,7 @@ bitflags! { //============================================================================= /// Errors available for UART transactions -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// Detected a parity error diff --git a/hal/src/thumbv7em/dsu.rs b/hal/src/thumbv7em/dsu.rs index bba71892b488..a9ea93381c42 100644 --- a/hal/src/thumbv7em/dsu.rs +++ b/hal/src/thumbv7em/dsu.rs @@ -14,7 +14,7 @@ pub struct Dsu { } /// Errors from hardware -#[derive(Debug)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum PeripheralError { /// Usually misaligned address of length @@ -22,7 +22,7 @@ pub enum PeripheralError { } /// Error from within the DSU -#[derive(Debug)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// Address or length was not word aligned diff --git a/hal/src/thumbv7em/nvm.rs b/hal/src/thumbv7em/nvm.rs index 59839366fa70..9490441d420e 100644 --- a/hal/src/thumbv7em/nvm.rs +++ b/hal/src/thumbv7em/nvm.rs @@ -78,7 +78,7 @@ pub struct Nvm { } /// Errors generated by the NVM peripheral -#[derive(Debug)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum PeripheralError { /// NVM error @@ -97,7 +97,7 @@ pub enum PeripheralError { /// Driver errors #[non_exhaustive] -#[derive(Debug)] +#[derive(Debug, Clone, Copy, Eq, PartialEq)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] pub enum Error { /// Address range outside of flash