aboutsummaryrefslogtreecommitdiff
path: root/examples/rp235x/src/bin/uart.rs
diff options
context:
space:
mode:
authorCurly <[email protected]>2025-02-23 07:33:58 -0800
committerCurly <[email protected]>2025-02-23 07:33:58 -0800
commit3932835998802fc3abf7cce4f736e072858ebfd1 (patch)
tree5dd714b99bc74a03556c58809237c88691c293bb /examples/rp235x/src/bin/uart.rs
parentc3c67db93e627a4fafe5e1a1123e5cbb4abafe47 (diff)
rename `rp23` (?) folder to `rp235x`; fix `ci.sh` to use `rp235x` folder
Diffstat (limited to 'examples/rp235x/src/bin/uart.rs')
-rw-r--r--examples/rp235x/src/bin/uart.rs25
1 files changed, 25 insertions, 0 deletions
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 @@
1//! This example shows how to use UART (Universal asynchronous receiver-transmitter) in the RP2040 chip.
2//!
3//! No specific hardware is specified in this example. Only output on pin 0 is tested.
4//! The Raspberry Pi Debug Probe (https://www.raspberrypi.com/products/debug-probe/) could be used
5//! with its UART port.
6
7#![no_std]
8#![no_main]
9
10use embassy_executor::Spawner;
11use embassy_rp::uart;
12use {defmt_rtt as _, panic_probe as _};
13
14#[embassy_executor::main]
15async fn main(_spawner: Spawner) {
16 let p = embassy_rp::init(Default::default());
17 let config = uart::Config::default();
18 let mut uart = uart::Uart::new_blocking(p.UART1, p.PIN_4, p.PIN_5, config);
19 uart.blocking_write("Hello World!\r\n".as_bytes()).unwrap();
20
21 loop {
22 uart.blocking_write("hello there!\r\n".as_bytes()).unwrap();
23 cortex_m::asm::delay(1_000_000);
24 }
25}