aboutsummaryrefslogtreecommitdiff
path: root/examples/rp/src
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 /examples/rp/src
parent7559f9e5834799b041d899767ef4305dcfdf0181 (diff)
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
Diffstat (limited to 'examples/rp/src')
-rw-r--r--examples/rp/src/bin/adc.rs4
-rw-r--r--examples/rp/src/bin/blinky.rs6
-rw-r--r--examples/rp/src/bin/ethernet_w5500_tcp_client.rs2
-rw-r--r--examples/rp/src/bin/flash.rs4
-rw-r--r--examples/rp/src/bin/gpio_async.rs4
-rw-r--r--examples/rp/src/bin/gpout.rs6
-rw-r--r--examples/rp/src/bin/i2c_async.rs4
-rw-r--r--examples/rp/src/bin/i2c_blocking.rs4
-rw-r--r--examples/rp/src/bin/i2c_slave.rs6
-rw-r--r--examples/rp/src/bin/lora_p2p_receive.rs4
-rw-r--r--examples/rp/src/bin/lora_p2p_send_multicore.rs4
-rw-r--r--examples/rp/src/bin/multicore.rs6
-rw-r--r--examples/rp/src/bin/multiprio.rs8
-rw-r--r--examples/rp/src/bin/pio_hd44780.rs4
-rw-r--r--examples/rp/src/bin/pio_ws2812.rs4
-rw-r--r--examples/rp/src/bin/pwm.rs4
-rw-r--r--examples/rp/src/bin/rtc.rs6
-rw-r--r--examples/rp/src/bin/spi_async.rs4
-rw-r--r--examples/rp/src/bin/uart_buffered_split.rs4
-rw-r--r--examples/rp/src/bin/uart_unidir.rs4
-rw-r--r--examples/rp/src/bin/usb_logger.rs4
-rw-r--r--examples/rp/src/bin/watchdog.rs10
-rw-r--r--examples/rp/src/bin/wifi_tcp_server.rs2
23 files changed, 54 insertions, 54 deletions
diff --git a/examples/rp/src/bin/adc.rs b/examples/rp/src/bin/adc.rs
index 02bc493b6..a579be139 100644
--- a/examples/rp/src/bin/adc.rs
+++ b/examples/rp/src/bin/adc.rs
@@ -10,7 +10,7 @@ use embassy_executor::Spawner;
10use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler}; 10use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler};
11use embassy_rp::bind_interrupts; 11use embassy_rp::bind_interrupts;
12use embassy_rp::gpio::Pull; 12use embassy_rp::gpio::Pull;
13use embassy_time::{Duration, Timer}; 13use embassy_time::Timer;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
16bind_interrupts!(struct Irqs { 16bind_interrupts!(struct Irqs {
@@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) {
36 info!("Pin 28 ADC: {}", level); 36 info!("Pin 28 ADC: {}", level);
37 let temp = adc.read(&mut ts).await.unwrap(); 37 let temp = adc.read(&mut ts).await.unwrap();
38 info!("Temp: {} degrees", convert_to_celsius(temp)); 38 info!("Temp: {} degrees", convert_to_celsius(temp));
39 Timer::after(Duration::from_secs(1)).await; 39 Timer::after_secs(1).await;
40 } 40 }
41} 41}
42 42
diff --git a/examples/rp/src/bin/blinky.rs b/examples/rp/src/bin/blinky.rs
index 295b000f3..66c8773fa 100644
--- a/examples/rp/src/bin/blinky.rs
+++ b/examples/rp/src/bin/blinky.rs
@@ -9,7 +9,7 @@
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::gpio; 11use embassy_rp::gpio;
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use gpio::{Level, Output}; 13use gpio::{Level, Output};
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
@@ -21,10 +21,10 @@ async fn main(_spawner: Spawner) {
21 loop { 21 loop {
22 info!("led on!"); 22 info!("led on!");
23 led.set_high(); 23 led.set_high();
24 Timer::after(Duration::from_secs(1)).await; 24 Timer::after_secs(1).await;
25 25
26 info!("led off!"); 26 info!("led off!");
27 led.set_low(); 27 led.set_low();
28 Timer::after(Duration::from_secs(1)).await; 28 Timer::after_secs(1).await;
29 } 29 }
30} 30}
diff --git a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
index e593acae4..b19362fc1 100644
--- a/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
+++ b/examples/rp/src/bin/ethernet_w5500_tcp_client.rs
@@ -111,7 +111,7 @@ async fn main(spawner: Spawner) {
111 break; 111 break;
112 } 112 }
113 info!("txd: {}", core::str::from_utf8(msg).unwrap()); 113 info!("txd: {}", core::str::from_utf8(msg).unwrap());
114 Timer::after(Duration::from_secs(1)).await; 114 Timer::after_secs(1).await;
115 } 115 }
116 } 116 }
117} 117}
diff --git a/examples/rp/src/bin/flash.rs b/examples/rp/src/bin/flash.rs
index 911a657eb..129a8497f 100644
--- a/examples/rp/src/bin/flash.rs
+++ b/examples/rp/src/bin/flash.rs
@@ -8,7 +8,7 @@ use defmt::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_rp::flash::{Async, ERASE_SIZE, FLASH_BASE}; 9use embassy_rp::flash::{Async, ERASE_SIZE, FLASH_BASE};
10use embassy_rp::peripherals::FLASH; 10use embassy_rp::peripherals::FLASH;
11use embassy_time::{Duration, Timer}; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14const ADDR_OFFSET: u32 = 0x100000; 14const ADDR_OFFSET: u32 = 0x100000;
@@ -23,7 +23,7 @@ async fn main(_spawner: Spawner) {
23 // defmt RTT header. Reading that header might touch flash memory, which 23 // defmt RTT header. Reading that header might touch flash memory, which
24 // interferes with flash write operations. 24 // interferes with flash write operations.
25 // https://github.com/knurling-rs/defmt/pull/683 25 // https://github.com/knurling-rs/defmt/pull/683
26 Timer::after(Duration::from_millis(10)).await; 26 Timer::after_millis(10).await;
27 27
28 let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0); 28 let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0);
29 29
diff --git a/examples/rp/src/bin/gpio_async.rs b/examples/rp/src/bin/gpio_async.rs
index bf58044d5..98209fe41 100644
--- a/examples/rp/src/bin/gpio_async.rs
+++ b/examples/rp/src/bin/gpio_async.rs
@@ -9,7 +9,7 @@
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::gpio; 11use embassy_rp::gpio;
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use gpio::{Input, Level, Output, Pull}; 13use gpio::{Input, Level, Output, Pull};
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
@@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) {
36 info!("done wait_for_high. Turn off LED"); 36 info!("done wait_for_high. Turn off LED");
37 led.set_low(); 37 led.set_low();
38 38
39 Timer::after(Duration::from_secs(2)).await; 39 Timer::after_secs(2).await;
40 } 40 }
41} 41}
diff --git a/examples/rp/src/bin/gpout.rs b/examples/rp/src/bin/gpout.rs
index 0a3b5fa98..896cc15ee 100644
--- a/examples/rp/src/bin/gpout.rs
+++ b/examples/rp/src/bin/gpout.rs
@@ -9,7 +9,7 @@
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::clocks; 11use embassy_rp::clocks;
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15#[embassy_executor::main] 15#[embassy_executor::main]
@@ -26,13 +26,13 @@ async fn main(_spawner: Spawner) {
26 "Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}", 26 "Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}",
27 gpout3.get_freq() 27 gpout3.get_freq()
28 ); 28 );
29 Timer::after(Duration::from_secs(2)).await; 29 Timer::after_secs(2).await;
30 30
31 gpout3.set_src(clocks::GpoutSrc::Ref); 31 gpout3.set_src(clocks::GpoutSrc::Ref);
32 info!( 32 info!(
33 "Pin 25 is now outputing CLK_REF/1000, should be toggling at {}", 33 "Pin 25 is now outputing CLK_REF/1000, should be toggling at {}",
34 gpout3.get_freq() 34 gpout3.get_freq()
35 ); 35 );
36 Timer::after(Duration::from_secs(2)).await; 36 Timer::after_secs(2).await;
37 } 37 }
38} 38}
diff --git a/examples/rp/src/bin/i2c_async.rs b/examples/rp/src/bin/i2c_async.rs
index 93224bc43..7b53aae72 100644
--- a/examples/rp/src/bin/i2c_async.rs
+++ b/examples/rp/src/bin/i2c_async.rs
@@ -12,7 +12,7 @@ use embassy_executor::Spawner;
12use embassy_rp::bind_interrupts; 12use embassy_rp::bind_interrupts;
13use embassy_rp::i2c::{self, Config, InterruptHandler}; 13use embassy_rp::i2c::{self, Config, InterruptHandler};
14use embassy_rp::peripherals::I2C1; 14use embassy_rp::peripherals::I2C1;
15use embassy_time::{Duration, Timer}; 15use embassy_time::Timer;
16use embedded_hal_async::i2c::I2c; 16use embedded_hal_async::i2c::I2c;
17use {defmt_rtt as _, panic_probe as _}; 17use {defmt_rtt as _, panic_probe as _};
18 18
@@ -106,6 +106,6 @@ async fn main(_spawner: Spawner) {
106 } 106 }
107 } 107 }
108 108
109 Timer::after(Duration::from_millis(100)).await; 109 Timer::after_millis(100).await;
110 } 110 }
111} 111}
diff --git a/examples/rp/src/bin/i2c_blocking.rs b/examples/rp/src/bin/i2c_blocking.rs
index 1c8c2039d..9ddb48d69 100644
--- a/examples/rp/src/bin/i2c_blocking.rs
+++ b/examples/rp/src/bin/i2c_blocking.rs
@@ -10,7 +10,7 @@
10use defmt::*; 10use defmt::*;
11use embassy_executor::Spawner; 11use embassy_executor::Spawner;
12use embassy_rp::i2c::{self, Config}; 12use embassy_rp::i2c::{self, Config};
13use embassy_time::{Duration, Timer}; 13use embassy_time::Timer;
14use embedded_hal_1::i2c::I2c; 14use embedded_hal_1::i2c::I2c;
15use {defmt_rtt as _, panic_probe as _}; 15use {defmt_rtt as _, panic_probe as _};
16 16
@@ -70,6 +70,6 @@ async fn main(_spawner: Spawner) {
70 info!("portb = {:02x}", portb[0]); 70 info!("portb = {:02x}", portb[0]);
71 val = !val; 71 val = !val;
72 72
73 Timer::after(Duration::from_secs(1)).await; 73 Timer::after_secs(1).await;
74 } 74 }
75} 75}
diff --git a/examples/rp/src/bin/i2c_slave.rs b/examples/rp/src/bin/i2c_slave.rs
index 7de300fb8..151b083a4 100644
--- a/examples/rp/src/bin/i2c_slave.rs
+++ b/examples/rp/src/bin/i2c_slave.rs
@@ -7,7 +7,7 @@ use defmt::*;
7use embassy_executor::Spawner; 7use embassy_executor::Spawner;
8use embassy_rp::peripherals::{I2C0, I2C1}; 8use embassy_rp::peripherals::{I2C0, I2C1};
9use embassy_rp::{bind_interrupts, i2c, i2c_slave}; 9use embassy_rp::{bind_interrupts, i2c, i2c_slave};
10use embassy_time::{Duration, Timer}; 10use embassy_time::Timer;
11use embedded_hal_async::i2c::I2c; 11use embedded_hal_async::i2c::I2c;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
@@ -81,7 +81,7 @@ async fn controller_task(mut con: i2c::I2c<'static, I2C0, i2c::Async>) {
81 Err(e) => error!("Error writing {}", e), 81 Err(e) => error!("Error writing {}", e),
82 } 82 }
83 83
84 Timer::after(Duration::from_millis(100)).await; 84 Timer::after_millis(100).await;
85 } 85 }
86 match con.read(DEV_ADDR, &mut resp_buff).await { 86 match con.read(DEV_ADDR, &mut resp_buff).await {
87 Ok(_) => info!("read response: {}", resp_buff), 87 Ok(_) => info!("read response: {}", resp_buff),
@@ -91,7 +91,7 @@ async fn controller_task(mut con: i2c::I2c<'static, I2C0, i2c::Async>) {
91 Ok(_) => info!("write_read response: {}", resp_buff), 91 Ok(_) => info!("write_read response: {}", resp_buff),
92 Err(e) => error!("Error writing {}", e), 92 Err(e) => error!("Error writing {}", e),
93 } 93 }
94 Timer::after(Duration::from_millis(100)).await; 94 Timer::after_millis(100).await;
95 } 95 }
96} 96}
97 97
diff --git a/examples/rp/src/bin/lora_p2p_receive.rs b/examples/rp/src/bin/lora_p2p_receive.rs
index 5891826fd..d5843fdcd 100644
--- a/examples/rp/src/bin/lora_p2p_receive.rs
+++ b/examples/rp/src/bin/lora_p2p_receive.rs
@@ -11,7 +11,7 @@ use embassy_executor::Spawner;
11use embassy_lora::iv::GenericSx126xInterfaceVariant; 11use embassy_lora::iv::GenericSx126xInterfaceVariant;
12use embassy_rp::gpio::{Input, Level, Output, Pin, Pull}; 12use embassy_rp::gpio::{Input, Level, Output, Pin, Pull};
13use embassy_rp::spi::{Config, Spi}; 13use embassy_rp::spi::{Config, Spi};
14use embassy_time::{Delay, Duration, Timer}; 14use embassy_time::{Delay, Timer};
15use lora_phy::mod_params::*; 15use lora_phy::mod_params::*;
16use lora_phy::sx1261_2::SX1261_2; 16use lora_phy::sx1261_2::SX1261_2;
17use lora_phy::LoRa; 17use lora_phy::LoRa;
@@ -96,7 +96,7 @@ async fn main(_spawner: Spawner) {
96 { 96 {
97 info!("rx successful"); 97 info!("rx successful");
98 debug_indicator.set_high(); 98 debug_indicator.set_high();
99 Timer::after(Duration::from_secs(5)).await; 99 Timer::after_secs(5).await;
100 debug_indicator.set_low(); 100 debug_indicator.set_low();
101 } else { 101 } else {
102 info!("rx unknown packet"); 102 info!("rx unknown packet");
diff --git a/examples/rp/src/bin/lora_p2p_send_multicore.rs b/examples/rp/src/bin/lora_p2p_send_multicore.rs
index e31aa62a2..ccf44987c 100644
--- a/examples/rp/src/bin/lora_p2p_send_multicore.rs
+++ b/examples/rp/src/bin/lora_p2p_send_multicore.rs
@@ -15,7 +15,7 @@ use embassy_rp::peripherals::SPI1;
15use embassy_rp::spi::{Async, Config, Spi}; 15use embassy_rp::spi::{Async, Config, Spi};
16use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 16use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
17use embassy_sync::channel::Channel; 17use embassy_sync::channel::Channel;
18use embassy_time::{Delay, Duration, Timer}; 18use embassy_time::{Delay, Timer};
19use lora_phy::mod_params::*; 19use lora_phy::mod_params::*;
20use lora_phy::sx1261_2::SX1261_2; 20use lora_phy::sx1261_2::SX1261_2;
21use lora_phy::LoRa; 21use lora_phy::LoRa;
@@ -59,7 +59,7 @@ async fn core0_task() {
59 info!("Hello from core 0"); 59 info!("Hello from core 0");
60 loop { 60 loop {
61 CHANNEL.send([0x01u8, 0x02u8, 0x03u8]).await; 61 CHANNEL.send([0x01u8, 0x02u8, 0x03u8]).await;
62 Timer::after(Duration::from_millis(60 * 1000)).await; 62 Timer::after_millis(60 * 1000).await;
63 } 63 }
64} 64}
65 65
diff --git a/examples/rp/src/bin/multicore.rs b/examples/rp/src/bin/multicore.rs
index bf017f6a7..43eaf8b0a 100644
--- a/examples/rp/src/bin/multicore.rs
+++ b/examples/rp/src/bin/multicore.rs
@@ -13,7 +13,7 @@ use embassy_rp::multicore::{spawn_core1, Stack};
13use embassy_rp::peripherals::PIN_25; 13use embassy_rp::peripherals::PIN_25;
14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex; 14use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
15use embassy_sync::channel::Channel; 15use embassy_sync::channel::Channel;
16use embassy_time::{Duration, Timer}; 16use embassy_time::Timer;
17use static_cell::StaticCell; 17use static_cell::StaticCell;
18use {defmt_rtt as _, panic_probe as _}; 18use {defmt_rtt as _, panic_probe as _};
19 19
@@ -46,9 +46,9 @@ async fn core0_task() {
46 info!("Hello from core 0"); 46 info!("Hello from core 0");
47 loop { 47 loop {
48 CHANNEL.send(LedState::On).await; 48 CHANNEL.send(LedState::On).await;
49 Timer::after(Duration::from_millis(100)).await; 49 Timer::after_millis(100).await;
50 CHANNEL.send(LedState::Off).await; 50 CHANNEL.send(LedState::Off).await;
51 Timer::after(Duration::from_millis(400)).await; 51 Timer::after_millis(400).await;
52 } 52 }
53} 53}
54 54
diff --git a/examples/rp/src/bin/multiprio.rs b/examples/rp/src/bin/multiprio.rs
index 9ace4cd68..28f621437 100644
--- a/examples/rp/src/bin/multiprio.rs
+++ b/examples/rp/src/bin/multiprio.rs
@@ -62,7 +62,7 @@ use defmt::{info, unwrap};
62use embassy_executor::{Executor, InterruptExecutor}; 62use embassy_executor::{Executor, InterruptExecutor};
63use embassy_rp::interrupt; 63use embassy_rp::interrupt;
64use embassy_rp::interrupt::{InterruptExt, Priority}; 64use embassy_rp::interrupt::{InterruptExt, Priority};
65use embassy_time::{Duration, Instant, Timer, TICK_HZ}; 65use embassy_time::{Instant, Timer, TICK_HZ};
66use static_cell::StaticCell; 66use static_cell::StaticCell;
67use {defmt_rtt as _, panic_probe as _}; 67use {defmt_rtt as _, panic_probe as _};
68 68
@@ -70,7 +70,7 @@ use {defmt_rtt as _, panic_probe as _};
70async fn run_high() { 70async fn run_high() {
71 loop { 71 loop {
72 info!(" [high] tick!"); 72 info!(" [high] tick!");
73 Timer::after(Duration::from_ticks(673740)).await; 73 Timer::after_ticks(673740).await;
74 } 74 }
75} 75}
76 76
@@ -87,7 +87,7 @@ async fn run_med() {
87 let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; 87 let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
88 info!(" [med] done in {} ms", ms); 88 info!(" [med] done in {} ms", ms);
89 89
90 Timer::after(Duration::from_ticks(53421)).await; 90 Timer::after_ticks(53421).await;
91 } 91 }
92} 92}
93 93
@@ -104,7 +104,7 @@ async fn run_low() {
104 let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ; 104 let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
105 info!("[low] done in {} ms", ms); 105 info!("[low] done in {} ms", ms);
106 106
107 Timer::after(Duration::from_ticks(82983)).await; 107 Timer::after_ticks(82983).await;
108 } 108 }
109} 109}
110 110
diff --git a/examples/rp/src/bin/pio_hd44780.rs b/examples/rp/src/bin/pio_hd44780.rs
index d80c5c24b..5e5a6f9a3 100644
--- a/examples/rp/src/bin/pio_hd44780.rs
+++ b/examples/rp/src/bin/pio_hd44780.rs
@@ -15,7 +15,7 @@ use embassy_rp::pio::{
15}; 15};
16use embassy_rp::pwm::{self, Pwm}; 16use embassy_rp::pwm::{self, Pwm};
17use embassy_rp::{bind_interrupts, into_ref, Peripheral, PeripheralRef}; 17use embassy_rp::{bind_interrupts, into_ref, Peripheral, PeripheralRef};
18use embassy_time::{Duration, Instant, Timer}; 18use embassy_time::{Instant, Timer};
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
20 20
21bind_interrupts!(pub struct Irqs { 21bind_interrupts!(pub struct Irqs {
@@ -66,7 +66,7 @@ async fn main(_spawner: Spawner) {
66 let mut buf = Buf([0; 16], 0); 66 let mut buf = Buf([0; 16], 0);
67 write!(buf, "up {}s", Instant::now().as_micros() as f32 / 1e6).unwrap(); 67 write!(buf, "up {}s", Instant::now().as_micros() as f32 / 1e6).unwrap();
68 hd.add_line(&buf.0[0..buf.1]).await; 68 hd.add_line(&buf.0[0..buf.1]).await;
69 Timer::after(Duration::from_secs(1)).await; 69 Timer::after_secs(1).await;
70 } 70 }
71} 71}
72 72
diff --git a/examples/rp/src/bin/pio_ws2812.rs b/examples/rp/src/bin/pio_ws2812.rs
index 5c0c60246..7b3259538 100644
--- a/examples/rp/src/bin/pio_ws2812.rs
+++ b/examples/rp/src/bin/pio_ws2812.rs
@@ -13,7 +13,7 @@ use embassy_rp::pio::{
13 Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine, 13 Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine,
14}; 14};
15use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef}; 15use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef};
16use embassy_time::{Duration, Timer}; 16use embassy_time::Timer;
17use fixed::types::U24F8; 17use fixed::types::U24F8;
18use fixed_macro::fixed; 18use fixed_macro::fixed;
19use smart_leds::RGB8; 19use smart_leds::RGB8;
@@ -153,7 +153,7 @@ async fn main(_spawner: Spawner) {
153 } 153 }
154 ws2812.write(&data).await; 154 ws2812.write(&data).await;
155 155
156 Timer::after(Duration::from_millis(10)).await; 156 Timer::after_millis(10).await;
157 } 157 }
158 } 158 }
159} 159}
diff --git a/examples/rp/src/bin/pwm.rs b/examples/rp/src/bin/pwm.rs
index 9d919287c..a99e88003 100644
--- a/examples/rp/src/bin/pwm.rs
+++ b/examples/rp/src/bin/pwm.rs
@@ -9,7 +9,7 @@
9use defmt::*; 9use defmt::*;
10use embassy_executor::Spawner; 10use embassy_executor::Spawner;
11use embassy_rp::pwm::{Config, Pwm}; 11use embassy_rp::pwm::{Config, Pwm};
12use embassy_time::{Duration, Timer}; 12use embassy_time::Timer;
13use {defmt_rtt as _, panic_probe as _}; 13use {defmt_rtt as _, panic_probe as _};
14 14
15#[embassy_executor::main] 15#[embassy_executor::main]
@@ -23,7 +23,7 @@ async fn main(_spawner: Spawner) {
23 23
24 loop { 24 loop {
25 info!("current LED duty cycle: {}/32768", c.compare_b); 25 info!("current LED duty cycle: {}/32768", c.compare_b);
26 Timer::after(Duration::from_secs(1)).await; 26 Timer::after_secs(1).await;
27 c.compare_b = c.compare_b.rotate_left(4); 27 c.compare_b = c.compare_b.rotate_left(4);
28 pwm.set_config(&c); 28 pwm.set_config(&c);
29 } 29 }
diff --git a/examples/rp/src/bin/rtc.rs b/examples/rp/src/bin/rtc.rs
index 15aa8243f..667876db5 100644
--- a/examples/rp/src/bin/rtc.rs
+++ b/examples/rp/src/bin/rtc.rs
@@ -7,7 +7,7 @@
7use defmt::*; 7use defmt::*;
8use embassy_executor::Spawner; 8use embassy_executor::Spawner;
9use embassy_rp::rtc::{DateTime, DayOfWeek, Rtc}; 9use embassy_rp::rtc::{DateTime, DayOfWeek, Rtc};
10use embassy_time::{Duration, Timer}; 10use embassy_time::Timer;
11use {defmt_rtt as _, panic_probe as _}; 11use {defmt_rtt as _, panic_probe as _};
12 12
13#[embassy_executor::main] 13#[embassy_executor::main]
@@ -31,7 +31,7 @@ async fn main(_spawner: Spawner) {
31 rtc.set_datetime(now).unwrap(); 31 rtc.set_datetime(now).unwrap();
32 } 32 }
33 33
34 Timer::after(Duration::from_millis(20000)).await; 34 Timer::after_millis(20000).await;
35 35
36 if let Ok(dt) = rtc.now() { 36 if let Ok(dt) = rtc.now() {
37 info!( 37 info!(
@@ -41,6 +41,6 @@ async fn main(_spawner: Spawner) {
41 } 41 }
42 42
43 info!("Reboot."); 43 info!("Reboot.");
44 Timer::after(Duration::from_millis(200)).await; 44 Timer::after_millis(200).await;
45 cortex_m::peripheral::SCB::sys_reset(); 45 cortex_m::peripheral::SCB::sys_reset();
46} 46}
diff --git a/examples/rp/src/bin/spi_async.rs b/examples/rp/src/bin/spi_async.rs
index 328074e8b..f5a2d334e 100644
--- a/examples/rp/src/bin/spi_async.rs
+++ b/examples/rp/src/bin/spi_async.rs
@@ -8,7 +8,7 @@
8use defmt::*; 8use defmt::*;
9use embassy_executor::Spawner; 9use embassy_executor::Spawner;
10use embassy_rp::spi::{Config, Spi}; 10use embassy_rp::spi::{Config, Spi};
11use embassy_time::{Duration, Timer}; 11use embassy_time::Timer;
12use {defmt_rtt as _, panic_probe as _}; 12use {defmt_rtt as _, panic_probe as _};
13 13
14#[embassy_executor::main] 14#[embassy_executor::main]
@@ -27,6 +27,6 @@ async fn main(_spawner: Spawner) {
27 let mut rx_buf = [0_u8; 6]; 27 let mut rx_buf = [0_u8; 6];
28 spi.transfer(&mut rx_buf, &tx_buf).await.unwrap(); 28 spi.transfer(&mut rx_buf, &tx_buf).await.unwrap();
29 info!("{:?}", rx_buf); 29 info!("{:?}", rx_buf);
30 Timer::after(Duration::from_secs(1)).await; 30 Timer::after_secs(1).await;
31 } 31 }
32} 32}
diff --git a/examples/rp/src/bin/uart_buffered_split.rs b/examples/rp/src/bin/uart_buffered_split.rs
index d3e67c8ed..14e8810a4 100644
--- a/examples/rp/src/bin/uart_buffered_split.rs
+++ b/examples/rp/src/bin/uart_buffered_split.rs
@@ -13,7 +13,7 @@ use embassy_executor::Spawner;
13use embassy_rp::bind_interrupts; 13use embassy_rp::bind_interrupts;
14use embassy_rp::peripherals::UART0; 14use embassy_rp::peripherals::UART0;
15use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config}; 15use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config};
16use embassy_time::{Duration, Timer}; 16use embassy_time::Timer;
17use embedded_io_async::{Read, Write}; 17use embedded_io_async::{Read, Write};
18use static_cell::make_static; 18use static_cell::make_static;
19use {defmt_rtt as _, panic_probe as _}; 19use {defmt_rtt as _, panic_probe as _};
@@ -42,7 +42,7 @@ async fn main(spawner: Spawner) {
42 ]; 42 ];
43 info!("TX {:?}", data); 43 info!("TX {:?}", data);
44 tx.write_all(&data).await.unwrap(); 44 tx.write_all(&data).await.unwrap();
45 Timer::after(Duration::from_secs(1)).await; 45 Timer::after_secs(1).await;
46 } 46 }
47} 47}
48 48
diff --git a/examples/rp/src/bin/uart_unidir.rs b/examples/rp/src/bin/uart_unidir.rs
index c1515a911..42c8b432e 100644
--- a/examples/rp/src/bin/uart_unidir.rs
+++ b/examples/rp/src/bin/uart_unidir.rs
@@ -14,7 +14,7 @@ use embassy_executor::Spawner;
14use embassy_rp::bind_interrupts; 14use embassy_rp::bind_interrupts;
15use embassy_rp::peripherals::UART1; 15use embassy_rp::peripherals::UART1;
16use embassy_rp::uart::{Async, Config, InterruptHandler, UartRx, UartTx}; 16use embassy_rp::uart::{Async, Config, InterruptHandler, UartRx, UartTx};
17use embassy_time::{Duration, Timer}; 17use embassy_time::Timer;
18use {defmt_rtt as _, panic_probe as _}; 18use {defmt_rtt as _, panic_probe as _};
19 19
20bind_interrupts!(struct Irqs { 20bind_interrupts!(struct Irqs {
@@ -35,7 +35,7 @@ async fn main(spawner: Spawner) {
35 let data = [1u8, 2, 3, 4, 5, 6, 7, 8]; 35 let data = [1u8, 2, 3, 4, 5, 6, 7, 8];
36 info!("TX {:?}", data); 36 info!("TX {:?}", data);
37 uart_tx.write(&data).await.unwrap(); 37 uart_tx.write(&data).await.unwrap();
38 Timer::after(Duration::from_secs(1)).await; 38 Timer::after_secs(1).await;
39 } 39 }
40} 40}
41 41
diff --git a/examples/rp/src/bin/usb_logger.rs b/examples/rp/src/bin/usb_logger.rs
index 9c5e6897d..791f15e56 100644
--- a/examples/rp/src/bin/usb_logger.rs
+++ b/examples/rp/src/bin/usb_logger.rs
@@ -10,7 +10,7 @@ use embassy_executor::Spawner;
10use embassy_rp::bind_interrupts; 10use embassy_rp::bind_interrupts;
11use embassy_rp::peripherals::USB; 11use embassy_rp::peripherals::USB;
12use embassy_rp::usb::{Driver, InterruptHandler}; 12use embassy_rp::usb::{Driver, InterruptHandler};
13use embassy_time::{Duration, Timer}; 13use embassy_time::Timer;
14use {defmt_rtt as _, panic_probe as _}; 14use {defmt_rtt as _, panic_probe as _};
15 15
16bind_interrupts!(struct Irqs { 16bind_interrupts!(struct Irqs {
@@ -32,6 +32,6 @@ async fn main(spawner: Spawner) {
32 loop { 32 loop {
33 counter += 1; 33 counter += 1;
34 log::info!("Tick {}", counter); 34 log::info!("Tick {}", counter);
35 Timer::after(Duration::from_secs(1)).await; 35 Timer::after_secs(1).await;
36 } 36 }
37} 37}
diff --git a/examples/rp/src/bin/watchdog.rs b/examples/rp/src/bin/watchdog.rs
index fe5eaf926..b6af518af 100644
--- a/examples/rp/src/bin/watchdog.rs
+++ b/examples/rp/src/bin/watchdog.rs
@@ -24,7 +24,7 @@ async fn main(_spawner: Spawner) {
24 24
25 // Set the LED high for 2 seconds so we know when we're about to start the watchdog 25 // Set the LED high for 2 seconds so we know when we're about to start the watchdog
26 led.set_high(); 26 led.set_high();
27 Timer::after(Duration::from_secs(2)).await; 27 Timer::after_secs(2).await;
28 28
29 // Set to watchdog to reset if it's not fed within 1.05 seconds, and start it 29 // Set to watchdog to reset if it's not fed within 1.05 seconds, and start it
30 watchdog.start(Duration::from_millis(1_050)); 30 watchdog.start(Duration::from_millis(1_050));
@@ -33,9 +33,9 @@ async fn main(_spawner: Spawner) {
33 // Blink once a second for 5 seconds, feed the watchdog timer once a second to avoid a reset 33 // Blink once a second for 5 seconds, feed the watchdog timer once a second to avoid a reset
34 for _ in 1..=5 { 34 for _ in 1..=5 {
35 led.set_low(); 35 led.set_low();
36 Timer::after(Duration::from_millis(500)).await; 36 Timer::after_millis(500).await;
37 led.set_high(); 37 led.set_high();
38 Timer::after(Duration::from_millis(500)).await; 38 Timer::after_millis(500).await;
39 info!("Feeding watchdog"); 39 info!("Feeding watchdog");
40 watchdog.feed(); 40 watchdog.feed();
41 } 41 }
@@ -45,8 +45,8 @@ async fn main(_spawner: Spawner) {
45 // The processor should reset in 1.05 seconds. 45 // The processor should reset in 1.05 seconds.
46 loop { 46 loop {
47 led.set_low(); 47 led.set_low();
48 Timer::after(Duration::from_millis(100)).await; 48 Timer::after_millis(100).await;
49 led.set_high(); 49 led.set_high();
50 Timer::after(Duration::from_millis(100)).await; 50 Timer::after_millis(100).await;
51 } 51 }
52} 52}
diff --git a/examples/rp/src/bin/wifi_tcp_server.rs b/examples/rp/src/bin/wifi_tcp_server.rs
index 64cf95171..c00fff216 100644
--- a/examples/rp/src/bin/wifi_tcp_server.rs
+++ b/examples/rp/src/bin/wifi_tcp_server.rs
@@ -105,7 +105,7 @@ async fn main(spawner: Spawner) {
105 // Wait for DHCP, not necessary when using static IP 105 // Wait for DHCP, not necessary when using static IP
106 info!("waiting for DHCP..."); 106 info!("waiting for DHCP...");
107 while !stack.is_config_up() { 107 while !stack.is_config_up() {
108 Timer::after(Duration::from_millis(100)).await; 108 Timer::after_millis(100).await;
109 } 109 }
110 info!("DHCP is now up!"); 110 info!("DHCP is now up!");
111 111