Change usb polling interval to 1ms.
Implement debounce code in a state machine.

Previous logic was complicated and the new state machine apporach
gurantees that no logic errors are introduced in future development.