From 28e9e122af24e63e84d5bcd2c619b76c490970fc Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Sat, 31 Dec 2011 12:19:08 -0500 Subject: reset the Leonardo board when leaving the bootloader, before starting the sketch Done so all IO and other registers are properly reinitialized when a new sketch is uploaded or when an existing sketch is started. Uses a watchdog timeout with a 15 ms period to accomplish the reset. Bootloader checks the reason for reset and only enumerates as bootloader and enters the programming loop if reset was NOT caused by WDT. --- bootloaders/diskloader/src/USBCore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bootloaders/diskloader/src/USBCore.cpp') diff --git a/bootloaders/diskloader/src/USBCore.cpp b/bootloaders/diskloader/src/USBCore.cpp index 208121e..0467e46 100644 --- a/bootloaders/diskloader/src/USBCore.cpp +++ b/bootloaders/diskloader/src/USBCore.cpp @@ -34,7 +34,7 @@ u8 TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ u8 RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ -void Reboot(); +void Reset(); //================================================================== //================================================================== @@ -500,7 +500,7 @@ int USBGetChar() } if (!--_timeout) { - Reboot(); // USB not connected, run firmware + Reset(); } _delay_us(100); // stretch out the bootloader period to about 5 seconds after enumeration -- cgit v1.2.3-18-g5258