Fix the Benito project not pulsing the target's /RESET line when DTR is de-asserted.
authorDean Camera <dean@fourwalledcubicle.com>
Sun, 17 Jan 2010 05:32:41 +0000 (05:32 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sun, 17 Jan 2010 05:32:41 +0000 (05:32 +0000)
LUFA/ManPages/ChangeLog.txt
Projects/Benito/Benito.c

index 4c8a2f6..2e42013 100644 (file)
@@ -37,6 +37,7 @@
   *  - Fixed Class Driver struct interface numbers in the KeyboardMouse and VirtualSerialMouse demos (thanks to Renaud Cerrato)\r
   *  - Fixed invalid USB controller PLL prescaler values for the ATMEGAxxU2 controllers\r
   *  - Fixed lack of support for the ATMEGA32U2 in the DFU and CDC class bootloaders\r
+  *  - Fixed Benito project not resetting the target AVR automatically when programming has completed\r
   *\r
   *  \section Sec_ChangeLog091223 Version 091223\r
   *\r
index 9ced176..10e2e8f 100644 (file)
@@ -48,6 +48,9 @@ volatile struct
        uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */\r
 } PulseMSRemaining;\r
 \r
+/** Previous state of the virtual DTR control line from the host */\r
+bool PreviousDTRState = false;\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
@@ -247,12 +250,16 @@ ISR(USART1_RX_vect, ISR_BLOCK)
  */\r
 void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)\r
 {\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
+       bool CurrentDTRState = CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR);\r
+\r
+       /* Check if the DTR line has been de-asserted - if so, start the target AVR's reset pulse */\r
+       if (PreviousDTRState && !(CurrentDTRState))\r
        {\r
                LEDs_SetAllLEDs(LEDMASK_BUSY);\r
        \r
                AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;\r
                PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;\r
        }\r
+       \r
+       PreviousDTRState = CurrentDTRState;\r
 }\r