From 513db46548c4757d912d158d0e261520c9ee608c Mon Sep 17 00:00:00 2001 From: Dean Camera Date: Sat, 23 Apr 2011 03:45:29 +0000 Subject: Added LED flashing to the CDC and DFU class bootloaders to indicate when they are running. --- Bootloaders/CDC/BootloaderCDC.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Bootloaders/CDC/BootloaderCDC.c') diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 8e6a58b0a..ba0a629bc 100644 --- a/Bootloaders/CDC/BootloaderCDC.c +++ b/Bootloaders/CDC/BootloaderCDC.c @@ -66,6 +66,9 @@ int main(void) /* Setup hardware required for the bootloader */ SetupHardware(); + /* 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(); @@ -100,6 +103,17 @@ void SetupHardware(void) /* Initialize USB Subsystem */ USB_Init(); + LEDs_Init(); + + /* Bootloader active LED toggle timer initialization */ + TIMSK1 = (1 << TOIE1); + TCCR1B = ((1 << CS11) | (1 << CS10)); +} + +/** 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_ConfigurationChanged event. This configures the device's endpoints ready -- cgit v1.2.3