embassy/examples/rp/src/bin/uart.rs

21 lines
611 B
Rust
Raw Normal View History

2021-03-29 21:33:46 +02:00
#![no_std]
#![no_main]
#![feature(type_alias_impl_trait)]
use embassy_executor::Spawner;
use embassy_rp::uart;
2022-06-12 22:15:44 +02:00
use {defmt_rtt as _, panic_probe as _};
#[embassy_executor::main]
async fn main(_spawner: Spawner) {
let p = embassy_rp::init(Default::default());
2021-03-29 21:33:46 +02:00
let config = uart::Config::default();
2022-08-19 08:48:52 +02:00
let mut uart = uart::Uart::new_with_rtscts_blocking(p.UART0, p.PIN_0, p.PIN_1, p.PIN_3, p.PIN_2, config);
2022-08-18 11:47:15 +02:00
uart.blocking_write("Hello World!\r\n".as_bytes()).unwrap();
2021-03-29 21:33:46 +02:00
loop {
2022-08-18 11:47:15 +02:00
uart.blocking_write("hello there!\r\n".as_bytes()).unwrap();
2021-03-29 21:33:46 +02:00
cortex_m::asm::delay(1_000_000);
}
}