pub struct MOSIFrame { /* private fields */ }
Expand description
A representation of a SHDLC Master Out Slave In frame. Each frame contains a Frame start byte. The slave address of the device. The command byte. The length of the data being transmitted. The actual data, a checksum followed by the Frame end byte.
Implementations§
Source§impl MOSIFrame
impl MOSIFrame
Sourcepub fn new(
address: u8,
command: u8,
data: &[u8],
) -> Result<Self, TranslationError>
pub fn new( address: u8, command: u8, data: &[u8], ) -> Result<Self, TranslationError>
Constructs a MOSI frame from the adress, command, and data. This will automatically translate the data using SHDLC byte stuffing.
Sourcepub fn get_address(&self) -> u8
pub fn get_address(&self) -> u8
Returns the slave adress of the command
Sourcepub fn get_command_number(&self) -> u8
pub fn get_command_number(&self) -> u8
Returns the command number/byte of
Sourcepub fn get_data_length(&self) -> u8
pub fn get_data_length(&self) -> u8
Returns the length of the data pre byte stuffing
Sourcepub fn into_raw(self) -> ArrayVec<u8, 518>
pub fn into_raw(self) -> ArrayVec<u8, 518>
Returns the underlying ArrayVec ready to be written to the device
Sourcepub fn validate_checksum(&self) -> bool
pub fn validate_checksum(&self) -> bool
Validates the checksum and returns true if its valid
Auto Trait Implementations§
impl Freeze for MOSIFrame
impl RefUnwindSafe for MOSIFrame
impl Send for MOSIFrame
impl Sync for MOSIFrame
impl Unpin for MOSIFrame
impl UnwindSafe for MOSIFrame
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more