From: Peter Henn Date: Wed, 29 Dec 2021 12:10:53 +0000 (+0000) Subject: Merge tag 'LUFA-210130' into ProMicro X-Git-Tag: DFU-Bootloader-ProMicro~8 X-Git-Url: http://git.linex4red.de/pub/lufa.git/commitdiff_plain/7ea8f0d1efaceedee06a975d10af85975bbe3141 Merge tag 'LUFA-210130' into ProMicro - 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. --- 7ea8f0d1efaceedee06a975d10af85975bbe3141 diff --cc Bootloaders/DFU/BootloaderDFU.c index 8a3538e48,aeb4d9f7c..3e2f330c7 --- a/Bootloaders/DFU/BootloaderDFU.c +++ b/Bootloaders/DFU/BootloaderDFU.c @@@ -180,37 -188,12 +180,40 @@@ int main(void 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();