diff options
| author | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-04-23 03:45:29 +0000 |
|---|---|---|
| committer | Dean <Dean@d5102386-fcda-11dd-9fdb-3debd5008f28> | 2011-04-23 03:45:29 +0000 |
| commit | 1046622376c63bdaa7857e109b8033cf1d02217a (patch) | |
| tree | b2be4b33104eee844c6eb3e897766826e8b8a174 /Bootloaders/CDC | |
| parent | 36636bf8b2fd123e2150acd7b7c7b994d20e143a (diff) | |
Added LED flashing to the CDC and DFU class bootloaders to indicate when they are running.
git-svn-id: http://lufa-lib.googlecode.com/svn/trunk@1743 d5102386-fcda-11dd-9fdb-3debd5008f28
Diffstat (limited to 'Bootloaders/CDC')
| -rw-r--r-- | Bootloaders/CDC/BootloaderCDC.c | 14 | ||||
| -rw-r--r-- | Bootloaders/CDC/BootloaderCDC.h | 1 |
2 files changed, 15 insertions, 0 deletions
diff --git a/Bootloaders/CDC/BootloaderCDC.c b/Bootloaders/CDC/BootloaderCDC.c index 8e6a58b0..ba0a629b 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 diff --git a/Bootloaders/CDC/BootloaderCDC.h b/Bootloaders/CDC/BootloaderCDC.h index b6bea11e..72bc1e77 100644 --- a/Bootloaders/CDC/BootloaderCDC.h +++ b/Bootloaders/CDC/BootloaderCDC.h @@ -48,6 +48,7 @@ #include "Descriptors.h" #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Drivers/Board/LEDs.h> /* Macros: */ /** Version major of the CDC bootloader. */ |
