Skip to content

Commit

Permalink
Stay in bootloader if application returns
Browse files Browse the repository at this point in the history
  • Loading branch information
bessman committed Nov 14, 2023
1 parent f00ff1f commit 253d3fd
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* (RC5) is grounded, the device will stay in bootloader mode even if an
* application exists. While in bootloader mode, a new application can be
* flashed with the Unified Bootloader Host Application, or a similar tool.
*
*
* From PSLab V6 revision onwards, there is a push button attached to BOOT pin
* with a label `BOOT`. Holding this button down at power up or when clicking on
* `Read Device Settings` in Unified Bootloader application will switch from
* `Read Device Settings` in Unified Bootloader application will switch from
* main application to bootloader mode where one can flash a new firmware.
*/

Expand Down Expand Up @@ -41,16 +41,14 @@ int main(void) {
// If BOOT is grounded or no application is detected, stay in bootloader.
if (BOOT_PIN_GetValue() && BOOT_Verify()) {
BOOT_StartApplication();
} else {
uint16_t i = 0;
}

while (1) {
// Monitor serial bus for commands, e.g. flashing new application.
BOOT_ProcessCommand();
for (uint16_t i = 0; 1; ++i) {
// Monitor serial bus for commands, e.g. flashing new application.
BOOT_ProcessCommand();

// Blink system LED while in bootloader mode.
if (!i++) STATUS_LED_Toggle();
}
// Blink system LED while in bootloader mode.
if (!i) STATUS_LED_Toggle();
}

return 1;
Expand Down

0 comments on commit 253d3fd

Please sign in to comment.