rename flag, send nak

This commit is contained in:
Matthew Kennedy 2020-12-10 17:30:41 -08:00
parent 2c7679e526
commit a418c9903f
1 changed files with 8 additions and 4 deletions

View File

@ -57,7 +57,6 @@ void EraseAppPages()
}
}
bool holdBoot = false;
void WaitForBootloaderCmd()
{
@ -97,6 +96,8 @@ void sendNak()
// TODO: implement
}
bool bootloaderBusy = false;
void RunBootloaderLoop()
{
// First ack that the bootloader is alive
@ -155,9 +156,12 @@ void RunBootloaderLoop()
break;
case 0x03: // opcode 3 is "boot app"
// Clear the flag
holdBoot = false;
bootloaderBusy = false;
// Kill this thread
return;
default:
sendNak();
break;
}
}
}
@ -170,7 +174,7 @@ THD_FUNCTION(BootloaderThread, arg)
WaitForBootloaderCmd();
// We've rx'd a BL command, don't load the app!
holdBoot = true;
bootloaderBusy = true;
RunBootloaderLoop();
}
@ -198,7 +202,7 @@ int main(void) {
}
// Block until booting the app is allowed
while (holdBoot)
while (bootloaderBusy)
{
palTogglePad(GPIOB, 5);
palTogglePad(GPIOB, 6);