Add mutable accessors for ID in Header and Frame structs

This commit is contained in:
Malte Brieske 2025-07-29 19:18:14 +02:00
parent b67c2e06d5
commit dbd10486b3

View File

@ -59,6 +59,11 @@ impl Header {
&self.id
}
/// Get mutable reference to ID
pub fn id_mut(&mut self) -> &mut embedded_can::Id {
&mut self.id
}
/// Return length as u8
pub fn len(&self) -> u8 {
self.len
@ -207,6 +212,11 @@ impl Frame {
&self.can_header.id
}
/// Get mutable reference to ID
pub fn id_mut(&mut self) -> &mut embedded_can::Id {
&mut self.can_header.id
}
/// Get reference to data
pub fn data(&self) -> &[u8] {
&self.data.raw()[..self.can_header.len as usize]