Add recording/macro mode.

Allow sequences of key presses to be recorded and replayed. Also add
a magic keypress to allow the bootloader to be activated for
reprogramming.
Fix bug with recording mode.

Start recording on *release* of the recording button, not on press.
This is so that the release does not itself get recorded. Also reset
the keyboard/USB state before replay so that key presses/releases
are recorded in the right order.