aboutsummaryrefslogtreecommitdiffstats
path: root/Bootloaders/DFU/BootloaderDFU.c
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2011-04-23 03:45:29 +0000
committerDean Camera <dean@fourwalledcubicle.com>2011-04-23 03:45:29 +0000
commit513db46548c4757d912d158d0e261520c9ee608c (patch)
treeb2be4b33104eee844c6eb3e897766826e8b8a174 /Bootloaders/DFU/BootloaderDFU.c
parent2b0c9532a3c60ef6cc562bb1bd6c13cb68b4bb03 (diff)
downloadlufa-513db46548c4757d912d158d0e261520c9ee608c.tar.gz
lufa-513db46548c4757d912d158d0e261520c9ee608c.tar.bz2
lufa-513db46548c4757d912d158d0e261520c9ee608c.zip
Added LED flashing to the CDC and DFU class bootloaders to indicate when they are running.
Diffstat (limited to 'Bootloaders/DFU/BootloaderDFU.c')
-rw-r--r--Bootloaders/DFU/BootloaderDFU.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Bootloaders/DFU/BootloaderDFU.c b/Bootloaders/DFU/BootloaderDFU.c
index 113bea748..9f6166075 100644
--- a/Bootloaders/DFU/BootloaderDFU.c
+++ b/Bootloaders/DFU/BootloaderDFU.c
@@ -119,6 +119,9 @@ int main(void)
MCUCR &= ~(1 << JTD);
#endif
+ /* Turn on first LED on the board to indicate that the bootloader has started */
+ LEDs_SetAllLEDs(LEDS_LED1);
+
/* Enable global interrupts so that the USB stack can function */
sei();
@@ -149,6 +152,11 @@ void SetupHardware(void)
/* Initialize the USB subsystem */
USB_Init();
+ LEDs_Init();
+
+ /* Bootloader active LED toggle timer initialization */
+ TIMSK1 = (1 << TOIE1);
+ TCCR1B = ((1 << CS11) | (1 << CS10));
}
/** Resets all configured hardware required for the bootloader back to their original states. */
@@ -162,6 +170,12 @@ void ResetHardware(void)
MCUCR = 0;
}
+/** ISR to periodically toggle the LEDs on the board to indicate that the bootloader is active. */
+ISR(TIMER1_OVF_vect, ISR_BLOCK)
+{
+ LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
+}
+
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
* the device from the USB host before passing along unhandled control requests to the library for processing
* internally.