- use merge strategy "theirs", means in principle rebase ProMicro branch
to LUFA-210130
- Still remove FUSE_BOOTRST check in Application_Jump_Check, although it
is in meantime fixed, but ProMicro would now no longer enter bootloader
once a application is flashed.
GlobalInterruptEnable();
/* Run the USB management task while the bootloader is supposed to be running */
+ /*if bit_is_clear(PINB,PB5) // PB5 is Digital 9 on Arduino Pro Micro
+ {
+ loop_until_bit_is_set(PINB,PB5);
+
+ while ((RunBootloader || WaitForExit) && bit_is_set(PINB,PB5))
+ USB_USBTask();
+
+ loop_until_bit_is_clear(PINB,PB5);
+ }*/
+
+ stayinbootloader = false;
+
+ uint16_t i = 0;
while (RunBootloader || WaitForExit)
- USB_USBTask();
+ {
+ USB_USBTask();
+
+ if (!stayinbootloader)
+ {
+ _delay_ms(1);
+ if (i++ > 5000)
+ {
+ break;
+ }
+ }
+ else
+ {
+ i = 0;
+ }
+ }
+ /* Wait a short time to end all USB transactions and then disconnect */
+ _delay_us(1000);
+
/* Reset configured hardware back to their original states for the user application */
ResetHardware();