fn write_serial(s: &mut SerialPort<'static, bsp::hal::usb::UsbBus>, buf: &str) {
        let mut write_ptr = buf.as_bytes();
        while !write_ptr.is_empty() {
            match s.write(write_ptr) {
                Ok(len) => write_ptr = &write_ptr[len..],
                // On error, just drop unwritten data.
                // One possible error is Err(WouldBlock), meaning the USB write buffer is full.
                Err(_) => break,
            }
        }
        let _ = s.write("\n".as_bytes());
    }
/// Helper function to ensure all data is written across the serial interface.
Helper function to ensure all data is written across the serial interface.
Helper function to ensure all data is written across the serial interface .
fn write_serial(s: &mut SerialPort<'static, bsp::hal::usb::UsbBus>, buf: &str) {
        let mut write_ptr = buf.as_bytes();
        while !write_ptr.is_empty() {
            match s.write(write_ptr) {
                Ok(len) => write_ptr = &write_ptr[len..],
                // On error, just drop unwritten data.
                // One possible error is Err(WouldBlock), meaning the USB write buffer is full.
                Err(_) => break,
            }
        }
        let _ = s.write("\n".as_bytes());
    }
fn write_serial ( s : & mut SerialPort < ' static , bsp :: hal :: usb :: UsbBus > , buf : & str ) { let mut write_ptr = buf . as_bytes ( ) ; while ! write_ptr . is_empty ( ) { match s . write ( write_ptr ) { Ok ( len ) => write_ptr = & write_ptr [ len .. ] , // On error, just drop unwritten data. // One possible error is Err(WouldBlock), meaning the USB write buffer is full. Err ( _ ) => break , } } let _ = s . write ( " \n " . as_bytes ( ) ) ; }
Helper function to ensure all data is written across the serial interface.
Helper function to ensure all data is written across the serial interface .
s
&mut SerialPort<'static, bsp::hal::usb::UsbBus>
buf
&str
s
&mut SerialPort<'static, bsp::hal::usb::UsbBus>
buf
&str