aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--LUFA/ManPages/LUFAPoweredProjects.txt4
-rw-r--r--Projects/Benito/Benito.c32
-rw-r--r--Projects/Benito/Benito.h16
-rw-r--r--Projects/Benito/Benito.txt5
-rw-r--r--Projects/Benito/makefile3
5 files changed, 37 insertions, 23 deletions
diff --git a/LUFA/ManPages/LUFAPoweredProjects.txt b/LUFA/ManPages/LUFAPoweredProjects.txt
index 68e6fb619..11d16480e 100644
--- a/LUFA/ManPages/LUFAPoweredProjects.txt
+++ b/LUFA/ManPages/LUFAPoweredProjects.txt
@@ -20,10 +20,10 @@
*
* - AVROpendous, an open design/source set of AVR USB development boards: http://avropendous.org/
* - Benito #7, a no-frills USB board: http://www.dorkbotpdx.org/blog/feurig/benito_7_the_next_big_thing
- * - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
+ * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/
* - USB10 AKA "The Ferret", a AT90USB162 development board: http://www.soc-machines.com
+ * - USBFoo, an AT90USB162 based development board: http://shop.kernelconcepts.de/product_info.php?products_id=102
* - Teensy and Teensy++, two other AVR USB development boards: http://www.pjrc.com/teensy/index.html
- * - Bumble-B, yet another AT90USB162 development board: http://fletchtronics.net/
*
* \section Sec_LUFAProjects Projects Using LUFA (Hobbyist)
*
diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c
index 720a2245d..1afb74a72 100644
--- a/Projects/Benito/Benito.c
+++ b/Projects/Benito/Benito.c
@@ -45,6 +45,9 @@ volatile uint8_t TxPulseMSRemaining = 0;
/** Counter for the number of milliseconds remaining for the RX activity LED pulse being generated. */
volatile uint8_t RxPulseMSRemaining = 0;
+/** Counter for the number of milliseconds remaining for the enumeration LED ping-pong being generated. */
+volatile uint8_t PingPongMSRemaining = 0;
+
/** LUFA CDC Class driver interface configuration and state information. This structure is
* passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another.
@@ -78,8 +81,6 @@ int main(void)
{
SetupHardware();
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
-
for (;;)
{
/* Echo bytes from the host to the target via the hardware USART */
@@ -103,10 +104,20 @@ int main(void)
/* Check if the millisecond timer has elapsed */
if (TIFR0 & (1 << OCF0A))
{
+ /* Check if the LEDs should be ping-ponging (during enumeration) */
+ if (PingPongMSRemaining && !(--PingPongMSRemaining))
+ {
+ LEDs_ChangeLEDs(LEDMASK_BUSY, (~LEDs_GetLEDs() & LEDMASK_BUSY));
+ PingPongMSRemaining = PING_PONG_LED_PULSE_MS;
+ }
+
/* Check if the reset pulse period has elapsed, if so tristate the target reset line */
if (ResetPulseMSRemaining && !(--ResetPulseMSRemaining))
- AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
-
+ {
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);
+ AVR_RESET_LINE_DDR &= ~AVR_RESET_LINE_MASK;
+ }
+
/* Turn off TX LED(s) once the TX pulse period has elapsed */
if (TxPulseMSRemaining && !(--TxPulseMSRemaining))
LEDs_TurnOffLEDs(LEDMASK_TX);
@@ -151,22 +162,25 @@ void SetupHardware(void)
/** Event handler for the library USB Connection event. */
void EVENT_USB_Connect(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_ENUMERATING);
+ PingPongMSRemaining = PING_PONG_LED_PULSE_MS;
+ LEDs_SetAllLEDs(LEDMASK_TX);
}
/** Event handler for the library USB Disconnection event. */
void EVENT_USB_Disconnect(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_NOTREADY);
+ PingPongMSRemaining = 0;
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);
}
/** Event handler for the library USB Configuration Changed event. */
void EVENT_USB_ConfigurationChanged(void)
{
- LEDs_SetAllLEDs(LEDMASK_USB_READY);
+ PingPongMSRemaining = 0;
+ LEDs_TurnOffLEDs(LEDMASK_BUSY);
if (!(CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface)))
- LEDs_SetAllLEDs(LEDMASK_USB_ERROR);
+ LEDs_TurnOnLEDs(LEDMASK_ERROR);
}
/** Event handler for the library USB Unhandled Control Packet event. */
@@ -224,6 +238,8 @@ void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const C
/* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */
if (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR)
{
+ LEDs_TurnOnLEDs(LEDMASK_BUSY);
+
AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
ResetPulseMSRemaining = AVR_RESET_PULSE_MS;
}
diff --git a/Projects/Benito/Benito.h b/Projects/Benito/Benito.h
index 5eefd7aeb..740319f64 100644
--- a/Projects/Benito/Benito.h
+++ b/Projects/Benito/Benito.h
@@ -51,24 +51,16 @@
#include <LUFA/Drivers/USB/Class/CDC.h>
/* Macros: */
- /** LED mask for the library LED driver, to indicate that the USB interface is not ready. */
- #define LEDMASK_USB_NOTREADY LEDS_NO_LEDS
-
- /** LED mask for the library LED driver, to indicate that the USB interface is enumerating. */
- #define LEDMASK_USB_ENUMERATING (LEDS_LED1 | LEDS_LED2)
-
- /** LED mask for the library LED driver, to indicate that the USB interface is ready. */
- #define LEDMASK_USB_READY LEDS_NO_LEDS
-
- /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */
- #define LEDMASK_USB_ERROR (LEDS_LED1 | LEDS_LED2)
-
/** LED mask for the library LED driver, to indicate TX activity. */
#define LEDMASK_TX LEDS_LED1
/** LED mask for the library LED driver, to indicate RX activity. */
#define LEDMASK_RX LEDS_LED2
+ #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2)
+
+ #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2)
+
/* Function Prototypes: */
void SetupHardware(void);
diff --git a/Projects/Benito/Benito.txt b/Projects/Benito/Benito.txt
index 956c69a33..857a28f8d 100644
--- a/Projects/Benito/Benito.txt
+++ b/Projects/Benito/Benito.txt
@@ -90,5 +90,10 @@
* <td>Makefile CDEFS</td>
* <td>Pulse length in milliseconds for the activity Tx/Rx LEDs.</td>
* </tr>
+ * <tr>
+ * <td>PING_PONG_LED_PULSE_MS</td>
+ * <td>Makefile CDEFS</td>
+ * <td>Pulse length in milliseconds for the enumeration LED ping-poning between toggles.</td>
+ * </tr>
* </table>
*/
diff --git a/Projects/Benito/makefile b/Projects/Benito/makefile
index 71422b64e..a785788c7 100644
--- a/Projects/Benito/makefile
+++ b/Projects/Benito/makefile
@@ -196,7 +196,8 @@ CDEFS += -DAVR_RESET_LINE_PORT="PORTB"
CDEFS += -DAVR_RESET_LINE_DDR="DDRB"
CDEFS += -DAVR_RESET_LINE_MASK="(1 << 0)"
CDEFS += -DAVR_RESET_PULSE_MS=10
-CDEFS += -DTX_RX_LED_PULSE_MS=10
+CDEFS += -DTX_RX_LED_PULSE_MS=30
+CDEFS += -DPING_PONG_LED_PULSE_MS=100
# Place -D or -U options here for ASM sources
ADEFS = -DF_CPU=$(F_CPU)