diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-06-02 01:30:07 +0200 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-06-02 01:32:19 +0200 |
| commit | dff03ecfc74d6af716637888338ebfa99ab7a027 (patch) | |
| tree | c06bf2b0a2e6657c3427c956dbd27a4e45211aaa /examples/rp/src/bin/uart.rs | |
| parent | a0c5f7137fe0c45b8db0aad2a116aea91e6a93f7 (diff) | |
Move examples to a subdirectory
Diffstat (limited to 'examples/rp/src/bin/uart.rs')
| -rw-r--r-- | examples/rp/src/bin/uart.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/rp/src/bin/uart.rs b/examples/rp/src/bin/uart.rs new file mode 100644 index 000000000..8b5f2a53b --- /dev/null +++ b/examples/rp/src/bin/uart.rs | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | #![no_std] | ||
| 2 | #![no_main] | ||
| 3 | #![feature(asm)] | ||
| 4 | #![feature(min_type_alias_impl_trait)] | ||
| 5 | #![feature(impl_trait_in_bindings)] | ||
| 6 | #![feature(type_alias_impl_trait)] | ||
| 7 | #![allow(incomplete_features)] | ||
| 8 | |||
| 9 | #[path = "../example_common.rs"] | ||
| 10 | mod example_common; | ||
| 11 | |||
| 12 | use embassy::executor::Spawner; | ||
| 13 | use embassy_rp::{uart, Peripherals}; | ||
| 14 | |||
| 15 | #[embassy::main] | ||
| 16 | async fn main(_spawner: Spawner, p: Peripherals) { | ||
| 17 | let config = uart::Config::default(); | ||
| 18 | let mut uart = uart::Uart::new(p.UART0, p.PIN_0, p.PIN_1, p.PIN_2, p.PIN_3, config); | ||
| 19 | uart.send("Hello World!\r\n".as_bytes()); | ||
| 20 | |||
| 21 | loop { | ||
| 22 | uart.send("hello there!\r\n".as_bytes()); | ||
| 23 | cortex_m::asm::delay(1_000_000); | ||
| 24 | } | ||
| 25 | } | ||
