Merge pull request #408 from jannic/wfi

Use wfi in otherwise empty infinite loops in examples
This commit is contained in:
Jan Niehusmann 2022-08-04 16:49:06 +02:00 committed by GitHub
commit 575aba4bfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 19 additions and 23 deletions

View file

@ -149,7 +149,7 @@ fn main() -> ! {
print_temperature(&mut uart, temp);
loop {
cortex_m::asm::nop();
cortex_m::asm::wfi();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -97,9 +97,8 @@ fn main() -> ! {
// Demo finish - just loop until reset
#[allow(clippy::empty_loop)]
loop {
// Empty loop
cortex_m::asm::wfi();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -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();
}
}

View file

@ -166,7 +166,7 @@ fn main() -> ! {
// In case the reboot fails
loop {
cortex_m::asm::nop();
cortex_m::asm::wfi();
}
}

View file

@ -121,9 +121,8 @@ fn main() -> ! {
Err(_) => {} // handle errors
};
#[allow(clippy::empty_loop)]
loop {
// Empty loop
cortex_m::asm::wfi();
}
}