mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 14:22:33 +00:00
time: Update examples, tests, and other code to use new Timer::after_x convenience methods
This commit is contained in:
parent
7559f9e583
commit
0621e957a0
@ -1,5 +1,5 @@
|
||||
use embassy_futures::yield_now;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal_1::digital::OutputPin;
|
||||
use futures::FutureExt;
|
||||
|
||||
@ -51,9 +51,9 @@ where
|
||||
pub async fn init(&mut self) {
|
||||
// Reset
|
||||
self.pwr.set_low().unwrap();
|
||||
Timer::after(Duration::from_millis(20)).await;
|
||||
Timer::after_millis(20).await;
|
||||
self.pwr.set_high().unwrap();
|
||||
Timer::after(Duration::from_millis(250)).await;
|
||||
Timer::after_millis(250).await;
|
||||
|
||||
while self
|
||||
.read32_swapped(REG_BUS_TEST_RO)
|
||||
|
@ -2,7 +2,7 @@ use core::cmp::{max, min};
|
||||
|
||||
use ch::driver::LinkState;
|
||||
use embassy_net_driver_channel as ch;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
|
||||
pub use crate::bus::SpiBusCyw43;
|
||||
use crate::consts::*;
|
||||
@ -87,22 +87,22 @@ impl<'a> Control<'a> {
|
||||
self.set_iovar("country", &country_info.to_bytes()).await;
|
||||
|
||||
// set country takes some time, next ioctls fail if we don't wait.
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
// Set antenna to chip antenna
|
||||
self.ioctl_set_u32(IOCTL_CMD_ANTDIV, 0, 0).await;
|
||||
|
||||
self.set_iovar_u32("bus:txglom", 0).await;
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
//self.set_iovar_u32("apsta", 1).await; // this crashes, also we already did it before...??
|
||||
//Timer::after(Duration::from_millis(100)).await;
|
||||
//Timer::after_millis(100).await;
|
||||
self.set_iovar_u32("ampdu_ba_wsize", 8).await;
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
self.set_iovar_u32("ampdu_mpdu", 4).await;
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
//self.set_iovar_u32("ampdu_rx_factor", 0).await; // this crashes
|
||||
|
||||
//Timer::after(Duration::from_millis(100)).await;
|
||||
//Timer::after_millis(100).await;
|
||||
|
||||
// evts
|
||||
let mut evts = EventMask {
|
||||
@ -121,17 +121,17 @@ impl<'a> Control<'a> {
|
||||
|
||||
self.set_iovar("bsscfg:event_msgs", &evts.to_bytes()).await;
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
// set wifi up
|
||||
self.up().await;
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
self.ioctl_set_u32(110, 0, 1).await; // SET_GMODE = auto
|
||||
self.ioctl_set_u32(142, 0, 0).await; // SET_BAND = any
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
self.state_ch.set_ethernet_address(mac_addr);
|
||||
|
||||
@ -185,7 +185,7 @@ impl<'a> Control<'a> {
|
||||
self.set_iovar_u32x2("bsscfg:sup_wpa2_eapver", 0, 0xFFFF_FFFF).await;
|
||||
self.set_iovar_u32x2("bsscfg:sup_wpa_tmo", 0, 2500).await;
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
let mut pfi = PassphraseInfo {
|
||||
len: passphrase.len() as _,
|
||||
@ -297,7 +297,7 @@ impl<'a> Control<'a> {
|
||||
if security != Security::OPEN {
|
||||
self.set_iovar_u32x2("bsscfg:wpa_auth", 0, 0x0084).await; // wpa_auth = WPA2_AUTH_PSK | WPA_AUTH_PSK
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
// Set passphrase
|
||||
let mut pfi = PassphraseInfo {
|
||||
|
@ -555,14 +555,14 @@ where
|
||||
|
||||
self.bus.bp_write8(base + AI_RESETCTRL_OFFSET, 0).await;
|
||||
|
||||
Timer::after(Duration::from_millis(1)).await;
|
||||
Timer::after_millis(1).await;
|
||||
|
||||
self.bus
|
||||
.bp_write8(base + AI_IOCTRL_OFFSET, AI_IOCTRL_BIT_CLOCK_EN)
|
||||
.await;
|
||||
let _ = self.bus.bp_read8(base + AI_IOCTRL_OFFSET).await;
|
||||
|
||||
Timer::after(Duration::from_millis(1)).await;
|
||||
Timer::after_millis(1).await;
|
||||
}
|
||||
|
||||
async fn core_is_up(&mut self, core: Core) -> bool {
|
||||
|
@ -76,9 +76,7 @@ where
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(_) => return Err(SpiDeviceError::DelayUsNotSupported),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => {
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_micros(*us as _)).await
|
||||
}
|
||||
Operation::DelayUs(us) => embassy_time::Timer::after_micros(*us as _).await,
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -143,9 +141,7 @@ where
|
||||
#[cfg(not(feature = "time"))]
|
||||
Operation::DelayUs(_) => return Err(SpiDeviceError::DelayUsNotSupported),
|
||||
#[cfg(feature = "time")]
|
||||
Operation::DelayUs(us) => {
|
||||
embassy_time::Timer::after(embassy_time::Duration::from_micros(*us as _)).await
|
||||
}
|
||||
Operation::DelayUs(us) => embassy_time::Timer::after_micros(*us as _).await,
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -34,6 +34,6 @@ impl lorawan_device::async_device::radio::Timer for LoraTimer {
|
||||
}
|
||||
|
||||
async fn delay_ms(&mut self, millis: u64) {
|
||||
Timer::after(Duration::from_millis(millis)).await
|
||||
Timer::after_millis(millis).await
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ pub use crc32::ETH_FCS;
|
||||
use crc8::crc8;
|
||||
use embassy_futures::select::{select, Either};
|
||||
use embassy_net_driver_channel as ch;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal_1::digital::OutputPin;
|
||||
use embedded_hal_async::digital::Wait;
|
||||
use embedded_hal_async::spi::{Error, Operation, SpiDevice};
|
||||
@ -609,12 +609,12 @@ pub async fn new<const N_RX: usize, const N_TX: usize, SPI: SpiDevice, INT: Wait
|
||||
reset.set_low().unwrap();
|
||||
|
||||
// Wait t1: 20-43mS
|
||||
Timer::after(Duration::from_millis(30)).await;
|
||||
Timer::after_millis(30).await;
|
||||
|
||||
reset.set_high().unwrap();
|
||||
|
||||
// Wait t3: 50mS
|
||||
Timer::after(Duration::from_millis(50)).await;
|
||||
Timer::after_millis(50).await;
|
||||
|
||||
// Create device
|
||||
let mut mac = ADIN1110::new(spi_dev, spi_crc, append_fcs_on_tx);
|
||||
|
@ -169,9 +169,9 @@ where
|
||||
pub async fn run(mut self) -> ! {
|
||||
debug!("resetting...");
|
||||
self.reset.set_low().unwrap();
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
self.reset.set_high().unwrap();
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
let mut tx_buf = [0u8; MAX_SPI_BUFFER_SIZE];
|
||||
let mut rx_buf = [0u8; MAX_SPI_BUFFER_SIZE];
|
||||
|
@ -8,7 +8,7 @@ mod device;
|
||||
use embassy_futures::select::{select, Either};
|
||||
use embassy_net_driver_channel as ch;
|
||||
use embassy_net_driver_channel::driver::LinkState;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal::digital::OutputPin;
|
||||
use embedded_hal_async::digital::Wait;
|
||||
use embedded_hal_async::spi::SpiDevice;
|
||||
@ -95,12 +95,12 @@ pub async fn new<'a, const N_RX: usize, const N_TX: usize, C: Chip, SPI: SpiDevi
|
||||
// Reset the chip.
|
||||
reset.set_low().ok();
|
||||
// Ensure the reset is registered.
|
||||
Timer::after(Duration::from_millis(1)).await;
|
||||
Timer::after_millis(1).await;
|
||||
reset.set_high().ok();
|
||||
|
||||
// Wait for PLL lock. Some chips are slower than others.
|
||||
// Slowest is w5100s which is 100ms, so let's just wait that.
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
let mac = WiznetDevice::new(spi_dev, mac_addr).await.unwrap();
|
||||
|
||||
|
@ -5,7 +5,7 @@ use core::task::Poll;
|
||||
use atomic_polyfill::{AtomicU8, Ordering};
|
||||
use embassy_hal_internal::atomic_ring_buffer::RingBuffer;
|
||||
use embassy_sync::waitqueue::AtomicWaker;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
|
||||
use super::*;
|
||||
use crate::clocks::clk_peri_freq;
|
||||
@ -435,7 +435,7 @@ impl<'d, T: Instance> BufferedUartTx<'d, T> {
|
||||
Self::flush().await.unwrap();
|
||||
while self.busy() {}
|
||||
regs.uartlcr_h().write_set(|w| w.set_brk(true));
|
||||
Timer::after(Duration::from_micros(wait_usecs)).await;
|
||||
Timer::after_micros(wait_usecs).await;
|
||||
regs.uartlcr_h().write_clear(|w| w.set_brk(true));
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use atomic_polyfill::{AtomicU16, Ordering};
|
||||
use embassy_futures::select::{select, Either};
|
||||
use embassy_hal_internal::{into_ref, PeripheralRef};
|
||||
use embassy_sync::waitqueue::AtomicWaker;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use pac::uart::regs::Uartris;
|
||||
|
||||
use crate::clocks::clk_peri_freq;
|
||||
@ -187,7 +187,7 @@ impl<'d, T: Instance, M: Mode> UartTx<'d, T, M> {
|
||||
self.blocking_flush().unwrap();
|
||||
while self.busy() {}
|
||||
regs.uartlcr_h().write_set(|w| w.set_brk(true));
|
||||
Timer::after(Duration::from_micros(wait_usecs)).await;
|
||||
Timer::after_micros(wait_usecs).await;
|
||||
regs.uartlcr_h().write_clear(|w| w.set_brk(true));
|
||||
}
|
||||
}
|
||||
|
@ -36,11 +36,11 @@ mod eha {
|
||||
|
||||
impl embedded_hal_async::delay::DelayUs for Delay {
|
||||
async fn delay_us(&mut self, micros: u32) {
|
||||
Timer::after(Duration::from_micros(micros as _)).await
|
||||
Timer::after_micros(micros as _).await
|
||||
}
|
||||
|
||||
async fn delay_ms(&mut self, millis: u32) {
|
||||
Timer::after(Duration::from_millis(millis as _)).await
|
||||
Timer::after_millis(millis as _).await
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -19,8 +19,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ async fn main(_s: Spawner) {
|
||||
let mut aligned = AlignedBuffer([0; 1]);
|
||||
let mut updater = BlockingFirmwareUpdater::new(config, &mut aligned.0);
|
||||
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
watchdog.feed();
|
||||
led.set_high();
|
||||
let mut offset = 0;
|
||||
@ -61,7 +61,7 @@ async fn main(_s: Spawner) {
|
||||
watchdog.feed();
|
||||
defmt::info!("firmware written, marking update");
|
||||
updater.mark_updated().unwrap();
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
Timer::after_secs(2).await;
|
||||
led.set_low();
|
||||
defmt::info!("update marked, resetting");
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::gpio;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use gpio::{Level, Output};
|
||||
use {defmt_rtt as _, panic_reset as _};
|
||||
|
||||
@ -15,9 +15,9 @@ async fn main(_s: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,9 +16,9 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,21 +6,21 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
let mut led = Output::new(p.PB7, Level::High, Speed::Low);
|
||||
led.set_high();
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,21 +6,21 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) {
|
||||
let p = embassy_stm32::init(Default::default());
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
let mut led = Output::new(p.PB14, Level::High, Speed::Low);
|
||||
led.set_high();
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use embassy_stm32::exti::ExtiInput;
|
||||
use embassy_stm32::flash::{Flash, WRITE_SIZE};
|
||||
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[cfg(feature = "skip-include")]
|
||||
@ -46,6 +46,6 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
updater.mark_updated().await.unwrap();
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,9 +16,9 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use embassy_stm32::exti::ExtiInput;
|
||||
use embassy_stm32::flash::{Flash, WRITE_SIZE};
|
||||
use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[cfg(feature = "skip-include")]
|
||||
@ -46,6 +46,6 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
updater.mark_updated().await.unwrap();
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,9 +16,9 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,9 +16,9 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
use defmt_rtt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use panic_reset as _;
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -16,9 +16,9 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use core::future::poll_fn;
|
||||
use core::task::Poll;
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
#[cfg(feature = "log")]
|
||||
use log::*;
|
||||
use panic_probe as _;
|
||||
@ -34,7 +34,7 @@ async fn run1() {
|
||||
info!("DING DONG");
|
||||
#[cfg(not(feature = "log"))]
|
||||
rtos_trace::trace::marker(13);
|
||||
Timer::after(Duration::from_ticks(16000)).await;
|
||||
Timer::after_ticks(16000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ mod app {
|
||||
use defmt::info;
|
||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||
use embassy_nrf::peripherals;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
|
||||
#[shared]
|
||||
struct Shared {}
|
||||
@ -34,10 +34,10 @@ mod app {
|
||||
loop {
|
||||
info!("off!");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
info!("on!");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -14,8 +14,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||
use embassy_sync::channel::Channel;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
enum LedState {
|
||||
@ -21,9 +21,9 @@ static CHANNEL: Channel<ThreadModeRawMutex, LedState, 1> = Channel::new();
|
||||
async fn my_task() {
|
||||
loop {
|
||||
CHANNEL.send(LedState::On).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
CHANNEL.send(LedState::Off).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_nrf::gpio::{AnyPin, Level, Output, OutputDrive, Pin};
|
||||
use embassy_sync::blocking_mutex::raw::NoopRawMutex;
|
||||
use embassy_sync::channel::{Channel, Receiver, Sender};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -22,9 +22,9 @@ static CHANNEL: StaticCell<Channel<NoopRawMutex, LedState, 1>> = StaticCell::new
|
||||
async fn send_task(sender: Sender<'static, NoopRawMutex, LedState, 1>) {
|
||||
loop {
|
||||
sender.send(LedState::On).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
sender.send(LedState::Off).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,14 +7,14 @@ use core::task::Poll;
|
||||
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run1() {
|
||||
loop {
|
||||
info!("DING DONG");
|
||||
Timer::after(Duration::from_ticks(16000)).await;
|
||||
Timer::after_ticks(16000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_lora::iv::GenericSx126xInterfaceVariant;
|
||||
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pin as _, Pull};
|
||||
use embassy_nrf::{bind_interrupts, peripherals, spim};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1261_2::SX1261_2;
|
||||
use lora_phy::LoRa;
|
||||
@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut start_indicator = Output::new(p.P1_04, Level::Low, OutputDrive::Standard);
|
||||
|
||||
start_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
start_indicator.set_low();
|
||||
|
||||
let mdltn_params = {
|
||||
@ -89,7 +89,7 @@ async fn main(_spawner: Spawner) {
|
||||
info!("cad successful without activity detected")
|
||||
}
|
||||
debug_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
debug_indicator.set_low();
|
||||
}
|
||||
Err(err) => info!("cad unsuccessful = {}", err),
|
||||
|
@ -11,7 +11,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_lora::iv::GenericSx126xInterfaceVariant;
|
||||
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pin as _, Pull};
|
||||
use embassy_nrf::{bind_interrupts, peripherals, spim};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1261_2::SX1261_2;
|
||||
use lora_phy::LoRa;
|
||||
@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut start_indicator = Output::new(p.P1_04, Level::Low, OutputDrive::Standard);
|
||||
|
||||
start_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
start_indicator.set_low();
|
||||
|
||||
let mut receiving_buffer = [00u8; 100];
|
||||
@ -107,7 +107,7 @@ async fn main(_spawner: Spawner) {
|
||||
{
|
||||
info!("rx successful");
|
||||
debug_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
debug_indicator.set_low();
|
||||
} else {
|
||||
info!("rx unknown packet");
|
||||
|
@ -11,7 +11,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_lora::iv::GenericSx126xInterfaceVariant;
|
||||
use embassy_nrf::gpio::{Input, Level, Output, OutputDrive, Pin as _, Pull};
|
||||
use embassy_nrf::{bind_interrupts, peripherals, spim};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1261_2::SX1261_2;
|
||||
use lora_phy::LoRa;
|
||||
@ -55,7 +55,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut start_indicator = Output::new(p.P1_04, Level::Low, OutputDrive::Standard);
|
||||
|
||||
start_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
start_indicator.set_low();
|
||||
|
||||
let mut receiving_buffer = [00u8; 100];
|
||||
@ -116,7 +116,7 @@ async fn main(_spawner: Spawner) {
|
||||
{
|
||||
info!("rx successful");
|
||||
debug_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
debug_indicator.set_low();
|
||||
} else {
|
||||
info!("rx unknown packet")
|
||||
|
@ -8,7 +8,7 @@
|
||||
use cortex_m_rt::entry;
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Executor;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -16,7 +16,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
async fn run1() {
|
||||
loop {
|
||||
info!("BIG INFREQUENT TICK");
|
||||
Timer::after(Duration::from_ticks(64000)).await;
|
||||
Timer::after_ticks(64000).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -24,7 +24,7 @@ async fn run1() {
|
||||
async fn run2() {
|
||||
loop {
|
||||
info!("tick");
|
||||
Timer::after(Duration::from_ticks(13000)).await;
|
||||
Timer::after_ticks(13000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ use defmt::{info, unwrap};
|
||||
use embassy_executor::{Executor, InterruptExecutor};
|
||||
use embassy_nrf::interrupt;
|
||||
use embassy_nrf::interrupt::{InterruptExt, Priority};
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -70,7 +70,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
async fn run_high() {
|
||||
loop {
|
||||
info!(" [high] tick!");
|
||||
Timer::after(Duration::from_ticks(27374)).await;
|
||||
Timer::after_ticks(27374).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ async fn run_med() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!(" [med] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(23421)).await;
|
||||
Timer::after_ticks(23421).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ async fn run_low() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!("[low] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(32983)).await;
|
||||
Timer::after_ticks(32983).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||
use embassy_sync::mutex::Mutex;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
static MUTEX: Mutex<ThreadModeRawMutex, u32> = Mutex::new(0);
|
||||
@ -20,11 +20,11 @@ async fn my_task() {
|
||||
*m += 1000;
|
||||
|
||||
// Hold the mutex for a long time.
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
info!("end long operation: count = {}", *m);
|
||||
}
|
||||
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -34,7 +34,7 @@ async fn main(spawner: Spawner) {
|
||||
unwrap!(spawner.spawn(my_task()));
|
||||
|
||||
loop {
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
let mut m = MUTEX.lock().await;
|
||||
*m += 1;
|
||||
info!("short operation: count = {}", *m);
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::nvmc::Nvmc;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_storage::nor_flash::{NorFlash, ReadNorFlash};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -15,7 +15,7 @@ async fn main(_spawner: Spawner) {
|
||||
info!("Hello NVMC!");
|
||||
|
||||
// probe-rs run breaks without this, I'm not sure why.
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
|
||||
let mut f = Nvmc::new(p.NVMC);
|
||||
const ADDR: u32 = 0x80000;
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::pdm::{self, Config, Pdm};
|
||||
use embassy_nrf::{bind_interrupts, peripherals};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use fixed::types::I7F1;
|
||||
use num_integer::Roots;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
@ -28,7 +28,7 @@ async fn main(_p: Spawner) {
|
||||
pdm.start().await;
|
||||
|
||||
// wait some time till the microphon settled
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
const SAMPLES: usize = 2048;
|
||||
let mut buf = [0i16; SAMPLES];
|
||||
@ -51,7 +51,7 @@ async fn main(_p: Spawner) {
|
||||
info!("samples: {:?}", &buf);
|
||||
|
||||
pdm.stop().await;
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use defmt::unwrap;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_sync::blocking_mutex::raw::ThreadModeRawMutex;
|
||||
use embassy_sync::pubsub::{DynSubscriber, PubSubChannel, Subscriber};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
/// Create the message bus. It has a queue of 4, supports 3 subscribers and 1 publisher
|
||||
@ -39,7 +39,7 @@ async fn main(spawner: Spawner) {
|
||||
|
||||
let mut index = 0;
|
||||
loop {
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
let message = match index % 3 {
|
||||
0 => Message::A,
|
||||
@ -81,7 +81,7 @@ async fn fast_logger(mut messages: Subscriber<'static, ThreadModeRawMutex, Messa
|
||||
async fn slow_logger(mut messages: DynSubscriber<'static, Message>) {
|
||||
loop {
|
||||
// Do some work
|
||||
Timer::after(Duration::from_millis(2000)).await;
|
||||
Timer::after_millis(2000).await;
|
||||
|
||||
// If the publisher has used the `publish_immediate` function, then we may receive a lag message here
|
||||
let message = messages.next_message().await;
|
||||
@ -98,7 +98,7 @@ async fn slow_logger(mut messages: DynSubscriber<'static, Message>) {
|
||||
async fn slow_logger_pure(mut messages: DynSubscriber<'static, Message>) {
|
||||
loop {
|
||||
// Do some work
|
||||
Timer::after(Duration::from_millis(2000)).await;
|
||||
Timer::after_millis(2000).await;
|
||||
|
||||
// Instead of receiving lags here, we just ignore that and read the next message
|
||||
let message = messages.next_message_pure().await;
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::pwm::{Prescaler, SimplePwm};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// for i in range(1024): print(int((math.sin(i/512*math.pi)*0.4+0.5)**2*32767), ', ', end='')
|
||||
@ -84,6 +84,6 @@ async fn main(_spawner: Spawner) {
|
||||
pwm.set_duty(1, DUTY[(i + 256) % 1024]);
|
||||
pwm.set_duty(2, DUTY[(i + 512) % 1024]);
|
||||
pwm.set_duty(3, DUTY[(i + 768) % 1024]);
|
||||
Timer::after(Duration::from_millis(3)).await;
|
||||
Timer::after_millis(3).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_nrf::pwm::{
|
||||
Config, Prescaler, Sequence, SequenceConfig, SequenceMode, SequencePwm, Sequencer, StartSequence,
|
||||
};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) {
|
||||
// we can abort a sequence if we need to before its complete with pwm.stop()
|
||||
// or stop is also implicitly called when the pwm peripheral is dropped
|
||||
// when it goes out of scope
|
||||
Timer::after(Duration::from_millis(40000)).await;
|
||||
Timer::after_millis(40000).await;
|
||||
info!("pwm stopped early!");
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::pwm::{Config, Prescaler, SequenceConfig, SequencePwm, SingleSequenceMode, SingleSequencer};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -31,6 +31,6 @@ async fn main(_spawner: Spawner) {
|
||||
// we can abort a sequence if we need to before its complete with pwm.stop()
|
||||
// or stop is also implicitly called when the pwm peripheral is dropped
|
||||
// when it goes out of scope
|
||||
Timer::after(Duration::from_millis(20000)).await;
|
||||
Timer::after_millis(20000).await;
|
||||
info!("pwm stopped early!");
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_nrf::pwm::{
|
||||
Config, Prescaler, SequenceConfig, SequenceLoad, SequencePwm, SingleSequenceMode, SingleSequencer,
|
||||
};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// WS2812B LED light demonstration. Drives just one light.
|
||||
@ -52,7 +52,7 @@ async fn main(_spawner: Spawner) {
|
||||
let sequences = SingleSequencer::new(&mut pwm, &seq_words, seq_config.clone());
|
||||
unwrap!(sequences.start(SingleSequenceMode::Times(1)));
|
||||
|
||||
Timer::after(Duration::from_millis(50)).await;
|
||||
Timer::after_millis(50).await;
|
||||
|
||||
if bit_value == T0H {
|
||||
if color_bit == 20 {
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::pwm::{Prescaler, SimplePwm};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -19,29 +19,29 @@ async fn main(_spawner: Spawner) {
|
||||
pwm.set_max_duty(2500);
|
||||
info!("pwm initialized!");
|
||||
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
|
||||
// 1ms 0deg (1/.008=125), 1.5ms 90deg (1.5/.008=187.5), 2ms 180deg (2/.008=250),
|
||||
loop {
|
||||
info!("45 deg");
|
||||
// poor mans inverting, subtract our value from max_duty
|
||||
pwm.set_duty(0, 2500 - 156);
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
|
||||
info!("90 deg");
|
||||
pwm.set_duty(0, 2500 - 187);
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
|
||||
info!("135 deg");
|
||||
pwm.set_duty(0, 2500 - 218);
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
|
||||
info!("180 deg");
|
||||
pwm.set_duty(0, 2500 - 250);
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
|
||||
info!("0 deg");
|
||||
pwm.set_duty(0, 2500 - 125);
|
||||
Timer::after(Duration::from_millis(5000)).await;
|
||||
Timer::after_millis(5000).await;
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::qspi::Frequency;
|
||||
use embassy_nrf::{bind_interrupts, peripherals, qspi};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// Workaround for alignment requirements.
|
||||
@ -79,6 +79,6 @@ async fn main(_p: Spawner) {
|
||||
|
||||
// Sleep for 1 second. The executor ensures the core sleeps with a WFE when it has nothing to do.
|
||||
// During this sleep, the nRF chip should only use ~3uA
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,21 +7,21 @@ use cortex_m_rt::entry;
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::raw::TaskStorage;
|
||||
use embassy_executor::Executor;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
async fn run1() {
|
||||
loop {
|
||||
info!("BIG INFREQUENT TICK");
|
||||
Timer::after(Duration::from_ticks(64000)).await;
|
||||
Timer::after_ticks(64000).await;
|
||||
}
|
||||
}
|
||||
|
||||
async fn run2() {
|
||||
loop {
|
||||
info!("tick");
|
||||
Timer::after(Duration::from_ticks(13000)).await;
|
||||
Timer::after_ticks(13000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::saadc::{ChannelConfig, Config, Saadc};
|
||||
use embassy_nrf::{bind_interrupts, saadc};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -24,6 +24,6 @@ async fn main(_p: Spawner) {
|
||||
let mut buf = [0; 1];
|
||||
saadc.sample(&mut buf).await;
|
||||
info!("sample: {=i16}", &buf[0]);
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,6 @@ use embassy_executor::Spawner;
|
||||
use embassy_nrf::saadc::{CallbackResult, ChannelConfig, Config, Saadc};
|
||||
use embassy_nrf::timer::Frequency;
|
||||
use embassy_nrf::{bind_interrupts, saadc};
|
||||
use embassy_time::Duration;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// Demonstrates both continuous sampling and scanning multiple channels driven by a PPI linked timer
|
||||
@ -32,7 +31,7 @@ async fn main(_p: Spawner) {
|
||||
|
||||
// This delay demonstrates that starting the timer prior to running
|
||||
// the task sampler is benign given the calibration that follows.
|
||||
embassy_time::Timer::after(Duration::from_millis(500)).await;
|
||||
embassy_time::Timer::after_millis(500).await;
|
||||
saadc.calibrate().await;
|
||||
|
||||
let mut bufs = [[[0; 3]; 500]; 2];
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
mod config {
|
||||
@ -13,7 +13,7 @@ mod config {
|
||||
|
||||
#[embassy_executor::task(pool_size = config::MY_TASK_POOL_SIZE)]
|
||||
async fn my_task(spawner: Spawner, n: u32) {
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
info!("Spawning self! {}", n);
|
||||
unwrap!(spawner.spawn(my_task(spawner, n + 1)));
|
||||
}
|
||||
|
@ -4,12 +4,12 @@
|
||||
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::task(pool_size = 2)]
|
||||
async fn my_task(n: u32) {
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
info!("Spawning self! {}", n);
|
||||
unwrap!(Spawner::for_current_executor().await.spawn(my_task(n + 1)));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::temp::Temp;
|
||||
use embassy_nrf::{bind_interrupts, temp};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -21,6 +21,6 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
let value = temp.read().await;
|
||||
info!("temperature: {}℃", value.to_num::<u16>());
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
use defmt::{info, unwrap};
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run1() {
|
||||
loop {
|
||||
info!("BIG INFREQUENT TICK");
|
||||
Timer::after(Duration::from_ticks(64000)).await;
|
||||
Timer::after_ticks(64000).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -19,7 +19,7 @@ async fn run1() {
|
||||
async fn run2() {
|
||||
loop {
|
||||
info!("tick");
|
||||
Timer::after(Duration::from_ticks(13000)).await;
|
||||
Timer::after_ticks(13000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::twim::{self, Twim};
|
||||
use embassy_nrf::{bind_interrupts, peripherals};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
const ADDRESS: u8 = 0x50;
|
||||
@ -48,6 +48,6 @@ async fn main(_p: Spawner) {
|
||||
|
||||
// Sleep for 1 second. The executor ensures the core sleeps with a WFE when it has nothing to do.
|
||||
// During this sleep, the nRF chip should only use ~3uA
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use embassy_futures::join::join;
|
||||
use embassy_nrf::usb::vbus_detect::HardwareVbusDetect;
|
||||
use embassy_nrf::usb::Driver;
|
||||
use embassy_nrf::{bind_interrupts, pac, peripherals, usb};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embassy_usb::class::hid::{HidWriter, ReportId, RequestHandler, State};
|
||||
use embassy_usb::control::OutResponse;
|
||||
use embassy_usb::{Builder, Config};
|
||||
@ -83,7 +83,7 @@ async fn main(_spawner: Spawner) {
|
||||
let hid_fut = async {
|
||||
let mut y: i8 = 5;
|
||||
loop {
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
|
||||
y = -y;
|
||||
let report = MouseReport {
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_nrf::gpio::{Level, Output, OutputDrive};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -14,8 +14,8 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_rp::adc::{Adc, Channel, Config, InterruptHandler};
|
||||
use embassy_rp::bind_interrupts;
|
||||
use embassy_rp::gpio::Pull;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -36,7 +36,7 @@ async fn main(_spawner: Spawner) {
|
||||
info!("Pin 28 ADC: {}", level);
|
||||
let temp = adc.read(&mut ts).await.unwrap();
|
||||
info!("Temp: {} degrees", convert_to_celsius(temp));
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::gpio;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use gpio::{Level, Output};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -21,10 +21,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("led on!");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
|
||||
info!("led off!");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ async fn main(spawner: Spawner) {
|
||||
break;
|
||||
}
|
||||
info!("txd: {}", core::str::from_utf8(msg).unwrap());
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::flash::{Async, ERASE_SIZE, FLASH_BASE};
|
||||
use embassy_rp::peripherals::FLASH;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
const ADDR_OFFSET: u32 = 0x100000;
|
||||
@ -23,7 +23,7 @@ async fn main(_spawner: Spawner) {
|
||||
// defmt RTT header. Reading that header might touch flash memory, which
|
||||
// interferes with flash write operations.
|
||||
// https://github.com/knurling-rs/defmt/pull/683
|
||||
Timer::after(Duration::from_millis(10)).await;
|
||||
Timer::after_millis(10).await;
|
||||
|
||||
let mut flash = embassy_rp::flash::Flash::<_, Async, FLASH_SIZE>::new(p.FLASH, p.DMA_CH0);
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::gpio;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use gpio::{Input, Level, Output, Pull};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) {
|
||||
info!("done wait_for_high. Turn off LED");
|
||||
led.set_low();
|
||||
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
Timer::after_secs(2).await;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::clocks;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -26,13 +26,13 @@ async fn main(_spawner: Spawner) {
|
||||
"Pin 25 is now outputing CLK_SYS/1000, should be toggling at {}",
|
||||
gpout3.get_freq()
|
||||
);
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
Timer::after_secs(2).await;
|
||||
|
||||
gpout3.set_src(clocks::GpoutSrc::Ref);
|
||||
info!(
|
||||
"Pin 25 is now outputing CLK_REF/1000, should be toggling at {}",
|
||||
gpout3.get_freq()
|
||||
);
|
||||
Timer::after(Duration::from_secs(2)).await;
|
||||
Timer::after_secs(2).await;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_rp::bind_interrupts;
|
||||
use embassy_rp::i2c::{self, Config, InterruptHandler};
|
||||
use embassy_rp::peripherals::I2C1;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal_async::i2c::I2c;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -106,6 +106,6 @@ async fn main(_spawner: Spawner) {
|
||||
}
|
||||
}
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::i2c::{self, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal_1::i2c::I2c;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -70,6 +70,6 @@ async fn main(_spawner: Spawner) {
|
||||
info!("portb = {:02x}", portb[0]);
|
||||
val = !val;
|
||||
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::peripherals::{I2C0, I2C1};
|
||||
use embassy_rp::{bind_interrupts, i2c, i2c_slave};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_hal_async::i2c::I2c;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -81,7 +81,7 @@ async fn controller_task(mut con: i2c::I2c<'static, I2C0, i2c::Async>) {
|
||||
Err(e) => error!("Error writing {}", e),
|
||||
}
|
||||
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
match con.read(DEV_ADDR, &mut resp_buff).await {
|
||||
Ok(_) => info!("read response: {}", resp_buff),
|
||||
@ -91,7 +91,7 @@ async fn controller_task(mut con: i2c::I2c<'static, I2C0, i2c::Async>) {
|
||||
Ok(_) => info!("write_read response: {}", resp_buff),
|
||||
Err(e) => error!("Error writing {}", e),
|
||||
}
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_lora::iv::GenericSx126xInterfaceVariant;
|
||||
use embassy_rp::gpio::{Input, Level, Output, Pin, Pull};
|
||||
use embassy_rp::spi::{Config, Spi};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1261_2::SX1261_2;
|
||||
use lora_phy::LoRa;
|
||||
@ -96,7 +96,7 @@ async fn main(_spawner: Spawner) {
|
||||
{
|
||||
info!("rx successful");
|
||||
debug_indicator.set_high();
|
||||
Timer::after(Duration::from_secs(5)).await;
|
||||
Timer::after_secs(5).await;
|
||||
debug_indicator.set_low();
|
||||
} else {
|
||||
info!("rx unknown packet");
|
||||
|
@ -15,7 +15,7 @@ use embassy_rp::peripherals::SPI1;
|
||||
use embassy_rp::spi::{Async, Config, Spi};
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::channel::Channel;
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use lora_phy::mod_params::*;
|
||||
use lora_phy::sx1261_2::SX1261_2;
|
||||
use lora_phy::LoRa;
|
||||
@ -59,7 +59,7 @@ async fn core0_task() {
|
||||
info!("Hello from core 0");
|
||||
loop {
|
||||
CHANNEL.send([0x01u8, 0x02u8, 0x03u8]).await;
|
||||
Timer::after(Duration::from_millis(60 * 1000)).await;
|
||||
Timer::after_millis(60 * 1000).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use embassy_rp::multicore::{spawn_core1, Stack};
|
||||
use embassy_rp::peripherals::PIN_25;
|
||||
use embassy_sync::blocking_mutex::raw::CriticalSectionRawMutex;
|
||||
use embassy_sync::channel::Channel;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -46,9 +46,9 @@ async fn core0_task() {
|
||||
info!("Hello from core 0");
|
||||
loop {
|
||||
CHANNEL.send(LedState::On).await;
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
CHANNEL.send(LedState::Off).await;
|
||||
Timer::after(Duration::from_millis(400)).await;
|
||||
Timer::after_millis(400).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ use defmt::{info, unwrap};
|
||||
use embassy_executor::{Executor, InterruptExecutor};
|
||||
use embassy_rp::interrupt;
|
||||
use embassy_rp::interrupt::{InterruptExt, Priority};
|
||||
use embassy_time::{Duration, Instant, Timer, TICK_HZ};
|
||||
use embassy_time::{Instant, Timer, TICK_HZ};
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -70,7 +70,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
async fn run_high() {
|
||||
loop {
|
||||
info!(" [high] tick!");
|
||||
Timer::after(Duration::from_ticks(673740)).await;
|
||||
Timer::after_ticks(673740).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ async fn run_med() {
|
||||
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
|
||||
info!(" [med] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(53421)).await;
|
||||
Timer::after_ticks(53421).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ async fn run_low() {
|
||||
let ms = end.duration_since(start).as_ticks() * 1000 / TICK_HZ;
|
||||
info!("[low] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(82983)).await;
|
||||
Timer::after_ticks(82983).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,7 +15,7 @@ use embassy_rp::pio::{
|
||||
};
|
||||
use embassy_rp::pwm::{self, Pwm};
|
||||
use embassy_rp::{bind_interrupts, into_ref, Peripheral, PeripheralRef};
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(pub struct Irqs {
|
||||
@ -66,7 +66,7 @@ async fn main(_spawner: Spawner) {
|
||||
let mut buf = Buf([0; 16], 0);
|
||||
write!(buf, "up {}s", Instant::now().as_micros() as f32 / 1e6).unwrap();
|
||||
hd.add_line(&buf.0[0..buf.1]).await;
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -13,7 +13,7 @@ use embassy_rp::pio::{
|
||||
Common, Config, FifoJoin, Instance, InterruptHandler, Pio, PioPin, ShiftConfig, ShiftDirection, StateMachine,
|
||||
};
|
||||
use embassy_rp::{bind_interrupts, clocks, into_ref, Peripheral, PeripheralRef};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use fixed::types::U24F8;
|
||||
use fixed_macro::fixed;
|
||||
use smart_leds::RGB8;
|
||||
@ -153,7 +153,7 @@ async fn main(_spawner: Spawner) {
|
||||
}
|
||||
ws2812.write(&data).await;
|
||||
|
||||
Timer::after(Duration::from_millis(10)).await;
|
||||
Timer::after_millis(10).await;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::pwm::{Config, Pwm};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -23,7 +23,7 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
loop {
|
||||
info!("current LED duty cycle: {}/32768", c.compare_b);
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
c.compare_b = c.compare_b.rotate_left(4);
|
||||
pwm.set_config(&c);
|
||||
}
|
||||
|
@ -7,7 +7,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::rtc::{DateTime, DayOfWeek, Rtc};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -31,7 +31,7 @@ async fn main(_spawner: Spawner) {
|
||||
rtc.set_datetime(now).unwrap();
|
||||
}
|
||||
|
||||
Timer::after(Duration::from_millis(20000)).await;
|
||||
Timer::after_millis(20000).await;
|
||||
|
||||
if let Ok(dt) = rtc.now() {
|
||||
info!(
|
||||
@ -41,6 +41,6 @@ async fn main(_spawner: Spawner) {
|
||||
}
|
||||
|
||||
info!("Reboot.");
|
||||
Timer::after(Duration::from_millis(200)).await;
|
||||
Timer::after_millis(200).await;
|
||||
cortex_m::peripheral::SCB::sys_reset();
|
||||
}
|
||||
|
@ -8,7 +8,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_rp::spi::{Config, Spi};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -27,6 +27,6 @@ async fn main(_spawner: Spawner) {
|
||||
let mut rx_buf = [0_u8; 6];
|
||||
spi.transfer(&mut rx_buf, &tx_buf).await.unwrap();
|
||||
info!("{:?}", rx_buf);
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_rp::bind_interrupts;
|
||||
use embassy_rp::peripherals::UART0;
|
||||
use embassy_rp::uart::{BufferedInterruptHandler, BufferedUart, BufferedUartRx, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embedded_io_async::{Read, Write};
|
||||
use static_cell::make_static;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
@ -42,7 +42,7 @@ async fn main(spawner: Spawner) {
|
||||
];
|
||||
info!("TX {:?}", data);
|
||||
tx.write_all(&data).await.unwrap();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_rp::bind_interrupts;
|
||||
use embassy_rp::peripherals::UART1;
|
||||
use embassy_rp::uart::{Async, Config, InterruptHandler, UartRx, UartTx};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -35,7 +35,7 @@ async fn main(spawner: Spawner) {
|
||||
let data = [1u8, 2, 3, 4, 5, 6, 7, 8];
|
||||
info!("TX {:?}", data);
|
||||
uart_tx.write(&data).await.unwrap();
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_rp::bind_interrupts;
|
||||
use embassy_rp::peripherals::USB;
|
||||
use embassy_rp::usb::{Driver, InterruptHandler};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -32,6 +32,6 @@ async fn main(spawner: Spawner) {
|
||||
loop {
|
||||
counter += 1;
|
||||
log::info!("Tick {}", counter);
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ async fn main(spawner: Spawner) {
|
||||
// Wait for DHCP, not necessary when using static IP
|
||||
info!("waiting for DHCP...");
|
||||
while !stack.is_config_up() {
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
info!("DHCP is now up!");
|
||||
|
||||
|
@ -100,7 +100,7 @@ async fn main_task(spawner: Spawner) {
|
||||
return;
|
||||
}
|
||||
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
info!("Closing the connection");
|
||||
socket.abort();
|
||||
|
@ -1,14 +1,14 @@
|
||||
#![feature(type_alias_impl_trait)]
|
||||
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use log::*;
|
||||
|
||||
#[embassy_executor::task]
|
||||
async fn run() {
|
||||
loop {
|
||||
info!("tick");
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_stm32::adc::{Adc, SampleTime};
|
||||
use embassy_stm32::peripherals::ADC;
|
||||
use embassy_stm32::{adc, bind_interrupts};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -36,6 +36,6 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
let v = adc.read(&mut pin).await;
|
||||
info!("--> {} - {} mV", v, convert_to_millivolts(v));
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
// main is itself an async function.
|
||||
@ -19,10 +19,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -10,7 +10,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::exti::ExtiInput;
|
||||
use embassy_stm32::gpio::{AnyPin, Input, Level, Output, Pin, Pull, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
static BLINK_MS: AtomicU32 = AtomicU32::new(0);
|
||||
@ -24,7 +24,7 @@ async fn led_task(led: AnyPin) {
|
||||
loop {
|
||||
let del = BLINK_MS.load(Ordering::Relaxed);
|
||||
info!("Value of del is {}", del);
|
||||
Timer::after(Duration::from_millis(del.into())).await;
|
||||
Timer::after_millis(del.into()).await;
|
||||
info!("LED toggling");
|
||||
led.toggle();
|
||||
}
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
async fn main(_spawner: Spawner) -> ! {
|
||||
let _p = embassy_stm32::init(Default::default());
|
||||
loop {
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
info!("Hello");
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ use defmt::*;
|
||||
use embassy_executor::{Executor, InterruptExecutor};
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::interrupt::{InterruptExt, Priority};
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -70,7 +70,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
async fn run_high() {
|
||||
loop {
|
||||
// info!(" [high] tick!");
|
||||
Timer::after(Duration::from_ticks(27374)).await;
|
||||
Timer::after_ticks(27374).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ async fn run_med() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!(" [med] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(23421)).await;
|
||||
Timer::after_ticks(23421).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ async fn run_low() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!("[low] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(32983)).await;
|
||||
Timer::after_ticks(32983).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::wdg::IndependentWatchdog;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -19,7 +19,7 @@ async fn main(_spawner: Spawner) {
|
||||
wdg.unleash();
|
||||
|
||||
loop {
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
wdg.pet();
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ use embassy_executor::Spawner;
|
||||
use embassy_stm32::adc::Adc;
|
||||
use embassy_stm32::peripherals::ADC1;
|
||||
use embassy_stm32::{adc, bind_interrupts};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -35,6 +35,6 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
let v = adc.read(&mut pin).await;
|
||||
info!("--> {} - {} mV", v, convert_to_millivolts(v));
|
||||
Timer::after(Duration::from_millis(100)).await;
|
||||
Timer::after_millis(100).await;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(300)).await;
|
||||
Timer::after_millis(300).await;
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -17,6 +17,6 @@ async fn main(_spawner: Spawner) -> ! {
|
||||
|
||||
loop {
|
||||
info!("Hello World!");
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::usb::{Driver, Instance};
|
||||
use embassy_stm32::{bind_interrupts, peripherals, usb, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
|
||||
use embassy_usb::driver::EndpointError;
|
||||
use embassy_usb::Builder;
|
||||
@ -35,7 +35,7 @@ async fn main(_spawner: Spawner) {
|
||||
// This forced reset is needed only for development, without it host
|
||||
// will not reset your device when you upload new firmware.
|
||||
let _dp = Output::new(&mut p.PA12, Level::Low, Speed::Low);
|
||||
Timer::after(Duration::from_millis(10)).await;
|
||||
Timer::after_millis(10).await;
|
||||
}
|
||||
|
||||
// Create the driver, from the HAL.
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ use embassy_stm32::rcc::{
|
||||
};
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -46,7 +46,7 @@ async fn main(_spawner: Spawner) {
|
||||
let _p = embassy_stm32::init(config);
|
||||
|
||||
loop {
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
info!("1s elapsed");
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,10 +18,10 @@ async fn main(_spawner: Spawner) {
|
||||
loop {
|
||||
info!("high");
|
||||
led.set_high();
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
|
||||
info!("low");
|
||||
led.set_low();
|
||||
Timer::after(Duration::from_millis(1000)).await;
|
||||
Timer::after_millis(1000).await;
|
||||
}
|
||||
}
|
||||
|
@ -65,11 +65,11 @@ impl<'a> Leds<'a> {
|
||||
for led in &mut self.leds {
|
||||
led.set_high();
|
||||
}
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
for led in &mut self.leds {
|
||||
led.set_low();
|
||||
}
|
||||
Timer::after(Duration::from_millis(200)).await;
|
||||
Timer::after_millis(200).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,6 +18,6 @@ async fn main(_spawner: Spawner) -> ! {
|
||||
|
||||
loop {
|
||||
info!("Hello World!");
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
@ -62,7 +62,7 @@ use defmt::*;
|
||||
use embassy_executor::{Executor, InterruptExecutor};
|
||||
use embassy_stm32::interrupt;
|
||||
use embassy_stm32::interrupt::{InterruptExt, Priority};
|
||||
use embassy_time::{Duration, Instant, Timer};
|
||||
use embassy_time::{Instant, Timer};
|
||||
use static_cell::StaticCell;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
@ -70,7 +70,7 @@ use {defmt_rtt as _, panic_probe as _};
|
||||
async fn run_high() {
|
||||
loop {
|
||||
info!(" [high] tick!");
|
||||
Timer::after(Duration::from_ticks(27374)).await;
|
||||
Timer::after_ticks(27374).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ async fn run_med() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!(" [med] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(23421)).await;
|
||||
Timer::after_ticks(23421).await;
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ async fn run_low() {
|
||||
let ms = end.duration_since(start).as_ticks() / 33;
|
||||
info!("[low] done in {} ms", ms);
|
||||
|
||||
Timer::after(Duration::from_ticks(32983)).await;
|
||||
Timer::after_ticks(32983).await;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_stm32::time::mhz;
|
||||
use embassy_stm32::usb::{Driver, Instance};
|
||||
use embassy_stm32::{bind_interrupts, peripherals, usb, Config};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use embassy_usb::class::cdc_acm::{CdcAcmClass, State};
|
||||
use embassy_usb::driver::EndpointError;
|
||||
use embassy_usb::Builder;
|
||||
@ -33,7 +33,7 @@ async fn main(_spawner: Spawner) {
|
||||
|
||||
// Needed for nucleo-stm32f303ze
|
||||
let mut dp_pullup = Output::new(p.PG6, Level::Low, Speed::Medium);
|
||||
Timer::after(Duration::from_millis(10)).await;
|
||||
Timer::after_millis(10).await;
|
||||
dp_pullup.set_high();
|
||||
|
||||
// Create the driver, from the HAL.
|
||||
|
@ -9,7 +9,7 @@ use embassy_stm32::peripherals::ADC1;
|
||||
use embassy_stm32::rcc::{AdcClockSource, Adcpres};
|
||||
use embassy_stm32::time::mhz;
|
||||
use embassy_stm32::{adc, bind_interrupts, Config};
|
||||
use embassy_time::{Delay, Duration, Timer};
|
||||
use embassy_time::{Delay, Timer};
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
@ -51,6 +51,6 @@ async fn main(_spawner: Spawner) -> ! {
|
||||
let pin_mv = (pin as u32 * vrefint.value() as u32 / vref as u32) * 3300 / 4095;
|
||||
info!("computed pin mv: {}", pin_mv);
|
||||
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
use defmt::*;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::gpio::{Level, Output, Speed};
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -17,10 +17,10 @@ async fn main(_spawner: Spawner) {
|
||||
let mut out1 = Output::new(p.PA8, Level::Low, Speed::High);
|
||||
|
||||
out1.set_high();
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
out1.set_low();
|
||||
|
||||
Timer::after(Duration::from_millis(500)).await;
|
||||
Timer::after_millis(500).await;
|
||||
info!("end program");
|
||||
|
||||
cortex_m::asm::bkpt();
|
||||
|
@ -6,7 +6,7 @@ use defmt::info;
|
||||
use embassy_executor::Spawner;
|
||||
use embassy_stm32::time::Hertz;
|
||||
use embassy_stm32::Config;
|
||||
use embassy_time::{Duration, Timer};
|
||||
use embassy_time::Timer;
|
||||
use {defmt_rtt as _, panic_probe as _};
|
||||
|
||||
#[embassy_executor::main]
|
||||
@ -18,6 +18,6 @@ async fn main(_spawner: Spawner) -> ! {
|
||||
|
||||
loop {
|
||||
info!("Hello World!");
|
||||
Timer::after(Duration::from_secs(1)).await;
|
||||
Timer::after_secs(1).await;
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user