Specifications

USB Main Loop
SUSPEND_
FLAG = 1?
SCAN_FLAG
= 1?
Call usb_scan_keys
Error in
scan?
New key
found in
scan?
Fill EP1 FIFO
with 1s
(Rollover
Error);
Enable EP1
transmission
Fill EP1 FIFO
with Key Buffer;
Enable EP1
transmission
n
n
y
y
n
n
y
1 ms ISR
Clear watchdog
timer
3 ms of
bus
inactivity?
Set SUSPEND_FLAG
= 1
Has 4 ms
past?
Set SCAN_FLAG = 1
Return
n
n
y
y
y
Figure 20. USB Main Loop
Figure 21. USB 1ms & GPIO ISRs
Call mousetask;
Fill EP2 FIFO withMouse Buffer;
Enable EP2 Transmission*
SCAN_FLAG = 0
Suspend;
Wait for GPIO ISR
(key press or
mouse activity*);
SUSPEND_FLAG
= 0;
Resume
Call mouse_1ms_int*
GPIO ISR
Call mouse_int*
Return
*optional for slave mouse support