Skip to content

Commit a83f085

Browse files
author
Erik Tylek Kettenburg
committed
Update DigiCDC.cpp
make delay configurable
1 parent d56454e commit a83f085

File tree

1 file changed

+8
-3
lines changed
  • hardware/digistump/avr/libraries/DigisparkCDC

1 file changed

+8
-3
lines changed

hardware/digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ and Digistump LLC (digistump.com)
1616

1717
uchar sendEmptyFrame;
1818
static uchar intr3Status; /* used to control interrupt endpoint transmissions */
19-
19+
uint8_t cdcDelay = 45; //9 works if sending short strings only or not using F() - set with setDelay
2020

2121
DigiCDCDevice::DigiCDCDevice(void){}
2222

@@ -41,6 +41,11 @@ void DigiCDCDevice::begin(){
4141

4242
usbBegin();
4343

44+
}
45+
void DigiCDCDevice::setDelay(uint8_t delay){
46+
47+
cdcDelay = delay;
48+
4449
}
4550
size_t DigiCDCDevice::write(uint8_t c)
4651
{
@@ -52,7 +57,7 @@ size_t DigiCDCDevice::write(uint8_t c)
5257
else
5358
{
5459
RingBuffer_Insert(&txBuf,c);
55-
DigiCDCDevice::delay(45); //ouch its slow but it ensures it will work no matter how long of a string is thrown at it
60+
DigiCDCDevice::delay(cdcDelay); //ouch its slow but it ensures it will work no matter how long of a string is thrown at it
5661
return 1;
5762
}
5863

@@ -384,4 +389,4 @@ void usbFunctionWriteOut( uchar *data, uchar len )
384389
} // extern "C"
385390
#endif
386391

387-
DigiCDCDevice SerialUSB;
392+
DigiCDCDevice SerialUSB;

0 commit comments

Comments
 (0)