diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/osccalASM.S | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/firmware/osccalASM.S b/firmware/osccalASM.S index e8e174e..fa26dc4 100644 --- a/firmware/osccalASM.S +++ b/firmware/osccalASM.S @@ -113,6 +113,8 @@ usbCOloop: #endif nop +usbCOLoopNoCal: + ; Delay values = F_CPU * 999e-6 / 5 + 0.5 #if (F_CPU == 16500000) @@ -145,6 +147,22 @@ usbCOWaitLoop: sbic USBIN, USBMINUS ;[2] rjmp usbCOWaitLoop ;[3] + sbis USBIN, USBPLUS ; ignore frame if data is present + rjmp usbCOnotdata + +usbCOWaitNoData: + in cnt16H, USBIN ; wait for SE0 state (both lines low) + andi cnt16H, (1<<USBPLUS)|(1<<USBMINUS) + brne usbCOWaitNoData + in cnt16H, USBIN ; be sure SE0 state wasn't a glitch + andi cnt16H, (1<<USBPLUS)|(1<<USBMINUS) + brne usbCOWaitNoData +usbCOWaitNoData2: + sbis USBIN, USBMINUS ; wait for D- go to high + rjmp usbCOWaitNoData2 + rjmp usbCOLoopNoCal + +usbCOnotdata: sbrs cnt16H, 7 ;delay overflow? rjmp usbCOclocktoolow sub try, stp |