Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement defmt::Format for all error types #112

Merged
merged 1 commit into from
Nov 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading