1. Jon S
  2. foot-joy


All related information, files, and source code for this hardware:

This code is provided for education and as a starting point for your own
projects. I think it unlikely you will use it exactly as I have, but you are 
free to.

In either case, however, here's some general instruction for getting it set up:

1. Build some cool hardware.
   - Hook it all to an Arduino UNO. Use revision 2 or newer if you can, else all
     the USB code may not fit later on.

2. Working from the foot_joy sketch, get your basic Arduino sketch working.
   - Define HUMAN_READABLE, upload your sketch, and look at the serial logs to
     verify things work correctly.
   - When everything is working well, comment out HUMAN_READABLE and flash the
     sketch again.

3. Get setup to flash the USB chip.
   - Get a version of dfu-programmer that supports your Arduino. Likely, that
     means get the dfu-programmer source, apply the included patch
     (`patch -p1 < dfu-programmer-16u.diff`), build, and install.
   - Get the LUFA library source.
   - Dump/symlink this source into LUFA's "Projects" directory.
   - If you are using a mega or an UNO R1, you need to change the
     ARDUINO_MODEL_PID and maybe some other options in the makefile.
   - Read this: http://arduino.cc/en/Hacking/DFUProgramming8U2
     - Make sure you can follow these steps. Keep a copy of this serial firmware
       on hand as you will need it later.
   - Start with a `make clean && make` to make sure everything is setup right.

4. Flash new code to the USB chip.
   - Edit Arduino-joystick.[c|h], Descriptors.c, and other files as needed.
   - Put the USB chip in DFU mode by resetting it (as explained in the article
     linked above).
     - If you run `lsusb`, you should see something like "Arduino Uno DFU", 
       "Arduino Mega 2560 DFU", or something about Atmel.
   - make && sudo make dfu
     - If you use Windows instead of Linux there is a 'make flip' target that
       might work with some tweaking, but I haven't tried it.
   - Unplug the USB cable for the Arduino and plug it back in.
5. Test and, hopefully, use your new home-built HID device.

6. (When needed) Revert to the original serial firmware to reprogram the Atmel
   - Unless you have an ISP programmer, you will need to revert the USB firmware
     to update the Arduino sketch.
   - Assuming the latest firmware is in Arduino-usbserial-original.hex and your
     chip is the same as mine, run `./reset_chip`, else follow the instructions
     in the article above.