Skip to content

Commit

Permalink
run cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
guineawheek committed Jun 4, 2024
1 parent 78e1b1f commit d933de8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
20 changes: 10 additions & 10 deletions src/interrupt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,41 +66,41 @@ pub enum Interrupt {

/// Fires the **SCE** interrupt when the error warning limit (receive or transmit error counter
/// >= 96) has been reached.
///
///
/// [`Interrupt::Error`] must also be enabled for the interrupt to fire.
///
///
/// The interrupt handler must clear the interrupt condition by calling
/// [`Can::clear_error_interrupt`].
ErrorWarning = 1 << 8,

/// Fires the **SCE** interrupt when the peripheral enters the error passive state.
///
///
/// [`Interrupt::Error`] must also be enabled for the interrupt to fire.
///
///
/// The interrupt handler must clear the interrupt condition by calling
/// [`Can::clear_error_interrupt`].
ErrorPassive = 1 << 9,

/// Fires the **SCE** interrupt when the peripheral has entered bus-off.
///
///
/// [`Interrupt::Error`] must also be enabled for the interrupt to fire.
///
///
/// The interrupt handler must clear the interrupt condition by calling
/// [`Can::clear_error_interrupt`].
BusOff = 1 << 10,

/// Fires the **SCE** interrupt when the peripheral updates the last error code.
///
///
/// [`Interrupt::Error`] must also be enabled for the interrupt to fire.
///
///
/// The interrupt handler must clear the interrupt condition by calling
/// [`Can::clear_error_interrupt`].
LastErrorCode = 1 << 11,

/// Fires the **SCE** interrupt when the peripheral enters an error state.
///
///
/// The error states that will cause the interrupt to fire are determined by the subset of
/// [`Interrupt::ErrorWarning`], [`Interrupt::ErrorPassive`], [`Interrupt::BusOff`], and
/// [`Interrupt::ErrorWarning`], [`Interrupt::ErrorPassive`], [`Interrupt::BusOff`], and
/// [`Interrupt::LastErrorCode`] that are enabled along with this flag.
///
/// The interrupt handler must clear the interrupt condition by calling
Expand Down
11 changes: 5 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,31 +155,30 @@ impl ErrorStatus {
}

/// Returns true if the peripheral is currently in bus-off.
///
///
/// This occurs when the transmit error counter overflows past 255.
#[inline]
pub fn bus_off(&self) -> bool {
self.bus_off
}

/// Returns true if the error passive limit has been reached.
///
///
/// This occurs when the receive or transmit error counters exceed 127.
#[inline]
pub fn error_passive(&self) -> bool {
self.err_passive
}

/// Returns true if the error warning limit has been reached.
///
///
/// This occurs when the receive or transmit error counters are greater than or equal 96.
#[inline]
pub fn error_warning(&self) -> bool {
self.err_warning
}
}


/// Error that indicates that an incoming message has been lost due to buffer overrun.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[cfg_attr(feature = "unstable-defmt", derive(defmt::Format))]
Expand Down Expand Up @@ -709,7 +708,7 @@ where
}

/// Clears the error interrupt flag ([`Interrupt::Error`]).
///
///
/// To read the error status, use [`Can::error_status`] to get the [`ErrorStatus`] before
/// clearing the interrupt flag.
pub fn clear_error_interrupt(&mut self) {
Expand Down Expand Up @@ -740,7 +739,7 @@ where
}),
bus_off: esr.boff().bits,
err_passive: esr.epvf().bits,
err_warning: esr.ewgf().bits
err_warning: esr.ewgf().bits,
}
}

Expand Down

0 comments on commit d933de8

Please sign in to comment.