/* Main program entry point. This routine configures the hardware required by the bootloader, then continuously runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start the loaded application code.  */
int main(void)
/* Main program entry point. This routine configures the hardware required by the bootloader, then continuously runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start the loaded application code.  */
int main(void)
{
	SetupHardware();
	LEDs_SetAllLEDs(LEDS_LED1);
	GlobalInterruptEnable();
	while (RunBootloader)
	{
		CDC_Task();
		USB_USBTask();
	}
	_delay_us(1000);
	USB_Detach();
	MagicBootKey = MAGIC_BOOT_KEY;
	wdt_enable(WDTO_250MS);
	for (;;);
}