time: Update examples, tests, and other code to use new Timer::after_x convenience methods

This commit is contained in:
Adam Greig
2023-10-15 00:57:25 +01:00
parent 7559f9e583
commit 0621e957a0
174 changed files with 496 additions and 501 deletions

View File

@@ -24,7 +24,7 @@ async fn main(_spawner: Spawner) {
// Set the LED high for 2 seconds so we know when we're about to start the watchdog
led.set_high();
Timer::after(Duration::from_secs(2)).await;
Timer::after_secs(2).await;
// Set to watchdog to reset if it's not fed within 1.05 seconds, and start it
watchdog.start(Duration::from_millis(1_050));
@@ -33,9 +33,9 @@ async fn main(_spawner: Spawner) {
// Blink once a second for 5 seconds, feed the watchdog timer once a second to avoid a reset
for _ in 1..=5 {
led.set_low();
Timer::after(Duration::from_millis(500)).await;
Timer::after_millis(500).await;
led.set_high();
Timer::after(Duration::from_millis(500)).await;
Timer::after_millis(500).await;
info!("Feeding watchdog");
watchdog.feed();
}
@@ -45,8 +45,8 @@ async fn main(_spawner: Spawner) {
// The processor should reset in 1.05 seconds.
loop {
led.set_low();
Timer::after(Duration::from_millis(100)).await;
Timer::after_millis(100).await;
led.set_high();
Timer::after(Duration::from_millis(100)).await;
Timer::after_millis(100).await;
}
}