From 3932835998802fc3abf7cce4f736e072858ebfd1 Mon Sep 17 00:00:00 2001 From: Curly Date: Sun, 23 Feb 2025 07:33:58 -0800 Subject: rename `rp23` (?) folder to `rp235x`; fix `ci.sh` to use `rp235x` folder --- examples/rp235x/src/bin/uart.rs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/rp235x/src/bin/uart.rs (limited to 'examples/rp235x/src/bin/uart.rs') diff --git a/examples/rp235x/src/bin/uart.rs b/examples/rp235x/src/bin/uart.rs new file mode 100644 index 000000000..a59f537bf --- /dev/null +++ b/examples/rp235x/src/bin/uart.rs @@ -0,0 +1,25 @@ +//! 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. + +#![no_std] +#![no_main] + +use embassy_executor::Spawner; +use embassy_rp::uart; +use {defmt_rtt as _, panic_probe as _}; + +#[embassy_executor::main] +async fn main(_spawner: Spawner) { + let p = embassy_rp::init(Default::default()); + let config = uart::Config::default(); + let mut uart = uart::Uart::new_blocking(p.UART1, p.PIN_4, p.PIN_5, config); + uart.blocking_write("Hello World!\r\n".as_bytes()).unwrap(); + + loop { + uart.blocking_write("hello there!\r\n".as_bytes()).unwrap(); + cortex_m::asm::delay(1_000_000); + } +} -- cgit