pub fn prepare<'a>(buffer: &'a mut Vec<u8>, uart: &mut Uart) -> io::Result<PreparedBuffer<'a>> {
    buffer.clear();
    // Just use a constant size for now.
    // We have to push data into the buffer to make it possible to
    // update the values in place when the buffer is used as a slice.
    buffer.reserve(SERIAL_BUFFER_SIZE);
    while buffer.len() < SERIAL_BUFFER_SIZE { buffer.push(0); }

    uart.set_read_mode(0, Duration::from_millis(100))?;
    uart.flush(uart::Queue::Input)?;

    Ok(PreparedBuffer(buffer))
}
/// Prepare the a buffer and the UART for serial data collection.
Prepare the a buffer and the UART for serial data collection.
Prepare the a buffer and the UART for serial data collection .
pub fn prepare<'a>(buffer: &'a mut Vec<u8>, uart: &mut Uart) -> io::Result<PreparedBuffer<'a>> {
    buffer.clear();
    // Just use a constant size for now.
    // We have to push data into the buffer to make it possible to
    // update the values in place when the buffer is used as a slice.
    buffer.reserve(SERIAL_BUFFER_SIZE);
    while buffer.len() < SERIAL_BUFFER_SIZE { buffer.push(0); }
    uart.set_read_mode(0, Duration::from_millis(100))?;
    uart.flush(uart::Queue::Input)?;
    Ok(PreparedBuffer(buffer))
}
pub fn prepare < ' a > ( buffer : & ' a mut Vec < u8 > , uart : & mut Uart ) -> io :: Result < PreparedBuffer < ' a > > { buffer . clear ( ) ; // Just use a constant size for now. // We have to push data into the buffer to make it possible to // update the values in place when the buffer is used as a slice. buffer . reserve ( SERIAL_BUFFER_SIZE ) ; while buffer . len ( ) < SERIAL_BUFFER_SIZE { buffer . push ( 0 ) ; } uart . set_read_mode ( 0 , Duration :: from_millis ( 100 ) ) ? ; uart . flush ( uart :: Queue :: Input ) ? ; Ok ( PreparedBuffer ( buffer ) ) }
Prepare the a buffer and the UART for serial data collection.
Prepare the a buffer and the UART for serial data collection .
buffer
&'a mut Vec<u8>
uart
&mut Uart
buffer
&'a mut Vec<u8>
uart
&mut Uart