Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add RTS and DTR to SerialUSB
  • Loading branch information
cyber-murmel committed Feb 18, 2022
commit 5d3ba410570d1b5d7434d2bc6abd8b1c1f4765cf
19 changes: 19 additions & 0 deletions digistump-avr/libraries/DigisparkCDC/DigiCDC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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){}

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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 */
Expand Down
2 changes: 2 additions & 0 deletions digistump-avr/libraries/DigisparkCDC/DigiCDC.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down