*\r
* - AVROpendous, an open design/source set of AVR USB development boards: http://avropendous.org/\r
* - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/blog/feurig/benito_7_the_next_big_thing\r
- * - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102\r
+ * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/\r
* - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com\r
+ * - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102\r
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html\r
- * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/\r
* \r
* \section Sec_LUFAProjects Projects Using LUFA (Hobbyist)\r
*\r
/** Counter for the number of milliseconds remaining for the RX activity LED pulse being generated. */\r
volatile uint8_t RxPulseMSRemaining = 0;\r
\r
+/** Counter for the number of milliseconds remaining for the enumeration LED ping-pong being generated. */\r
+volatile uint8_t PingPongMSRemaining = 0;\r
+\r
/** LUFA CDC Class driver interface configuration and state information. This structure is\r
* passed to all CDC Class driver functions, so that multiple instances of the same class\r
* within a device can be differentiated from one another.\r
{\r
SetupHardware();\r
\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
-\r
for (;;)\r
{\r
/* Echo bytes from the host to the target via the hardware USART */\r
/* Check if the millisecond timer has elapsed */\r
if (TIFR0 & (1 << OCF0A))\r
{\r
+ /* Check if the LEDs should be ping-ponging (during enumeration) */\r
+ if (PingPongMSRemaining && !(--PingPongMSRemaining))\r
+ {\r
+ LEDs_ChangeLEDs(LEDMASK_BUSY, (~LEDs_GetLEDs() & LEDMASK_BUSY));\r
+ PingPongMSRemaining = PING_PONG_LED_PULSE_MS;\r
+ }\r
+ \r
/* Check if the reset pulse period has elapsed, if so tristate the target reset line */\r
if (ResetPulseMSRemaining && !(--ResetPulseMSRemaining))\r
- AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;\r
-\r
+ {\r
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);\r
+ AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;\r
+ }\r
+ \r
/* Turn off TX LED(s) once the TX pulse period has elapsed */\r
if (TxPulseMSRemaining && !(--TxPulseMSRemaining))\r
LEDs_TurnOffLEDs(LEDMASK_TX);\r
/** Event handler for the library USB Connection event. */\r
void EVENT_USB_Connect(void)\r
{\r
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);\r
+ PingPongMSRemaining = PING_PONG_LED_PULSE_MS;\r
+ LEDs_SetAllLEDs(LEDMASK_TX);\r
}\r
\r
/** Event handler for the library USB Disconnection event. */\r
void EVENT_USB_Disconnect(void)\r
{\r
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);\r
+ PingPongMSRemaining = 0;\r
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);\r
}\r
\r
/** Event handler for the library USB Configuration Changed event. */\r
void EVENT_USB_ConfigurationChanged(void)\r
{\r
- LEDs_SetAllLEDs(LEDMASK_USB_READY);\r
+ PingPongMSRemaining = 0;\r
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);\r
\r
if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))\r
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);\r
+ LEDs_TurnOnLEDs(LEDMASK_ERROR);\r
}\r
\r
/** Event handler for the library USB Unhandled Control Packet event. */\r
/* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */\r
if (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR)\r
{\r
+ LEDs_TurnOnLEDs(LEDMASK_BUSY);\r
+ \r
AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;\r
ResetPulseMSRemaining = AVR_RESET_PULSE_MS;\r
}\r
#include <LUFA/Drivers/USB/Class/CDC.h>\r
\r
/* Macros: */\r
- /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */\r
- #define LEDMASK_USB_NOTREADY LEDS_NO_LEDS\r
-\r
- /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */\r
- #define LEDMASK_USB_ENUMERATING (LEDS_LED1 | LEDS_LED2)\r
-\r
- /** LED mask for the library LED driver, to indicate that the USB interface is ready. */\r
- #define LEDMASK_USB_READY LEDS_NO_LEDS\r
-\r
- /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */\r
- #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED2)\r
- \r
/** LED mask for the library LED driver, to indicate TX activity. */\r
#define LEDMASK_TX LEDS_LED1\r
\r
/** LED mask for the library LED driver, to indicate RX activity. */\r
#define LEDMASK_RX LEDS_LED2\r
\r
+ #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2)\r
+ \r
+ #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)\r
+\r
/* Function Prototypes: */\r
void SetupHardware(void);\r
\r