aboutsummaryrefslogtreecommitdiff
path: root/tests/rp/src/bin/uart_buffered.rs
diff options
context:
space:
mode:
authorAdam Greig <[email protected]>2023-10-15 00:57:25 +0100
committerAdam Greig <[email protected]>2023-10-15 01:30:12 +0100
commit0621e957a0ddc7010d46b3ea3ddc8b9852bc8333 (patch)
treef6caefe939109e55a73e9141c736d2f6c20f51e8 /tests/rp/src/bin/uart_buffered.rs
parent7559f9e5834799b041d899767ef4305dcfdf0181 (diff)
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'tests/rp/src/bin/uart_buffered.rs')
-rw-r--r--tests/rp/src/bin/uart_buffered.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/rp/src/bin/uart_buffered.rs b/tests/rp/src/bin/uart_buffered.rs
index 6ab7de29e..6a9c910ff 100644
--- a/tests/rp/src/bin/uart_buffered.rs
+++ b/tests/rp/src/bin/uart_buffered.rs
@@ -9,7 +9,7 @@ use embassy_rp::bind_interrupts;
9use embassy_rp::gpio::{Level, Output}; 9use embassy_rp::gpio::{Level, Output};
10use embassy_rp::peripherals::UART0; 10use embassy_rp::peripherals::UART0;
11use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config, Error, Instance, Parity}; 11use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config, Error, Instance, Parity};
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use embedded_io_async::{Read, ReadExactError, Write}; 13use embedded_io_async::{Read, ReadExactError, Write};
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
@@ -39,14 +39,14 @@ async fn read1<const N: usize>(uart: &mut BufferedUartRx<'_, impl Instance>) ->
39 39
40async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) { 40async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: Option<bool>) {
41 pin.set_low(); 41 pin.set_low();
42 Timer::after(Duration::from_millis(1)).await; 42 Timer::after_millis(1).await;
43 for i in 0..8 { 43 for i in 0..8 {
44 if v & (1 << i) == 0 { 44 if v & (1 << i) == 0 {
45 pin.set_low(); 45 pin.set_low();
46 } else { 46 } else {
47 pin.set_high(); 47 pin.set_high();
48 } 48 }
49 Timer::after(Duration::from_millis(1)).await; 49 Timer::after_millis(1).await;
50 } 50 }
51 if let Some(b) = parity { 51 if let Some(b) = parity {
52 if b { 52 if b {
@@ -54,10 +54,10 @@ async fn send(pin: &mut Output<'_, impl embassy_rp::gpio::Pin>, v: u8, parity: O
54 } else { 54 } else {
55 pin.set_low(); 55 pin.set_low();
56 } 56 }
57 Timer::after(Duration::from_millis(1)).await; 57 Timer::after_millis(1).await;
58 } 58 }
59 pin.set_high(); 59 pin.set_high();
60 Timer::after(Duration::from_millis(1)).await; 60 Timer::after_millis(1).await;
61} 61}
62 62
63#[embassy_executor::main] 63#[embassy_executor::main]