Tweak direction handling.
No need to keep reset 12 asserted.
Move things of main into sensible places.
Convert USB regs to a struct.
Replace bogus wait with a spin.