diff options
| -rw-r--r-- | embassy-stm32/src/can/fd/message_ram/common.rs | 6 | ||||
| -rw-r--r-- | embassy-stm32/src/can/fd/message_ram/enums.rs | 20 | ||||
| -rw-r--r-- | embassy-stm32/src/can/fd/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/can/fd/peripheral.rs | 6 |
4 files changed, 17 insertions, 17 deletions
diff --git a/embassy-stm32/src/can/fd/message_ram/common.rs b/embassy-stm32/src/can/fd/message_ram/common.rs index a67d68fa0..108c1a428 100644 --- a/embassy-stm32/src/can/fd/message_ram/common.rs +++ b/embassy-stm32/src/can/fd/message_ram/common.rs | |||
| @@ -88,12 +88,12 @@ pub type FDF_R = generic::R<bool, FrameFormat>; | |||
| 88 | impl FDF_R { | 88 | impl FDF_R { |
| 89 | pub fn frame_format(&self) -> FrameFormat { | 89 | pub fn frame_format(&self) -> FrameFormat { |
| 90 | match self.bits() { | 90 | match self.bits() { |
| 91 | false => FrameFormat::Standard, | 91 | false => FrameFormat::Classic, |
| 92 | true => FrameFormat::Fdcan, | 92 | true => FrameFormat::Fdcan, |
| 93 | } | 93 | } |
| 94 | } | 94 | } |
| 95 | pub fn is_standard_format(&self) -> bool { | 95 | pub fn is_classic_format(&self) -> bool { |
| 96 | *self == FrameFormat::Standard | 96 | *self == FrameFormat::Classic |
| 97 | } | 97 | } |
| 98 | pub fn is_fdcan_format(&self) -> bool { | 98 | pub fn is_fdcan_format(&self) -> bool { |
| 99 | *self == FrameFormat::Fdcan | 99 | *self == FrameFormat::Fdcan |
diff --git a/embassy-stm32/src/can/fd/message_ram/enums.rs b/embassy-stm32/src/can/fd/message_ram/enums.rs index 78285bf81..0ec5e0f34 100644 --- a/embassy-stm32/src/can/fd/message_ram/enums.rs +++ b/embassy-stm32/src/can/fd/message_ram/enums.rs | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | 5 | ||
| 6 | #[derive(Clone, Copy, Debug, PartialEq)] | 6 | #[derive(Clone, Copy, Debug, PartialEq)] |
| 7 | pub enum DataLength { | 7 | pub enum DataLength { |
| 8 | Standard(u8), | 8 | Classic(u8), |
| 9 | Fdcan(u8), | 9 | Fdcan(u8), |
| 10 | } | 10 | } |
| 11 | impl DataLength { | 11 | impl DataLength { |
| @@ -14,8 +14,8 @@ impl DataLength { | |||
| 14 | /// Uses the byte length and Type of frame as input | 14 | /// Uses the byte length and Type of frame as input |
| 15 | pub fn new(len: u8, ff: FrameFormat) -> DataLength { | 15 | pub fn new(len: u8, ff: FrameFormat) -> DataLength { |
| 16 | match ff { | 16 | match ff { |
| 17 | FrameFormat::Standard => match len { | 17 | FrameFormat::Classic => match len { |
| 18 | 0..=8 => DataLength::Standard(len), | 18 | 0..=8 => DataLength::Classic(len), |
| 19 | _ => panic!("DataLength > 8"), | 19 | _ => panic!("DataLength > 8"), |
| 20 | }, | 20 | }, |
| 21 | FrameFormat::Fdcan => match len { | 21 | FrameFormat::Fdcan => match len { |
| @@ -24,9 +24,9 @@ impl DataLength { | |||
| 24 | }, | 24 | }, |
| 25 | } | 25 | } |
| 26 | } | 26 | } |
| 27 | /// Specialised function to create standard frames | 27 | /// Specialised function to create classic frames |
| 28 | pub fn new_standard(len: u8) -> DataLength { | 28 | pub fn new_classic(len: u8) -> DataLength { |
| 29 | Self::new(len, FrameFormat::Standard) | 29 | Self::new(len, FrameFormat::Classic) |
| 30 | } | 30 | } |
| 31 | /// Specialised function to create FDCAN frames | 31 | /// Specialised function to create FDCAN frames |
| 32 | pub fn new_fdcan(len: u8) -> DataLength { | 32 | pub fn new_fdcan(len: u8) -> DataLength { |
| @@ -36,13 +36,13 @@ impl DataLength { | |||
| 36 | /// returns the length in bytes | 36 | /// returns the length in bytes |
| 37 | pub fn len(&self) -> u8 { | 37 | pub fn len(&self) -> u8 { |
| 38 | match self { | 38 | match self { |
| 39 | DataLength::Standard(l) | DataLength::Fdcan(l) => *l, | 39 | DataLength::Classic(l) | DataLength::Fdcan(l) => *l, |
| 40 | } | 40 | } |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | pub(crate) fn dlc(&self) -> u8 { | 43 | pub(crate) fn dlc(&self) -> u8 { |
| 44 | match self { | 44 | match self { |
| 45 | DataLength::Standard(l) => *l, | 45 | DataLength::Classic(l) => *l, |
| 46 | // See RM0433 Rev 7 Table 475. DLC coding | 46 | // See RM0433 Rev 7 Table 475. DLC coding |
| 47 | DataLength::Fdcan(l) => match l { | 47 | DataLength::Fdcan(l) => match l { |
| 48 | 0..=8 => *l, | 48 | 0..=8 => *l, |
| @@ -61,7 +61,7 @@ impl DataLength { | |||
| 61 | impl From<DataLength> for FrameFormat { | 61 | impl From<DataLength> for FrameFormat { |
| 62 | fn from(dl: DataLength) -> FrameFormat { | 62 | fn from(dl: DataLength) -> FrameFormat { |
| 63 | match dl { | 63 | match dl { |
| 64 | DataLength::Standard(_) => FrameFormat::Standard, | 64 | DataLength::Classic(_) => FrameFormat::Classic, |
| 65 | DataLength::Fdcan(_) => FrameFormat::Fdcan, | 65 | DataLength::Fdcan(_) => FrameFormat::Fdcan, |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| @@ -121,7 +121,7 @@ impl From<ErrorStateIndicator> for bool { | |||
| 121 | /// Type of frame, standard (classic) or FdCAN | 121 | /// Type of frame, standard (classic) or FdCAN |
| 122 | #[derive(Clone, Copy, Debug, PartialEq)] | 122 | #[derive(Clone, Copy, Debug, PartialEq)] |
| 123 | pub enum FrameFormat { | 123 | pub enum FrameFormat { |
| 124 | Standard = 0, | 124 | Classic = 0, |
| 125 | Fdcan = 1, | 125 | Fdcan = 1, |
| 126 | } | 126 | } |
| 127 | impl From<FrameFormat> for bool { | 127 | impl From<FrameFormat> for bool { |
diff --git a/embassy-stm32/src/can/fd/mod.rs b/embassy-stm32/src/can/fd/mod.rs index 0008fd3a8..271ca0b3c 100644 --- a/embassy-stm32/src/can/fd/mod.rs +++ b/embassy-stm32/src/can/fd/mod.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | //! Module containing that which is speciffic to fdcan hardware variant | 1 | //! Module containing that which is specific to fdcan hardware variant |
| 2 | 2 | ||
| 3 | pub mod config; | 3 | pub mod config; |
| 4 | pub mod filter; | 4 | pub mod filter; |
diff --git a/embassy-stm32/src/can/fd/peripheral.rs b/embassy-stm32/src/can/fd/peripheral.rs index 6f390abb4..3422d7148 100644 --- a/embassy-stm32/src/can/fd/peripheral.rs +++ b/embassy-stm32/src/can/fd/peripheral.rs | |||
| @@ -167,7 +167,7 @@ impl Registers { | |||
| 167 | 167 | ||
| 168 | let len = match header_reg.to_data_length() { | 168 | let len = match header_reg.to_data_length() { |
| 169 | DataLength::Fdcan(len) => len, | 169 | DataLength::Fdcan(len) => len, |
| 170 | DataLength::Standard(len) => len, | 170 | DataLength::Classic(len) => len, |
| 171 | }; | 171 | }; |
| 172 | if len as usize > ClassicFrame::MAX_DATA_LEN { | 172 | if len as usize > ClassicFrame::MAX_DATA_LEN { |
| 173 | return None; | 173 | return None; |
| @@ -202,7 +202,7 @@ impl Registers { | |||
| 202 | 202 | ||
| 203 | let len = match header_reg.to_data_length() { | 203 | let len = match header_reg.to_data_length() { |
| 204 | DataLength::Fdcan(len) => len, | 204 | DataLength::Fdcan(len) => len, |
| 205 | DataLength::Standard(len) => len, | 205 | DataLength::Classic(len) => len, |
| 206 | }; | 206 | }; |
| 207 | if len as usize > FdFrame::MAX_DATA_LEN { | 207 | if len as usize > FdFrame::MAX_DATA_LEN { |
| 208 | return None; | 208 | return None; |
| @@ -683,7 +683,7 @@ fn put_tx_header(mailbox: &mut TxBufferElement, header: &Header) { | |||
| 683 | let frame_format = if header.len() > 8 || header.fdcan() { | 683 | let frame_format = if header.len() > 8 || header.fdcan() { |
| 684 | FrameFormat::Fdcan | 684 | FrameFormat::Fdcan |
| 685 | } else { | 685 | } else { |
| 686 | FrameFormat::Standard | 686 | FrameFormat::Classic |
| 687 | }; | 687 | }; |
| 688 | let brs = header.len() > 8 || header.bit_rate_switching(); | 688 | let brs = header.len() > 8 || header.bit_rate_switching(); |
| 689 | 689 | ||
