Skip to content

Commit 566feb7

Browse files
authored
Merge pull request #413 from arduino/refactor-usb-stack
Using available defines instead of hardcoded values within USB stack
2 parents 3c0fc11 + 3586e27 commit 566feb7

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cores/arduino/USB/CDC.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ bool Serial_::setup(USBSetup& setup)
155155
// auto-reset into the bootloader is triggered when the port, already
156156
// open at 1200 bps, is closed. We check DTR state to determine if host
157157
// port is open (bit 0 of lineState).
158-
if (_usbLineInfo.dwDTERate == 1200 && (_usbLineInfo.lineState & 0x01) == 0)
158+
if (_usbLineInfo.dwDTERate == 1200 && (_usbLineInfo.lineState & CDC_LINESTATE_DTR) == 0)
159159
{
160160
initiateReset(250);
161161
}
@@ -326,11 +326,11 @@ uint8_t Serial_::numbits() {
326326
}
327327

328328
bool Serial_::dtr() {
329-
return _usbLineInfo.lineState & 0x1;
329+
return ((_usbLineInfo.lineState & CDC_LINESTATE_DTR) == CDC_LINESTATE_DTR);
330330
}
331331

332332
bool Serial_::rts() {
333-
return _usbLineInfo.lineState & 0x2;
333+
return ((_usbLineInfo.lineState & CDC_LINESTATE_RTS) == CDC_LINESTATE_RTS);
334334
}
335335

336336
Serial_ SerialUSB(USBDevice);

0 commit comments

Comments
 (0)