Fix the Benito project not pulsing the target's /RESET line when DTR is de-asserted.

This commit is contained in:
Dean Camera 2010-01-17 05:32:41 +00:00
parent f3d370a777
commit f9781ca6ff
2 changed files with 10 additions and 2 deletions

View File

@ -37,6 +37,7 @@
* - Fixed Class Driver struct interface numbers in the KeyboardMouse and VirtualSerialMouse demos (thanks to Renaud Cerrato) * - Fixed Class Driver struct interface numbers in the KeyboardMouse and VirtualSerialMouse demos (thanks to Renaud Cerrato)
* - Fixed invalid USB controller PLL prescaler values for the ATMEGAxxU2 controllers * - Fixed invalid USB controller PLL prescaler values for the ATMEGAxxU2 controllers
* - Fixed lack of support for the ATMEGA32U2 in the DFU and CDC class bootloaders * - Fixed lack of support for the ATMEGA32U2 in the DFU and CDC class bootloaders
* - Fixed Benito project not resetting the target AVR automatically when programming has completed
* *
* \section Sec_ChangeLog091223 Version 091223 * \section Sec_ChangeLog091223 Version 091223
* *

View File

@ -48,6 +48,9 @@ volatile struct
uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */ uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */
} PulseMSRemaining; } PulseMSRemaining;
/** Previous state of the virtual DTR control line from the host */
bool PreviousDTRState = false;
/** LUFA CDC Class driver interface configuration and state information. This structure is /** 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 * passed to all CDC Class driver functions, so that multiple instances of the same class
* within a device can be differentiated from one another. * within a device can be differentiated from one another.
@ -247,12 +250,16 @@ ISR(USART1_RX_vect, ISR_BLOCK)
*/ */
void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo)
{ {
/* Check if the DTR line has been asserted - if so, start the target AVR's reset pulse */ bool CurrentDTRState = CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR);
if (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR)
/* Check if the DTR line has been de-asserted - if so, start the target AVR's reset pulse */
if (PreviousDTRState && !(CurrentDTRState))
{ {
LEDs_SetAllLEDs(LEDMASK_BUSY); LEDs_SetAllLEDs(LEDMASK_BUSY);
AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS; PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;
} }
PreviousDTRState = CurrentDTRState;
} }