Macro arduino_hal::default_serial
source · macro_rules! default_serial { ($p:expr, $pins:expr, $baud:expr) => { ... }; }
Expand description
Convenience macro to instantiate the Usart
driver for this board.
§Example
let dp = arduino_hal::Peripherals::take().unwrap();
let pins = arduino_hal::pins!(dp);
let serial = arduino_hal::default_serial!(dp, pins, 57600);
This is equivalent to manually configuring the driver:
let dp = arduino_hal::Peripherals::take().unwrap();
let pins = arduino_hal::pins!(dp);
let serial = arduino_hal::Usart::new(
dp.USART1,
pins.d0,
pins.d1.into_output(),
// See src/usart.rs for why some boards use the BaudrateArduinoExt trait
// instead of BaudrateExt.
arduino_hal::hal::usart::BaudrateArduinoExt::into_baudrate(57600),
);