From caeaa4571c3832982480a27e52f8435d85e2dc72 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 9 Apr 2012 08:06:35 -0400 Subject: [PATCH] sketch USB VID and PID values are passed in from boards.txt at compile time now. changed sketch PIDs to final values. also uncommented Micro section in boards.txt --- app/src/processing/app/debug/Compiler.java | 10 ++++- hardware/arduino/boards.txt | 37 +++++++++++-------- hardware/arduino/cores/arduino/USBCore.cpp | 4 +- hardware/arduino/cores/arduino/USBDesc.h | 4 -- .../arduino/variants/leonardo/pins_arduino.h | 2 - .../arduino/variants/micro/pins_arduino.h | 2 - 6 files changed, 31 insertions(+), 28 deletions(-) diff --git a/app/src/processing/app/debug/Compiler.java b/app/src/processing/app/debug/Compiler.java index d978af4f0..20fa361b4 100644 --- a/app/src/processing/app/debug/Compiler.java +++ b/app/src/processing/app/debug/Compiler.java @@ -542,8 +542,10 @@ public class Compiler implements MessageConsumer { "-g", // include debugging info (so errors include line numbers) "-assembler-with-cpp", "-mmcu=" + boardPreferences.get("build.mcu"), - "-DF_CPU=" + boardPreferences.get("build.f_cpu"), + "-DF_CPU=" + boardPreferences.get("build.f_cpu"), "-DARDUINO=" + Base.REVISION, + "-DUSB_VID=" + boardPreferences.get("build.vid"), + "-DUSB_PID=" + boardPreferences.get("build.pid"), })); for (int i = 0; i < includePaths.size(); i++) { @@ -571,7 +573,9 @@ public class Compiler implements MessageConsumer { "-mmcu=" + boardPreferences.get("build.mcu"), "-DF_CPU=" + boardPreferences.get("build.f_cpu"), "-MMD", // output dependancy info - "-DARDUINO=" + Base.REVISION, + "-DUSB_VID=" + boardPreferences.get("build.vid"), + "-DUSB_PID=" + boardPreferences.get("build.pid"), + "-DARDUINO=" + Base.REVISION, })); for (int i = 0; i < includePaths.size(); i++) { @@ -602,6 +606,8 @@ public class Compiler implements MessageConsumer { "-mmcu=" + boardPreferences.get("build.mcu"), "-DF_CPU=" + boardPreferences.get("build.f_cpu"), "-MMD", // output dependancy info + "-DUSB_VID=" + boardPreferences.get("build.vid"), + "-DUSB_PID=" + boardPreferences.get("build.pid"), "-DARDUINO=" + Base.REVISION, })); diff --git a/hardware/arduino/boards.txt b/hardware/arduino/boards.txt index 710ae275d..3a94d2678 100644 --- a/hardware/arduino/boards.txt +++ b/hardware/arduino/boards.txt @@ -155,31 +155,36 @@ leonardo.bootloader.low_fuses=0xff leonardo.bootloader.high_fuses=0xd8 leonardo.bootloader.extended_fuses=0xcb leonardo.bootloader.path=caterina -leonardo.bootloader.file=Caterina.hex +leonardo.bootloader.file=Caterina-Leonardo.hex leonardo.bootloader.unlock_bits=0x3F leonardo.bootloader.lock_bits=0x2F leonardo.build.mcu=atmega32u4 leonardo.build.f_cpu=16000000L +leonardo.build.vid=0x2341 +leonardo.build.pid=0x8034 leonardo.build.core=arduino leonardo.build.variant=leonardo ############################################################## -#micro.name=Arduino Micro -#micro.upload.protocol=arduino -#micro.upload.maximum_size=30720 -#micro.upload.speed=1200 -#micro.bootloader.low_fuses=0xde -#micro.bootloader.high_fuses=0xda -#micro.bootloader.extended_fuses=0xcb -#micro.bootloader.path=caterina -#micro.bootloader.file=Caterina-Micro.hex -#micro.bootloader.unlock_bits=0x3F -#micro.bootloader.lock_bits=0x2F -#micro.build.mcu=atmega32u4 -#micro.build.f_cpu=16000000L -#micro.build.core=arduino -#micro.build.variant=micro +micro.name=Arduino Micro +micro.upload.protocol=avr109 +micro.upload.maximum_size=28672 +micro.upload.speed=57600 +micro.upload.disable_flushing=true +micro.bootloader.low_fuses=0xff +micro.bootloader.high_fuses=0xd8 +micro.bootloader.extended_fuses=0xcb +micro.bootloader.path=caterina +micro.bootloader.file=Caterina-Micro.hex +micro.bootloader.unlock_bits=0x3F +micro.bootloader.lock_bits=0x2F +micro.build.mcu=atmega32u4 +micro.build.f_cpu=16000000L +micro.build.vid=0x2341 +micro.build.pid=0x8035 +micro.build.core=arduino +micro.build.variant=micro ############################################################## diff --git a/hardware/arduino/cores/arduino/USBCore.cpp b/hardware/arduino/cores/arduino/USBCore.cpp index c360d262a..d1aeace3f 100644 --- a/hardware/arduino/cores/arduino/USBCore.cpp +++ b/hardware/arduino/cores/arduino/USBCore.cpp @@ -51,9 +51,9 @@ const u16 STRING_LANGUAGE[2] = { const u16 STRING_IPRODUCT[17] = { (3<<8) | (2+2*16), -#if USB_PID == USB_PID_LEONARDO +#if USB_PID == 0x8034 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' -#elif USB_PID == USB_PID_MICRO +#elif USB_PID == 0x8035 'A','r','d','u','i','n','o',' ','M','i','c','r','o',' ',' ',' ' #endif }; diff --git a/hardware/arduino/cores/arduino/USBDesc.h b/hardware/arduino/cores/arduino/USBDesc.h index 5cd90adba..900713e0f 100644 --- a/hardware/arduino/cores/arduino/USBDesc.h +++ b/hardware/arduino/cores/arduino/USBDesc.h @@ -60,8 +60,4 @@ #define IMANUFACTURER 1 #define IPRODUCT 2 -#define USB_PID_LEONARDO 0x0801 -#define USB_PID_MICRO 0x0035 -#define USB_VID 0x2341 // arduino LLC vid -#define USB_PID ARDUINO_MODEL_USB_PID diff --git a/hardware/arduino/variants/leonardo/pins_arduino.h b/hardware/arduino/variants/leonardo/pins_arduino.h index 753aa93bb..ff9e4f98d 100644 --- a/hardware/arduino/variants/leonardo/pins_arduino.h +++ b/hardware/arduino/variants/leonardo/pins_arduino.h @@ -27,8 +27,6 @@ #include -#define ARDUINO_MODEL_USB_PID 0x0801 - #define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0) #define TXLED0 PORTD |= (1<<5) #define TXLED1 PORTD &= ~(1<<5) diff --git a/hardware/arduino/variants/micro/pins_arduino.h b/hardware/arduino/variants/micro/pins_arduino.h index c9f25eb12..06a585880 100644 --- a/hardware/arduino/variants/micro/pins_arduino.h +++ b/hardware/arduino/variants/micro/pins_arduino.h @@ -23,5 +23,3 @@ */ #include "../leonardo/pins_arduino.h" -#undef ARDUINO_MODEL_USB_PID -#define ARDUINO_MODEL_USB_PID 0x0035 \ No newline at end of file