2023-07-13 11:16:11 +02:00
|
|
|
//! This example shows how to use UART (Universal asynchronous receiver-transmitter) in the RP2040 chip.
|
|
|
|
//!
|
|
|
|
//! No specific hardware is specified in this example. Only output on pin 0 is tested.
|
|
|
|
//! The Raspberry Pi Debug Probe (https://www.raspberrypi.com/products/debug-probe/) could be used
|
|
|
|
//! with its UART port.
|
|
|
|
|
2021-03-29 21:33:46 +02:00
|
|
|
#![no_std]
|
|
|
|
#![no_main]
|
|
|
|
#![feature(type_alias_impl_trait)]
|
|
|
|
|
2022-08-17 23:40:16 +02:00
|
|
|
use embassy_executor::Spawner;
|
2022-08-17 18:49:55 +02:00
|
|
|
use embassy_rp::uart;
|
2022-06-12 22:15:44 +02:00
|
|
|
use {defmt_rtt as _, panic_probe as _};
|
2022-04-02 04:35:06 +02:00
|
|
|
|
2022-07-29 21:58:35 +02:00
|
|
|
#[embassy_executor::main]
|
2022-08-17 18:49:55 +02:00
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|