Skip to content

Commit ada1227

Browse files
Merge branch 'SerialUSB_DTR_RTS' of https://github.com/cyber-murmel/DigistumpArduino
2 parents 2f0fe1e + 5d3ba41 commit ada1227

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,13 @@ and Digistump LLC (digistump.com)
1616

1717
uchar sendEmptyFrame;
1818
static uchar intr3Status; /* used to control interrupt endpoint transmissions */
19+
static volatile union {
20+
uchar u8;
21+
struct {
22+
bool dtr: 1;
23+
bool rts: 1;
24+
} name;
25+
} controlLines;
1926

2027
DigiCDCDevice::DigiCDCDevice(void){}
2128

@@ -79,6 +86,17 @@ int DigiCDCDevice::read()
7986
return RingBuffer_Remove(&rxBuf);
8087
}
8188

89+
90+
}
91+
92+
bool DigiCDCDevice::getDTR()
93+
{
94+
return controlLines.name.dtr;
95+
}
96+
97+
bool DigiCDCDevice::getRTS()
98+
{
99+
return controlLines.name.rts;
82100
}
83101

84102
int DigiCDCDevice::peek()
@@ -325,6 +343,7 @@ usbRequest_t *rq = (usbRequest_t*)((void *)data);
325343
*/
326344
if( intr3Status==0 )
327345
intr3Status = 2;
346+
controlLines.u8 = rq->wValue.word;
328347
}
329348

330349
/* Prepare bulk-in endpoint to respond to early termination */

digistump-avr/libraries/DigisparkCDC/DigiCDC.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class DigiCDCDevice : public Stream {
4545
virtual int available(void);
4646
virtual int peek(void);
4747
virtual int read(void);
48+
virtual bool getDTR(void);
49+
virtual bool getRTS(void);
4850
virtual void flush(void);
4951
virtual size_t write(uint8_t);
5052
using Print::write;

0 commit comments

Comments
 (0)