/// Moves data from the host to the device's RAM using the SAM-BA
/// and XMODEM protocol.
Moves data from the host to the device's RAM using the SAM-BA
and XMODEM protocol.
Moves data from the host to the device ' s RAM using the SAM - BA and XMODEM protocol .
fn copy(&mut self, address: u32, data: &[u8]) -> Result<(), Error> {
        let command = CString::new(format!("S{:08X},{:08X}#", address, data.len())).unwrap();
        self.bus.write(command.as_bytes())?;
        let mut xmodem = Xmodem::new();
        xmodem.pad_byte = 0x0;
        let mut stream = Cursor::new(data);
        xmodem.send(&mut self.bus, &mut stream).map_err(|e| FdfuError::from(e).into())
    }
fn copy ( & mut self , address : u32 , data : & [ u8 ] ) -> Result < ( ) , Error > { let command = CString :: new ( format ! ( " " address data len ( ) ) ) . unwrap ( ) ; self . bus . write ( command . as_bytes ( ) ) ? ; let mut xmodem = Xmodem :: new ( ) ; xmodem . pad_byte = 0x0 ; let mut stream = Cursor :: new ( data ) ; xmodem . send ( & mut self . bus , & mut stream ) . map_err ( | e | FdfuError :: from ( e ) . into ( ) ) }
Moves data from the host to the device's RAM using the SAM-BA
and XMODEM protocol.
Moves data from the host to the device ' s RAM using the SAM - BA and XMODEM protocol .
&mut self
address
u32
data
&[u8]