Skip to content

Commit

Permalink
Clean up loop and add sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
mkeeter committed Apr 5, 2024
1 parent 9da60ee commit e544709
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions drv/lpc55-swd/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,11 +1058,9 @@ impl ServerImpl {
self.write_single_target_addr(OPTCR, optcr)?;

// Wait for option bit programming to finish
loop {
let optsr_cur = self.read_single_target_addr(OPTSR_CUR)?;
if optsr_cur & OPTSR_OPT_BUSY_BIT == 0 {
break;
}
while self.read_single_target_addr(OPTSR_CUR)? & OPTSR_OPT_BUSY_BIT != 0
{
hl::sleep_for(5);
}

// Reset the STM32, causing it to reboot into the newly-set slot
Expand Down

0 comments on commit e544709

Please sign in to comment.