Fixed formatting

This commit is contained in:
Max Guichard 2024-11-21 13:28:10 +01:00
parent b700b0c13c
commit 490829ab8f
2 changed files with 18 additions and 8 deletions

View File

@ -64,7 +64,7 @@ pub enum FrameCreateError {
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
pub enum IdCreateError {
/// ID was out of range for 11/28 bit identifier
OutOfRange
OutOfRange,
}
/// Error returned by `try_read`

View File

@ -23,7 +23,7 @@ pub struct Header {
#[derive(Debug, Copy, Clone)]
pub struct Id(
// Wrapped ID
embedded_can::Id
embedded_can::Id,
);
impl TryFrom<u16> for Id {
@ -45,7 +45,9 @@ impl TryFrom<u32> for Id {
}
impl From<Id> for embedded_can::Id {
fn from(id: Id) -> Self { id.0 }
fn from(id: Id) -> Self {
id.0
}
}
#[cfg(feature = "defmt")]
@ -71,7 +73,11 @@ impl Header {
pub fn new(id: impl Into<embedded_can::Id>, len: u8, rtr: bool) -> Header {
let mut flags = 0u8;
flags.set_bit(Self::FLAG_RTR, rtr);
Header { id: id.into(), len, flags }
Header {
id: id.into(),
len,
flags,
}
}
/// Create new CAN FD Header
@ -80,7 +86,11 @@ impl Header {
flags.set_bit(Self::FLAG_RTR, rtr);
flags.set_bit(Self::FLAG_FDCAN, true);
flags.set_bit(Self::FLAG_BRS, brs);
Header { id: id.into(), len, flags }
Header {
id: id.into(),
len,
flags,
}
}
/// Return ID