diff --git a/digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp b/digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp index 938283a..26dfe73 100644 --- a/digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp +++ b/digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp @@ -16,6 +16,13 @@ and Digistump LLC (digistump.com) uchar sendEmptyFrame; static uchar intr3Status; /* used to control interrupt endpoint transmissions */ +static volatile union { + uchar u8; + struct { + bool dtr: 1; + bool rts: 1; + } name; +} controlLines; DigiCDCDevice::DigiCDCDevice(void){} @@ -79,6 +86,17 @@ int DigiCDCDevice::read() return RingBuffer_Remove(&rxBuf); } + +} + +bool DigiCDCDevice::getDTR() +{ + return controlLines.name.dtr; +} + +bool DigiCDCDevice::getRTS() +{ + return controlLines.name.rts; } int DigiCDCDevice::peek() @@ -325,6 +343,7 @@ usbRequest_t *rq = (usbRequest_t*)((void *)data); */ if( intr3Status==0 ) intr3Status = 2; + controlLines.u8 = rq->wValue.word; } /* Prepare bulk-in endpoint to respond to early termination */ diff --git a/digistump-avr/libraries/DigisparkCDC/DigiCDC.h b/digistump-avr/libraries/DigisparkCDC/DigiCDC.h index 31de73f..3d9ed79 100644 --- a/digistump-avr/libraries/DigisparkCDC/DigiCDC.h +++ b/digistump-avr/libraries/DigisparkCDC/DigiCDC.h @@ -45,6 +45,8 @@ class DigiCDCDevice : public Stream { virtual int available(void); virtual int peek(void); virtual int read(void); + virtual bool getDTR(void); + virtual bool getRTS(void); virtual void flush(void); virtual size_t write(uint8_t); using Print::write;