Skip to main content

Module serial

Module serial 

Source
Expand description

Serial interface transport.

Setup any serial interface for transport.

§Example

#[cortex_m_rt::entry]
fn main() -> ! {
    let mut board = Board::new();
    let vcp = board.vcp.take().unwrap();

    // Set serial uplink
    Serial::set_write(move |b| {
        match tx.write(b) {
            Ok(_) => {
                nb::block!(vcp.tx.flush()).ok();
                Ok(())
            },
            Err(e) => match e {
                WouldBlock => Err(WouldBlock),
                _ => Err(Other(serial::Error::Peripheral)),
            }
        }
    });
    /*...*/
}

Enums§

Error
Serial Errors.