diff --git a/boards/rp-pico/examples/pico_i2c_pio.rs b/boards/rp-pico/examples/pico_i2c_pio.rs index 7bff71f..5bb2f18 100644 --- a/boards/rp-pico/examples/pico_i2c_pio.rs +++ b/boards/rp-pico/examples/pico_i2c_pio.rs @@ -149,7 +149,7 @@ fn main() -> ! { print_temperature(&mut uart, temp); loop { - cortex_m::asm::nop(); + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/dht11.rs b/rp2040-hal/examples/dht11.rs index 31f9dd4..6dbf8ab 100644 --- a/rp2040-hal/examples/dht11.rs +++ b/rp2040-hal/examples/dht11.rs @@ -139,9 +139,8 @@ fn main() -> ! { // In this case, we just ignore the result. A real application // would do something with the measurement. - #[allow(clippy::empty_loop)] loop { - // Empty loop + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/gpio_irq_example.rs b/rp2040-hal/examples/gpio_irq_example.rs index 3365857..3fc3d6f 100644 --- a/rp2040-hal/examples/gpio_irq_example.rs +++ b/rp2040-hal/examples/gpio_irq_example.rs @@ -147,11 +147,7 @@ fn main() -> ! { loop { // interrupts handle everything else in this example. - // if we wanted low power we could go to sleep. to - // keep this example simple we'll just execute a `nop`. - // the `nop` (No Operation) instruction does nothing, - // but if we have no code here clippy would complain. - cortex_m::asm::nop(); + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/i2c.rs b/rp2040-hal/examples/i2c.rs index 43423f1..2acf21b 100644 --- a/rp2040-hal/examples/i2c.rs +++ b/rp2040-hal/examples/i2c.rs @@ -97,9 +97,8 @@ fn main() -> ! { // Demo finish - just loop until reset - #[allow(clippy::empty_loop)] loop { - // Empty loop + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/lcd_display.rs b/rp2040-hal/examples/lcd_display.rs index 7788bc7..0781d02 100644 --- a/rp2040-hal/examples/lcd_display.rs +++ b/rp2040-hal/examples/lcd_display.rs @@ -113,9 +113,8 @@ fn main() -> ! { lcd.write_str("HD44780!", &mut delay).unwrap(); // Do nothing - we're finished - #[allow(clippy::empty_loop)] loop { - // Empty loop + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/pio_blink.rs b/rp2040-hal/examples/pio_blink.rs index d0ea164..0913607 100644 --- a/rp2040-hal/examples/pio_blink.rs +++ b/rp2040-hal/examples/pio_blink.rs @@ -64,6 +64,7 @@ fn main() -> ! { sm.start(); // PIO runs in background, independently from CPU - #[allow(clippy::empty_loop)] - loop {} + loop { + cortex_m::asm::wfi(); + } } diff --git a/rp2040-hal/examples/pio_proc_blink.rs b/rp2040-hal/examples/pio_proc_blink.rs index 1528cb3..fab202f 100644 --- a/rp2040-hal/examples/pio_proc_blink.rs +++ b/rp2040-hal/examples/pio_proc_blink.rs @@ -54,6 +54,7 @@ fn main() -> ! { sm.start(); // PIO runs in background, independently from CPU - #[allow(clippy::empty_loop)] - loop {} + loop { + cortex_m::asm::wfi(); + } } diff --git a/rp2040-hal/examples/pio_side_set.rs b/rp2040-hal/examples/pio_side_set.rs index 46f45b8..1fcc39d 100644 --- a/rp2040-hal/examples/pio_side_set.rs +++ b/rp2040-hal/examples/pio_side_set.rs @@ -57,6 +57,7 @@ fn main() -> ! { sm.start(); // PIO runs in background, independently from CPU - #[allow(clippy::empty_loop)] - loop {} + loop { + cortex_m::asm::wfi(); + } } diff --git a/rp2040-hal/examples/pio_synchronized.rs b/rp2040-hal/examples/pio_synchronized.rs index 39cf23d..096b885 100644 --- a/rp2040-hal/examples/pio_synchronized.rs +++ b/rp2040-hal/examples/pio_synchronized.rs @@ -91,6 +91,7 @@ fn main() -> ! { cortex_m::asm::delay(10_000_000); let _sm2 = sm2.stop(); - #[allow(clippy::empty_loop)] - loop {} + loop { + cortex_m::asm::wfi(); + } } diff --git a/rp2040-hal/examples/rom_funcs.rs b/rp2040-hal/examples/rom_funcs.rs index 8fc9769..548400f 100644 --- a/rp2040-hal/examples/rom_funcs.rs +++ b/rp2040-hal/examples/rom_funcs.rs @@ -166,7 +166,7 @@ fn main() -> ! { // In case the reboot fails loop { - cortex_m::asm::nop(); + cortex_m::asm::wfi(); } } diff --git a/rp2040-hal/examples/spi.rs b/rp2040-hal/examples/spi.rs index e13e222..0f67fe7 100644 --- a/rp2040-hal/examples/spi.rs +++ b/rp2040-hal/examples/spi.rs @@ -121,9 +121,8 @@ fn main() -> ! { Err(_) => {} // handle errors }; - #[allow(clippy::empty_loop)] loop { - // Empty loop + cortex_m::asm::wfi(); } }