Commit d6a528f9 authored by Dean Camera's avatar Dean Camera
Browse files

Add short delays before detaching from the USB bus in the bootloaders (thanks to NicoHood).

parent ba6d9c1a
......@@ -43,6 +43,7 @@
#include <avr/eeprom.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <stdbool.h>
#include "Descriptors.h"
......
......@@ -191,6 +191,9 @@ int main(void)
while (RunBootloader || WaitForExit)
USB_USBTask();
/* 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();
......
......@@ -84,6 +84,9 @@ int main(void)
while (RunBootloader)
USB_USBTask();
/* Wait a short time to end all USB transactions and then disconnect */
_delay_us(1000);
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
......
......@@ -43,6 +43,7 @@
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/atomic.h>
#include <util/delay.h>
#include <stdbool.h>
#include "Descriptors.h"
......
......@@ -169,6 +169,9 @@ int main(void)
USB_USBTask();
}
/* Wait a short time to end all USB transactions and then disconnect */
_delay_us(1000);
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
......
......@@ -41,6 +41,7 @@
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include <string.h>
#include "Descriptors.h"
......
......@@ -401,6 +401,9 @@ int main(void)
USB_USBTask();
}
/* Wait a short time to end all USB transactions and then disconnect */
_delay_us(1000);
/* Disconnect from the host - USB interface will be reset later along with the AVR */
USB_Detach();
......
......@@ -41,6 +41,7 @@
#include <avr/wdt.h>
#include <avr/power.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "Descriptors.h"
#include "BootloaderAPI.h"
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment