A precompiled .hex can be found in LUFA-100807-patched/Projects/. If you want to use that, you can skip this writeup.
This section is for the die-hard folks that want to start from vanilla downloads. If you're happy using the sources in LUFA-100807-patched, you can jump to the Build section.
Download the sources
- LUFA-100807, unzip and remove the contents of the Projects directory.
- dualMocoLUFA, unzip and move the files to the LUFA Projects directory.
Patch to specify the IDs, microcontroller and reverse the pin logic.
-
The main LUFA
makefile- change it so that it only builds the
Projectsdirectory
- change it so that it only builds the
-
Projects\makefile(specify target)- line 65:
MCU = atmega16u2 - line 72:
ARDUINO_MODEL_PID = 0x0043
- line 65:
-
Projects\Descriptors.c(fix compile error and specify identifiers)- search and replace
PROGMEMwithPROGMEM const - line 80:
.VendorID = 0x2341 - line 82:
.ProductID = ARDUINO_MODEL_PID
- search and replace
-
Projects\Descriptors.c(change the USB device name)- line 452:
.Header = {.Size = USB_STRING_LEN(14), .Type = DTYPE_String} - line 454:
.UnicodeString = L"Pitch Detector"
- line 452:
-
Projects\Descriptors.h(specify ID)- line 57:
ARDUINO_UNO_PID 0x0043
- line 57:
-
Projects\dualMoco.c(reverse the logic)- line 48: mocoMode = 0
- line 340: mocoMode = 1
From Linux (e.g. Window Subsystem for Linux)
sudo apt-get install binutils make gcc-avr avr-libc uisp avrdude flex byacc bison
cd Projects
make clean
make -s
Move the resulting Projects/dualMoco.hex over to your regular environment.1
Footnotes
-
For your piece of mind, the original firmware can be found in the Arduino directory as
hardware\arduino\avr\firmwares\atmegaxxu2\arduino-usbserial\Arduino-usbserial-atmega16u2-Uno-Rev3.hex. ↩