mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-30 05:41:12 +00:00
Native delay API does not need self
This commit is contained in:
parent
83c1ebf4b7
commit
22ab6f272a
@ -25,10 +25,10 @@ fn main() -> anyhow::Result<()> {
|
||||
for numerator in [0, 1, 2, 3, 4, 5].iter().cycle() {
|
||||
println!("Duty {}/5", numerator);
|
||||
channel.set_duty(max_duty * numerator / 5)?;
|
||||
FreeRtos::delay_ms(2000)?;
|
||||
FreeRtos::delay_ms(2000);
|
||||
}
|
||||
|
||||
loop {
|
||||
FreeRtos::delay_ms(1000)?;
|
||||
FreeRtos::delay_ms(1000);
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ fn main() -> anyhow::Result<()> {
|
||||
println!("Keep sending until pin {} is set low.", stop.pin());
|
||||
|
||||
while stop.is_high() {
|
||||
Ets::delay_ms(100)?;
|
||||
Ets::delay_ms(100);
|
||||
}
|
||||
|
||||
println!("Pin {} set to low. Stopped.", stop.pin());
|
||||
@ -56,7 +56,7 @@ fn main() -> anyhow::Result<()> {
|
||||
drop(tx);
|
||||
|
||||
// Wait so the messages don't get garbled.
|
||||
Ets::delay_ms(3000)?;
|
||||
Ets::delay_ms(3000);
|
||||
|
||||
// Now send a single message and stop.
|
||||
println!("Saying GOODBYE!");
|
||||
|
@ -26,7 +26,7 @@ fn main() -> anyhow::Result<()> {
|
||||
|
||||
loop {
|
||||
play_song(&mut tx, ODE_TO_JOY)?;
|
||||
Ets::delay_ms(3000)?;
|
||||
Ets::delay_ms(3000);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,11 +58,11 @@ pub fn play_note(
|
||||
|
||||
// Play the note for the 80% of the duration.
|
||||
tx.start(signal)?;
|
||||
Ets::delay_ms((80 * duration.as_millis() / 100) as u32)?;
|
||||
Ets::delay_ms((80 * duration.as_millis() / 100) as u32);
|
||||
|
||||
// Small pause between notes, 20% of the specified duration.
|
||||
tx.stop()?;
|
||||
Ets::delay_ms((20 * duration.as_millis() / 100) as u32)?;
|
||||
Ets::delay_ms((20 * duration.as_millis() / 100) as u32);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ fn main() -> anyhow::Result<()> {
|
||||
signal.set(i as usize, &(high_pulse, low_pulse))?;
|
||||
}
|
||||
tx.start_blocking(&signal)?;
|
||||
Ets::delay_ms(1000)?;
|
||||
Ets::delay_ms(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user