Skip to content

Commit

Permalink
Implement defmt::Format for all error types
Browse files Browse the repository at this point in the history
Signed-off-by: Akhil Velagapudi <[email protected]>
  • Loading branch information
akhilles committed Nov 29, 2024
1 parent 044e8ee commit a4b1b93
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/clocks/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ cfg_if::cfg_if! {
// todo: Continue working through DRY between the clock modules.

/// Speed out of limits.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, defmt::Format)]
pub enum RccError {
Speed,
Hardware,
Expand Down
2 changes: 1 addition & 1 deletion src/crc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ impl Default for Polynomial {
}

/// Errors generated when trying to create invalid polynomials.
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, defmt::Format)]
pub enum PolynomialError {
/// Tried to create an even polynomial.
/// The hardware CRC unit only supports odd polynomials.
Expand Down
2 changes: 1 addition & 1 deletion src/flash/non_trustzone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Bank {
B2 = 1,
}

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, defmt::Format)]
/// Possible error states for flash operations.
pub enum Error {
/// Flash controller is not done yet
Expand Down
2 changes: 1 addition & 1 deletion src/flash/trustzone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Bank {
B2 = 1,
}

#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, defmt::Format)]
/// Possible error states for flash operations.
pub enum Error {
/// Flash controller is not done yet
Expand Down
2 changes: 1 addition & 1 deletion src/i2c.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ macro_rules! busy_wait {

/// I2C error
#[non_exhaustive]
#[derive(Debug)]
#[derive(Debug, defmt::Format)]
pub enum Error {
/// Bus error
Bus,
Expand Down
2 changes: 1 addition & 1 deletion src/i2c_f4.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub enum I2cDevice {
Three,
}

#[derive(Debug)]
#[derive(Debug, defmt::Format)]
pub enum Error {
OVERRUN,
NACK,
Expand Down
2 changes: 1 addition & 1 deletion src/qspi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ pub enum SamplingEdge {
}

/// Indicates an error with the QSPI peripheral.
#[derive(Copy, Clone, PartialEq)]
#[derive(Copy, Clone, PartialEq, defmt::Format)]
pub enum QspiError {
Busy,
Underflow,
Expand Down
2 changes: 1 addition & 1 deletion src/rtc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub enum RtcClockSource {
}

/// RTC error type
#[derive(Debug)]
#[derive(Debug, defmt::Format)]
pub enum Error {
/// Invalid input error
InvalidInputData,
Expand Down
2 changes: 1 addition & 1 deletion src/spi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ macro_rules! check_errors {

/// SPI error
#[non_exhaustive]
#[derive(Copy, Clone, Debug)]
#[derive(Copy, Clone, Debug, defmt::Format)]
pub enum SpiError {
/// Overrun occurred
Overrun,
Expand Down
2 changes: 1 addition & 1 deletion src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub static TICK_OVERFLOW_COUNT: AtomicU32 = AtomicU32::new(0);

// todo: Low power timer enabling etc. eg on L4, RCC_APB1ENR1.LPTIM1EN

#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, defmt::Format)]
/// Used for when attempting to set a timer period that is out of range.
pub struct ValueError {}

Expand Down
2 changes: 1 addition & 1 deletion src/usart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub enum IrdaMode {

/// Serial error
#[non_exhaustive]
#[derive(Debug)]
#[derive(Debug, defmt::Format)]
pub enum UartError {
/// Framing error
Framing,
Expand Down

0 comments on commit a4b1b93

Please sign in to comment.