aboutsummaryrefslogtreecommitdiffstats
path: root/Projects/Benito
diff options
context:
space:
mode:
authorDean Camera <dean@fourwalledcubicle.com>2010-01-17 05:32:41 +0000
committerDean Camera <dean@fourwalledcubicle.com>2010-01-17 05:32:41 +0000
commitf9781ca6ff755602248f6fb050432fc81781cf98 (patch)
treed8c8fbf1f052f097ad3f803de106da6a062e6fbf /Projects/Benito
parentf3d370a7778dc8e374efc3b76e26f8ecefc27e84 (diff)
downloadlufa-f9781ca6ff755602248f6fb050432fc81781cf98.tar.gz
lufa-f9781ca6ff755602248f6fb050432fc81781cf98.tar.bz2
lufa-f9781ca6ff755602248f6fb050432fc81781cf98.zip
Fix the Benito project not pulsing the target's /RESET line when DTR is de-asserted.
Diffstat (limited to 'Projects/Benito')
-rw-r--r--Projects/Benito/Benito.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/Projects/Benito/Benito.c b/Projects/Benito/Benito.c
index 9ced17626..10e2e8fb3 100644
--- a/Projects/Benito/Benito.c
+++ b/Projects/Benito/Benito.c
@@ -48,6 +48,9 @@ volatile struct
uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */
} 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
* passed to all CDC Class driver functions, so that multiple instances of the same class
* 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)
{
- /* 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)
+ bool CurrentDTRState = 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);
AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK;
PulseMSRemaining.ResetPulse = AVR_RESET_PULSE_MS;
}
+
+ PreviousDTRState = CurrentDTRState;
}