From 3586e27dcbc936df27008d6ea4ae95ddd964a914 Mon Sep 17 00:00:00 2001 From: Alexander Entinger Date: Mon, 27 May 2019 08:44:04 +0200 Subject: [PATCH] Using available defines/constants instead of hardcoded values for linestate --- cores/arduino/USB/CDC.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cores/arduino/USB/CDC.cpp b/cores/arduino/USB/CDC.cpp index cda32b69c..39f4e5a97 100644 --- a/cores/arduino/USB/CDC.cpp +++ b/cores/arduino/USB/CDC.cpp @@ -155,7 +155,7 @@ bool Serial_::setup(USBSetup& setup) // auto-reset into the bootloader is triggered when the port, already // open at 1200 bps, is closed. We check DTR state to determine if host // port is open (bit 0 of lineState). - if (_usbLineInfo.dwDTERate == 1200 && (_usbLineInfo.lineState & 0x01) == 0) + if (_usbLineInfo.dwDTERate == 1200 && (_usbLineInfo.lineState & CDC_LINESTATE_DTR) == 0) { initiateReset(250); } @@ -326,11 +326,11 @@ uint8_t Serial_::numbits() { } bool Serial_::dtr() { - return _usbLineInfo.lineState & 0x1; + return ((_usbLineInfo.lineState & CDC_LINESTATE_DTR) == CDC_LINESTATE_DTR); } bool Serial_::rts() { - return _usbLineInfo.lineState & 0x2; + return ((_usbLineInfo.lineState & CDC_LINESTATE_RTS) == CDC_LINESTATE_RTS); } Serial_ SerialUSB(USBDevice);