1
0
mirror of https://github.com/arduino/Arduino.git synced 2024-12-11 22:24:13 +01:00

support compile-time passing of PID to Leonardo/Micro sketches. PID comes from boards.txt - different for Micro and Leonardo

This commit is contained in:
Zach Eveland 2011-09-08 11:23:55 -04:00
parent 3b5122e138
commit 3e0d195492
2 changed files with 14 additions and 12 deletions

View File

@ -425,6 +425,10 @@ public class Compiler implements MessageConsumer {
"-DARDUINO=" + Base.REVISION, "-DARDUINO=" + Base.REVISION,
})); }));
if (boardPreferences.get("usb.pid") != null) {
baseCommandCompiler.add("-DARDUINO_MODEL_PID=" + boardPreferences.get("usb.pid"));
}
for (int i = 0; i < includePaths.size(); i++) { for (int i = 0; i < includePaths.size(); i++) {
baseCommandCompiler.add("-I" + (String) includePaths.get(i)); baseCommandCompiler.add("-I" + (String) includePaths.get(i));
} }
@ -452,6 +456,10 @@ public class Compiler implements MessageConsumer {
"-DARDUINO=" + Base.REVISION, "-DARDUINO=" + Base.REVISION,
})); }));
if (boardPreferences.get("usb.pid") != null) {
baseCommandCompiler.add("-DARDUINO_MODEL_PID=" + boardPreferences.get("usb.pid"));
}
for (int i = 0; i < includePaths.size(); i++) { for (int i = 0; i < includePaths.size(); i++) {
baseCommandCompiler.add("-I" + (String) includePaths.get(i)); baseCommandCompiler.add("-I" + (String) includePaths.get(i));
} }
@ -481,6 +489,10 @@ public class Compiler implements MessageConsumer {
"-DARDUINO=" + Base.REVISION, "-DARDUINO=" + Base.REVISION,
})); }));
if (boardPreferences.get("usb.pid") != null) {
baseCommandCompilerCPP.add("-DARDUINO_MODEL_PID=" + boardPreferences.get("usb.pid"));
}
for (int i = 0; i < includePaths.size(); i++) { for (int i = 0; i < includePaths.size(); i++) {
baseCommandCompilerCPP.add("-I" + (String) includePaths.get(i)); baseCommandCompilerCPP.add("-I" + (String) includePaths.get(i));
} }

View File

@ -89,19 +89,9 @@
#define FAT_FILE_NAME 'F','I','R','M','W','A','R','E','B','I','N' // 11 chars #define FAT_FILE_NAME 'F','I','R','M','W','A','R','E','B','I','N' // 11 chars
#define MSC_DISK_SERIAL '0','0','0','0','0','0','0','0','1','7','0','1' // 12 chars #define MSC_DISK_SERIAL '0','0','0','0','0','0','0','0','1','7','0','1' // 12 chars
#ifdef MICROTOUCH
#define USB_VID 0x239A // Adafruit vid
#define USB_PID 0x2001 // sorry dave sprach zarathustra
#define FAT_OEM_NAME 'r','o','s','s','u','m','u','r' // 8 chars
#define PRODUCT_NAME 'M','i','c','r','o','t','o','u','c','h'
#else
#define USB_VID 0x2341 // arduino LLC vid #define USB_VID 0x2341 // arduino LLC vid
#define USB_PID 0x0020 // educated guess #define USB_PID ARDUINO_MODEL_PID // passed in at compile time - 0x0034 for Leonardo, 0x0035 for MIcro
#define FAT_OEM_NAME 'l','e','o','n','a','r','d','o' // 8 chars #define FAT_OEM_NAME 'l','e','o','n','a','r','d','o' // 8 chars
#define PRODUCT_NAME 'A','r','d','u','i','n','o','l','l','c' // 10 #define PRODUCT_NAME 'A','r','d','u','i','n','o','l','l','c' // 10
#endif