From a83f08533043f933365cdf3d69c7aef9dd2028d7 Mon Sep 17 00:00:00 2001 From: Erik Tylek Kettenburg Date: Wed, 14 Jan 2015 21:39:48 -0800 Subject: [PATCH] Update DigiCDC.cpp make delay configurable --- .../digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/hardware/digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp b/hardware/digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp index 460d2fb..bb852c8 100644 --- a/hardware/digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp +++ b/hardware/digistump/avr/libraries/DigisparkCDC/DigiCDC.cpp @@ -16,7 +16,7 @@ and Digistump LLC (digistump.com) uchar sendEmptyFrame; static uchar intr3Status; /* used to control interrupt endpoint transmissions */ - +uint8_t cdcDelay = 45; //9 works if sending short strings only or not using F() - set with setDelay DigiCDCDevice::DigiCDCDevice(void){} @@ -41,6 +41,11 @@ void DigiCDCDevice::begin(){ usbBegin(); +} +void DigiCDCDevice::setDelay(uint8_t delay){ + + cdcDelay = delay; + } size_t DigiCDCDevice::write(uint8_t c) { @@ -52,7 +57,7 @@ size_t DigiCDCDevice::write(uint8_t c) else { RingBuffer_Insert(&txBuf,c); - DigiCDCDevice::delay(45); //ouch its slow but it ensures it will work no matter how long of a string is thrown at it + DigiCDCDevice::delay(cdcDelay); //ouch its slow but it ensures it will work no matter how long of a string is thrown at it return 1; } @@ -384,4 +389,4 @@ void usbFunctionWriteOut( uchar *data, uchar len ) } // extern "C" #endif -DigiCDCDevice SerialUSB; \ No newline at end of file +DigiCDCDevice SerialUSB;