duinocube: add USB joystick test
firmware: Disable interrupts when accessing millisecond counter

The millisecond counter is a software variable but it's a uint16_t.  This
means the access will not be atomic on an 8-bit system.  An interrupt
could happen in between reading the two bytes and change the value.

This patch disables interrupts before a read/reset of the counter, if they
were enabled.  Afterwards, it reenables the interrupt if it was previously
enabled.
firmware: Fix USB library to account for timer overflow

The 16-bit millisecond counter overflows about once a minute (2^16 ms).
The USB library should compute intervals between two values read from the
counter, and compare that to a threshold.  This will properly handle the
wraparound.

Previously, the code computed the expected threshold time (initial +
delay).  This is not robust enough to deal with overflows.