SetupHardware();
/* Turn on first LED on the board to indicate that the bootloader has started */
- //LEDs_SetAllLEDs(LEDS_LED1);
+ LEDs_SetAllLEDs(LEDS_LED1);
/* Enable global interrupts so that the USB stack can function */
GlobalInterruptEnable();
/* Initialize the USB and other board hardware drivers */
USB_Init();
- //LEDs_Init();
- DDRB = 1;
- PORTB = _BV(PB5);
- DDRD = 0b00100000;
- PORTD = 0;
+ LEDs_Init();
/* Bootloader active LED toggle timer initialization */
TIMSK1 = (1 << TOIE1);
{
/* Shut down the USB and other board hardware drivers */
USB_Disable();
- //LEDs_Disable();
- DDRB = 0;
- PORTB = 0;
- DDRD = 0;
- PORTD = 0;
+ LEDs_Disable();
/* Disable Bootloader active LED toggle timer */
TIMSK1 = 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);
- PORTB &= ~_BV(PB0);
- _delay_ms(5);
- PORTB |= _BV(PB0);
+ LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
}
/** Event handler for the USB_ControlRequest event. This is used to catch and process control requests sent to
stayinbootloader = true;
/* Activity - toggle indicator LEDs */
- //LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
- PORTB &= ~_BV(PB0);
- _delay_ms(5);
- PORTB |= _BV(PB0);
+ LEDs_ToggleLEDs(LEDS_LED1 | LEDS_LED2);
/* Get the size of the command and data from the wLength value */
SentCommand.DataSize = USB_ControlRequest.wLength;