diff options
| author | Ulf Lilleengen <[email protected]> | 2025-08-08 08:04:24 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-08-08 08:04:24 +0000 |
| commit | f2be66a5f94a655696407e2e7bc81c322aab3ea1 (patch) | |
| tree | 8711713cc3868f1adbbba34d89fb3b2f99307c04 /embassy-stm32 | |
| parent | 3220878e132b162c5e6f58fc65113285572e8bbd (diff) | |
| parent | dbd10486b3e034fa193694a68f2c1803b4896365 (diff) | |
Merge pull request #4481 from swobbee-dev/main
STM32 CAN: Add mutable access for ID in Header and Frame structs
Diffstat (limited to 'embassy-stm32')
| -rw-r--r-- | embassy-stm32/src/can/frame.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/embassy-stm32/src/can/frame.rs b/embassy-stm32/src/can/frame.rs index 0fbab053b..a498f195f 100644 --- a/embassy-stm32/src/can/frame.rs +++ b/embassy-stm32/src/can/frame.rs | |||
| @@ -59,6 +59,11 @@ impl Header { | |||
| 59 | &self.id | 59 | &self.id |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | /// Get mutable reference to ID | ||
| 63 | pub fn id_mut(&mut self) -> &mut embedded_can::Id { | ||
| 64 | &mut self.id | ||
| 65 | } | ||
| 66 | |||
| 62 | /// Return length as u8 | 67 | /// Return length as u8 |
| 63 | pub fn len(&self) -> u8 { | 68 | pub fn len(&self) -> u8 { |
| 64 | self.len | 69 | self.len |
| @@ -207,6 +212,11 @@ impl Frame { | |||
| 207 | &self.can_header.id | 212 | &self.can_header.id |
| 208 | } | 213 | } |
| 209 | 214 | ||
| 215 | /// Get mutable reference to ID | ||
| 216 | pub fn id_mut(&mut self) -> &mut embedded_can::Id { | ||
| 217 | &mut self.can_header.id | ||
| 218 | } | ||
| 219 | |||
| 210 | /// Get reference to data | 220 | /// Get reference to data |
| 211 | pub fn data(&self) -> &[u8] { | 221 | pub fn data(&self) -> &[u8] { |
| 212 | &self.data.raw()[..self.can_header.len as usize] | 222 | &self.data.raw()[..self.can_header.len as usize] |
