Skip to content

Commit

Permalink
Use match instead of if/else
Browse files Browse the repository at this point in the history
  • Loading branch information
jannic committed Sep 8, 2023
1 parent adfa1a2 commit 1aec0cb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions rp2040-hal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,9 @@ pub fn halt() -> ! {
unsafe {
cortex_m::interrupt::disable();
// Stop other core
if crate::Sio::core() == CoreId::Core0 {
(*pac::PSM::PTR).frce_off.write(|w| w.proc1().set_bit());
} else {
(*pac::PSM::PTR).frce_off.write(|w| w.proc0().set_bit());
match crate::Sio::core() {
CoreId::Core0 => (*pac::PSM::PTR).frce_off.write(|w| w.proc1().set_bit()),
CoreId::Core1 => (*pac::PSM::PTR).frce_off.write(|w| w.proc0().set_bit()),
}
// Keep current core running, so debugging stays possible
loop {
Expand Down

0 comments on commit 1aec0cb

Please sign in to comment.