mirror of
				https://github.com/digistump/DigistumpArduino.git
				synced 2025-11-03 13:04:48 -08:00 
			
		
		
		
	Update DigiCDC.cpp
make delay configurable
This commit is contained in:
		@@ -16,7 +16,7 @@ and Digistump LLC (digistump.com)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uchar              sendEmptyFrame;
 | 
					uchar              sendEmptyFrame;
 | 
				
			||||||
static uchar       intr3Status;    /* used to control interrupt endpoint transmissions */
 | 
					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){}
 | 
					DigiCDCDevice::DigiCDCDevice(void){}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -41,6 +41,11 @@ void DigiCDCDevice::begin(){
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    usbBegin();
 | 
					    usbBegin();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					void DigiCDCDevice::setDelay(uint8_t delay){
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    cdcDelay = delay;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
size_t DigiCDCDevice::write(uint8_t c)
 | 
					size_t DigiCDCDevice::write(uint8_t c)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -52,7 +57,7 @@ size_t DigiCDCDevice::write(uint8_t c)
 | 
				
			|||||||
    else
 | 
					    else
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        RingBuffer_Insert(&txBuf,c);
 | 
					        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;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user