mirror of
				https://github.com/digistump/DigistumpArduino.git
				synced 2025-11-03 13:04:48 -08:00 
			
		
		
		
	digicdc speed up! thanks @defragster
This commit is contained in:
		@@ -16,7 +16,6 @@ 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){}
 | 
			
		||||
 | 
			
		||||
@@ -40,13 +39,10 @@ void DigiCDCDevice::flush(){
 | 
			
		||||
void DigiCDCDevice::begin(){
 | 
			
		||||
 | 
			
		||||
    usbBegin();
 | 
			
		||||
    DigiCDCDevice::delay(500);//delay to allow enumeration and such
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
void DigiCDCDevice::setDelay(uint8_t delay){
 | 
			
		||||
 | 
			
		||||
    cdcDelay = delay;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
size_t DigiCDCDevice::write(uint8_t c)
 | 
			
		||||
{
 | 
			
		||||
    if(RingBuffer_IsFull(&txBuf))
 | 
			
		||||
@@ -57,7 +53,7 @@ size_t DigiCDCDevice::write(uint8_t c)
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        RingBuffer_Insert(&txBuf,c);
 | 
			
		||||
        DigiCDCDevice::delay(cdcDelay); //ouch its slow but it ensures it will work no matter how long of a string is thrown at it
 | 
			
		||||
        DigiCDCDevice::delay(5); //gives 4.2-4.7ms per character for usb transfer at low speed
 | 
			
		||||
        return 1;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 
 | 
			
		||||
@@ -38,7 +38,6 @@ class DigiCDCDevice  : public Stream {
 | 
			
		||||
    public:
 | 
			
		||||
        DigiCDCDevice();
 | 
			
		||||
        void begin(), begin(unsigned long x);
 | 
			
		||||
        void setDelay(uint8_t delay);
 | 
			
		||||
        void end();
 | 
			
		||||
        void refresh();
 | 
			
		||||
        void task();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user