aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--boards.txt35
-rw-r--r--bootloaders/atmega/ATmegaBOOT_168.c23
-rwxr-xr-x[-rw-r--r--]bootloaders/atmega/Makefile27
-rw-r--r--bootloaders/bt/ATmegaBOOT_168.c21
-rw-r--r--bootloaders/caterina/Caterina-Genuino-Micro.hex257
-rw-r--r--bootloaders/caterina/Caterina-Genuino-Micro.txt19
-rw-r--r--bootloaders/optiboot/optiboot.c2
-rw-r--r--bootloaders/optiboot/pin_defs.h2
-rw-r--r--bootloaders/stk500v2/avrinterruptnames.h8
-rw-r--r--cores/arduino/CDC.cpp84
-rw-r--r--cores/arduino/HID.cpp518
-rw-r--r--cores/arduino/HardwareSerial.cpp3
-rw-r--r--cores/arduino/HardwareSerial.h4
-rw-r--r--cores/arduino/IPAddress.cpp42
-rw-r--r--cores/arduino/IPAddress.h7
-rw-r--r--cores/arduino/PluggableUSB.cpp115
-rw-r--r--cores/arduino/PluggableUSB.h74
-rw-r--r--cores/arduino/Print.cpp7
-rw-r--r--cores/arduino/Stream.cpp66
-rw-r--r--cores/arduino/Stream.h42
-rw-r--r--cores/arduino/Tone.cpp3
-rw-r--r--cores/arduino/USBAPI.h168
-rw-r--r--cores/arduino/USBCore.cpp321
-rw-r--r--cores/arduino/USBCore.h60
-rw-r--r--cores/arduino/USBDesc.h75
-rw-r--r--cores/arduino/WInterrupts.c62
-rw-r--r--cores/arduino/WString.cpp6
-rw-r--r--cores/arduino/WString.h6
-rw-r--r--cores/arduino/main.cpp3
-rw-r--r--cores/arduino/wiring.c14
-rw-r--r--cores/arduino/wiring_digital.c2
-rw-r--r--cores/arduino/wiring_private.h3
-rw-r--r--cores/arduino/wiring_pulse.c17
-rw-r--r--firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex490
-rw-r--r--firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Uno-R3.hex490
-rw-r--r--firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Mega2560-R3.hex248
-rw-r--r--firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Uno-R3.hex248
-rw-r--r--libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino4
-rw-r--r--libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino4
-rw-r--r--libraries/EEPROM/examples/eeprom_get/eeprom_get.ino4
-rw-r--r--libraries/EEPROM/examples/eeprom_put/eeprom_put.ino4
-rw-r--r--libraries/EEPROM/examples/eeprom_read/eeprom_read.ino2
-rw-r--r--libraries/EEPROM/library.properties3
-rw-r--r--libraries/HID/HID.cpp162
-rw-r--r--libraries/HID/HID.h125
-rw-r--r--libraries/HID/keywords.txt21
-rw-r--r--libraries/HID/library.properties9
-rw-r--r--libraries/SPI/library.properties1
-rw-r--r--libraries/SoftwareSerial/SoftwareSerial.cpp14
-rw-r--r--libraries/SoftwareSerial/SoftwareSerial.h5
-rw-r--r--libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino2
-rw-r--r--libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino2
-rw-r--r--libraries/SoftwareSerial/library.properties1
-rw-r--r--libraries/Wire/Wire.cpp5
-rw-r--r--libraries/Wire/Wire.h4
-rw-r--r--libraries/Wire/keywords.txt2
-rw-r--r--libraries/Wire/library.properties1
-rw-r--r--libraries/Wire/utility/twi.c30
-rw-r--r--libraries/Wire/utility/twi.h1
-rw-r--r--platform.keys.rewrite.txt20
-rw-r--r--platform.txt28
-rw-r--r--variants/ethernet/pins_arduino.h2
-rw-r--r--variants/gemma/pins_arduino.h6
-rw-r--r--variants/leonardo/pins_arduino.h16
64 files changed, 3043 insertions, 1007 deletions
diff --git a/boards.txt b/boards.txt
index 65df589..7b55a6d 100644
--- a/boards.txt
+++ b/boards.txt
@@ -46,7 +46,7 @@ yun.build.extra_flags={build.usb_flags}
##############################################################
-uno.name=Arduino Uno
+uno.name=Arduino/Genuino Uno
uno.vid.0=0x2341
uno.pid.0=0x0043
@@ -54,6 +54,8 @@ uno.vid.1=0x2341
uno.pid.1=0x0001
uno.vid.2=0x2A03
uno.pid.2=0x0043
+uno.vid.3=0x2341
+uno.pid.3=0x0243
uno.upload.tool=avrdude
uno.upload.protocol=arduino
@@ -168,7 +170,7 @@ nano.menu.cpu.atmega168.build.mcu=atmega168
##############################################################
-mega.name=Arduino Mega or Mega 2560
+mega.name=Arduino/Genuino Mega or Mega 2560
mega.vid.0=0x2341
mega.pid.0=0x0010
@@ -178,6 +180,10 @@ mega.vid.2=0x2A03
mega.pid.2=0x0010
mega.vid.3=0x2A03
mega.pid.3=0x0042
+mega.vid.4=0x2341
+mega.pid.4=0x0210
+mega.vid.5=0x2341
+mega.pid.5=0x0242
mega.upload.tool=avrdude
mega.upload.maximum_data_size=8192
@@ -190,10 +196,10 @@ mega.bootloader.lock_bits=0x0F
mega.build.f_cpu=16000000L
mega.build.core=arduino
mega.build.variant=mega
-# default board may be overridden by the cpu menu
+# default board may be overridden by the cpu menu
mega.build.board=AVR_MEGA2560
-## Arduino Mega w/ ATmega2560
+## Arduino/Genuino Mega w/ ATmega2560
## -------------------------
mega.menu.cpu.atmega2560=ATmega2560 (Mega 2560)
@@ -297,7 +303,8 @@ leonardo.build.extra_flags={build.usb_flags}
##############################################################
-micro.name=Arduino Micro
+micro.name=Arduino/Genuino Micro
+
micro.vid.0=0x2341
micro.pid.0=0x0037
micro.vid.1=0x2341
@@ -307,6 +314,24 @@ micro.pid.2=0x0037
micro.vid.3=0x2A03
micro.pid.3=0x8037
+micro.vid.4=0x2341
+micro.pid.4=0x0237
+# If the board is a 2341:0237 use 2341:8237 for build and set
+# other parameters as well
+micro.vid.4.build.vid=0x2341
+micro.vid.4.build.pid=0x8237
+micro.vid.4.build.usb_product="Genuino Micro"
+micro.vid.4.bootloader.file=caterina/Caterina-Genuino-Micro.hex
+
+micro.vid.5=0x2341
+micro.pid.5=0x8237
+# If the board is a 2341:8237 use 2341:8237 for build and set
+# other paramters as well
+micro.vid.5.build.vid=0x2341
+micro.vid.5.build.pid=0x8237
+micro.vid.5.build.usb_product="Genuino Micro"
+micro.vid.5.bootloader.file=caterina/Caterina-Genuino-Micro.hex
+
micro.upload.tool=avrdude
micro.upload.protocol=avr109
micro.upload.maximum_size=28672
diff --git a/bootloaders/atmega/ATmegaBOOT_168.c b/bootloaders/atmega/ATmegaBOOT_168.c
index ff21903..ff2c4e4 100644
--- a/bootloaders/atmega/ATmegaBOOT_168.c
+++ b/bootloaders/atmega/ATmegaBOOT_168.c
@@ -73,7 +73,7 @@
/* the current avr-libc eeprom functions do not support the ATmega168 */
/* own eeprom write/read functions are used instead */
-#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__)
+#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__) || !defined(__AVR_ATmega328__)
#include <avr/eeprom.h>
#endif
@@ -202,6 +202,11 @@
#define SIG3 0x0F
#define PAGE_SIZE 0x40U //64 words
+#elif defined __AVR_ATmega328__
+#define SIG2 0x95
+#define SIG3 0x14
+#define PAGE_SIZE 0x40U //64 words
+
#elif defined __AVR_ATmega162__
#define SIG2 0x94
#define SIG3 0x04
@@ -367,7 +372,7 @@ int main(void)
UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
UCSRA = 0x00;
UCSRB = _BV(TXEN)|_BV(RXEN);
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
#ifdef DOUBLE_SPEED
UCSR0A = (1<<U2X0); //Double speed mode USART0
@@ -556,7 +561,7 @@ int main(void)
if (flags.eeprom) { //Write to EEPROM one byte at a time
address.word <<= 1;
for(w=0;w<length.word;w++) {
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while(EECR & (1<<EEPE));
EEAR = (uint16_t)(void *)address.word;
EEDR = buff[w];
@@ -578,7 +583,7 @@ int main(void)
/* if ((length.byte[0] & 0x01) == 0x01) length.word++; //Even up an odd number of bytes */
if ((length.byte[0] & 0x01)) length.word++; //Even up an odd number of bytes
cli(); //Disable interrupts, just to be sure
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__)
+#if defined(EEPE)
while(bit_is_set(EECR,EEPE)); //Wait for previous EEPROM writes to complete
#else
while(bit_is_set(EECR,EEWE)); //Wait for previous EEPROM writes to complete
@@ -677,7 +682,7 @@ int main(void)
"rjmp write_page \n\t"
"block_done: \n\t"
"clr __zero_reg__ \n\t" //restore zero register
-#if defined __AVR_ATmega168__ || __AVR_ATmega328P__ || __AVR_ATmega128__ || __AVR_ATmega1280__ || __AVR_ATmega1281__
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__)
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
#else
: "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
@@ -710,7 +715,7 @@ int main(void)
putch(0x14);
for (w=0;w < length.word;w++) { // Can handle odd and even lengths okay
if (flags.eeprom) { // Byte access EEPROM read
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while(EECR & (1<<EEPE));
EEAR = (uint16_t)(void *)address.word;
EECR |= (1<<EERE);
@@ -926,7 +931,7 @@ void putch(char ch)
while (!(UCSR1A & _BV(UDRE1)));
UDR1 = ch;
}
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
while (!(UCSR0A & _BV(UDRE0)));
UDR0 = ch;
#else
@@ -964,7 +969,7 @@ char getch(void)
return UDR1;
}
return 0;
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
uint32_t count = 0;
while(!(UCSR0A & _BV(RXC0))){
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
@@ -1001,7 +1006,7 @@ void getNch(uint8_t count)
while(!(UCSR1A & _BV(RXC1)));
UDR1;
}
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined (__AVR_ATmega328__)
getch();
#else
/* m8,16,32,169,8515,8535,163 */
diff --git a/bootloaders/atmega/Makefile b/bootloaders/atmega/Makefile
index 36a3b6b..efe92e6 100644..100755
--- a/bootloaders/atmega/Makefile
+++ b/bootloaders/atmega/Makefile
@@ -48,9 +48,9 @@ STK500-2 = $(STK500) -d$(MCU_TARGET) -ms -q -lCF -LCF -cUSB -I200kHz -s -wt
OBJ = $(PROGRAM).o
-OPTIMIZE = -O2
+OPTIMIZE = -Os
-DEFS =
+DEFS =
LIBS =
CC = avr-gcc
@@ -128,7 +128,7 @@ pro20_isp: isp
diecimila: TARGET = diecimila
diecimila: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1'
-diecimila: AVR_FREQ = 16000000L
+diecimila: AVR_FREQ = 16000000L
diecimila: $(PROGRAM)_diecimila.hex
diecimila_isp: diecimila
@@ -153,7 +153,7 @@ ng_isp: isp
atmega328: TARGET = atmega328
atmega328: MCU_TARGET = atmega328p
atmega328: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600
-atmega328: AVR_FREQ = 16000000L
+atmega328: AVR_FREQ = 16000000L
atmega328: LDSECTION = --section-start=.text=0x7800
atmega328: $(PROGRAM)_atmega328.hex
@@ -165,10 +165,25 @@ atmega328_isp: LFUSE = FF
atmega328_isp: EFUSE = 05
atmega328_isp: isp
+atmega328_notp: TARGET = atmega328_notp
+atmega328_notp: MCU_TARGET = atmega328
+atmega328_notp: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600
+atmega328_notp: AVR_FREQ = 16000000L
+atmega328_notp: LDSECTION = --section-start=.text=0x7800
+atmega328_notp: $(PROGRAM)_atmega328_notp.hex
+
+atmega328_notp_isp: atmega328_notp
+atmega328_notp_isp: TARGET = atmega328
+atmega328_notp_isp: MCU_TARGET = atmega328
+atmega328_notp_isp: HFUSE = DA
+atmega328_notp_isp: LFUSE = FF
+atmega328_notp_isp: EFUSE = 05
+atmega328_notp_isp: isp
+
atmega328_pro8: TARGET = atmega328_pro_8MHz
atmega328_pro8: MCU_TARGET = atmega328p
atmega328_pro8: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=1' -DBAUD_RATE=57600 -DDOUBLE_SPEED
-atmega328_pro8: AVR_FREQ = 8000000L
+atmega328_pro8: AVR_FREQ = 8000000L
atmega328_pro8: LDSECTION = --section-start=.text=0x7800
atmega328_pro8: $(PROGRAM)_atmega328_pro_8MHz.hex
@@ -183,7 +198,7 @@ atmega328_pro8_isp: isp
mega: TARGET = atmega1280
mega: MCU_TARGET = atmega1280
mega: CFLAGS += '-DMAX_TIME_COUNT=F_CPU>>4' '-DNUM_LED_FLASHES=0' -DBAUD_RATE=57600
-mega: AVR_FREQ = 16000000L
+mega: AVR_FREQ = 16000000L
mega: LDSECTION = --section-start=.text=0x1F000
mega: $(PROGRAM)_atmega1280.hex
diff --git a/bootloaders/bt/ATmegaBOOT_168.c b/bootloaders/bt/ATmegaBOOT_168.c
index c73eefa..d477e7a 100644
--- a/bootloaders/bt/ATmegaBOOT_168.c
+++ b/bootloaders/bt/ATmegaBOOT_168.c
@@ -79,7 +79,7 @@
/* the current avr-libc eeprom functions do not support the ATmega168 */
/* own eeprom write/read functions are used instead */
-#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__)
+#if !defined(__AVR_ATmega168__) || !defined(__AVR_ATmega328P__) || !defined(__AVR_ATmega328__)
#include <avr/eeprom.h>
#endif
@@ -194,6 +194,11 @@
#define SIG3 0x0F
#define PAGE_SIZE 0x40U //64 words
+#elif defined __AVR_ATmega328__
+#define SIG2 0x95
+#define SIG3 0x14
+#define PAGE_SIZE 0x40U //64 words
+
#elif defined __AVR_ATmega162__
#define SIG2 0x94
#define SIG3 0x04
@@ -335,7 +340,7 @@ int main(void)
UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8;
UCSRA = 0x00;
UCSRB = _BV(TXEN)|_BV(RXEN);
-#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
UBRR0H = ((F_CPU / 16 + BAUD_RATE / 2) / BAUD_RATE - 1) >> 8;
UBRR0L = ((F_CPU / 16 + BAUD_RATE / 2) / BAUD_RATE - 1);
@@ -557,7 +562,7 @@ putch(0x0D);
if (getch() == ' ') {
if (flags.eeprom) { //Write to EEPROM one byte at a time
for(w=0;w<length.word;w++) {
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while(EECR & (1<<EEPE));
EEAR = (uint16_t)(void *)address.word;
EEDR = buff[w];
@@ -675,7 +680,7 @@ putch(0x0D);
"rjmp write_page \n\t"
"block_done: \n\t"
"clr __zero_reg__ \n\t" //restore zero register
-#if defined __AVR_ATmega168__ || __AVR_ATmega328P__
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega_328__)
: "=m" (SPMCSR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
#else
: "=m" (SPMCR) : "M" (PAGE_SIZE) : "r0","r16","r17","r24","r25","r28","r29","r30","r31"
@@ -707,7 +712,7 @@ putch(0x0D);
putch(0x14);
for (w=0;w < length.word;w++) { // Can handle odd and even lengths okay
if (flags.eeprom) { // Byte access EEPROM read
-#if defined __AVR_ATmega168__ || __AVR_ATmega328P__
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while(EECR & (1<<EEPE));
EEAR = (uint16_t)(void *)address.word;
EECR |= (1<<EERE);
@@ -921,7 +926,7 @@ void putch(char ch)
while (!(UCSR1A & _BV(UDRE1)));
UDR1 = ch;
}
-#elif defined (__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined (__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while (!(UCSR0A & _BV(UDRE0)));
UDR0 = ch;
#else
@@ -944,7 +949,7 @@ char getch(void)
return UDR1;
}
return 0;
-#elif defined (__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif defined (__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
uint32_t count = 0;
while(!(UCSR0A & _BV(RXC0))){
/* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/
@@ -982,7 +987,7 @@ void getNch(uint8_t count)
while(!(UCSR1A & _BV(RXC1)));
UDR1;
}
-#elif (defined __AVR_ATmega168__) || defined(__AVR_ATmega328P__)
+#elif (defined __AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
while(!(UCSR0A & _BV(RXC0)));
UDR0;
#else
diff --git a/bootloaders/caterina/Caterina-Genuino-Micro.hex b/bootloaders/caterina/Caterina-Genuino-Micro.hex
new file mode 100644
index 0000000..b658b28
--- /dev/null
+++ b/bootloaders/caterina/Caterina-Genuino-Micro.hex
@@ -0,0 +1,257 @@
+:1070000055C000006EC000006CC000006AC00000E7
+:1070100068C0000066C0000064C0000062C00000DC
+:1070200060C000005EC00000F2C400005AC0000052
+:1070300058C0000056C0000054C0000052C00000FC
+:1070400050C0000078C000004CC000004AC00000E2
+:1070500048C0000046C0000044C0000042C000001C
+:1070600040C000003EC000003CC000003AC000002C
+:1070700038C0000036C0000034C0000032C000003C
+:1070800030C000002EC000002CC000002AC000004C
+:1070900028C0000026C0000024C0000022C000005C
+:1070A00020C000001EC000001CC0000011241FBE34
+:1070B000CFEFDAE0DEBFCDBF11E0A0E0B1E0E2E368
+:1070C000FFE702C005900D92A83AB107D9F711E089
+:1070D000A8EAB1E001C01D92AE3BB107E1F78FD342
+:1070E00026C78ECFF89410926F00109281001092F4
+:1070F00085001092840081E085BF15BE47985D9899
+:1071000028980C94000008952091B2013091B301A9
+:107110002F5F3F4F3093B3012093B201932F37FF7E
+:1071200003C08EEF831B982F990F921710F4479886
+:107130000895479A08951F920F920FB60F92112447
+:107140002F938F939F93EF93FF931092850010924C
+:1071500084008091A8019091A901009741F00197C6
+:107160009093A9018093A801892B09F45D988091DF
+:10717000AA019091AB01009741F001979093AB0168
+:107180008093AA01892B09F42898E0E0F0E085912A
+:1071900094918F5F9F4F49F08091AC019091AD0128
+:1071A00001969093AD018093AC01FF91EF919F9177
+:1071B0008F912F910F900FBE0F901F90189584E024
+:1071C0008093E9000DC08091E8008B778093E80000
+:1071D00003C08EB3882351F08091E80082FFF9CF7D
+:1071E0008091E80085FFEFCF8091F1000895982FFE
+:1071F00083E08093E9008091E80085FD0DC08091D7
+:10720000E8008E778093E80003C08EB3882369F08E
+:107210008091E80080FFF9CF9093F1005D9A84E6B9
+:1072200090E09093A9018093A80108954F925F92F6
+:107230006F927F928F929F92AF92BF92CF92DF9286
+:10724000EF92FF920F931F93CF93DF9384E080938D
+:10725000E9008091E80082FF57C2289A84E690E016
+:107260009093AB018093AA01AADF182F853481F493
+:107270008CE49DE19093AD018093AC0107B600FCD6
+:10728000FDCFF999FECF81E180935700E89503C0C7
+:10729000843519F494DF8DE00DC28C34E1F3803530
+:1072A000D1F3843721F484E4A2DF80E003C2813685
+:1072B00011F489E5FFC18134B1F481DF182F7FDF3C
+:1072C00090E0880F991FAA2797FDA095BA2F312F1C
+:1072D000330F20E0442737FD4095542F822B932B0A
+:1072E000A42BB52BB8C1803711F483E5E3C18335F6
+:1072F00049F4C0E0D1E089917ADF21E0C730D207BC
+:10730000D1F7D9C1863521F481E371DF80E3D2C1A1
+:10731000833731F487E86BDF85E969DF8EE1CAC125
+:107320008536B9F4E0E0F0E093E085E09093570013
+:10733000E89507B600FCFDCF80935700E89507B6A7
+:1073400000FCFDCFE058FF4FA0E7E030FA0771F7EF
+:10735000A2CF823739F4E1E0F0E089E08093570072
+:107360008491A8C1863439F4E0E0F0E089E08093AC
+:10737000570084919FC18E3439F4E3E0F0E089E056
+:1073800080935700849196C1813539F4E2E0F0E0B2
+:1073900089E08093570084918DC1823631F489E56C
+:1073A00026DF80E024DF80E885C1823419F087364B
+:1073B00009F0E5C01092AD011092AC0100DF082F7A
+:1073C000FEDEF82EFCDE682E8554823008F071C196
+:1073D000902F80E0CF2DD0E0C82BD92B10926F00DA
+:1073E000173609F04BC081E180935700E895DD2402
+:1073F000CC24C3943FC0E090AE01F090AF01009167
+:10740000B0011091B101B6E46B16D9F4ED2DF0E0A6
+:10741000EE29FF29E4918E2FEADEDD2081F082E063
+:1074200090E0A0E0B0E0E80EF91E0A1F1B1FE092FA
+:10743000AE01F092AF010093B0011093B101DC24D2
+:1074400018C0D801C701B695A7959795879559D5C6
+:10745000CEDE82E090E0A0E0B0E0E80EF91E0A1F68
+:107460001B1FE092AE01F092AF010093B0011093A8
+:10747000B1012197209709F0BECF7DC08090AE0169
+:107480009090AF01A090B001B090B10196E4691660
+:1074900009F05DC083E0F40180935700E89507B6DA
+:1074A00000FCFDCF54C0F6E46F1661F5772031F192
+:1074B000E090AE01F090AF010091B0011091B101E8
+:1074C0007EDED82ECC24852D90E08C299D29F701D5
+:1074D0000C0140925700E895112482E090E0A0E072
+:1074E000B0E0E80EF91E0A1F1B1FE092AE01F092F9
+:1074F000AF010093B0011093B10102C060DE582EBD
+:10750000742423C0E090AE01F090AF010091B0016F
+:107510001091B10116950795F794E79450DE682F06
+:10752000C701F7D48091AE019091AF01A091B00155
+:10753000B091B1010296A11DB11D8093AE0190934F
+:10754000AF01A093B001B093B101219704C05524BD
+:10755000772444244394209709F0A5CF96E4691634
+:1075600041F485E0F40180935700E89507B600FCEC
+:10757000FDCF8DE03CDE82E080936F009CC08334C1
+:1075800071F40091AE011091AF0119DE90E021E09D
+:10759000F8010C0120935700E89511247CCE833626
+:1075A00019F5E090AE01F090AF010091B00110919B
+:1075B000B10105DEF701E16090E021E00C012093CC
+:1075C0005700E895112482E090E0A0E0B0E0E80EDA
+:1075D000F91E0A1F1B1FE092AE01F092AF0100934B
+:1075E000B0011093B10157CE8D3661F4E091AE0138
+:1075F000F091AF0185E080935700E89507B600FC55
+:10760000FDCF49CE823551F4E091AE01F091AF014A
+:1076100005911491812FEBDD802F4CC0843421F52E
+:10762000E090AE01F090AF010091B0011091B10176
+:1076300016950795F794E794C2DD682FC70169D4C2
+:107640008091AE019091AF01A091B001B091B101D4
+:107650000296A11DB11D8093AE019093AF01A0933E
+:10766000B001B093B10117CE843609F5E090AE01B8
+:10767000F090AF010091B0011091B101D801C701A4
+:10768000B695A795979587953CD4B1DD82E090E0BB
+:10769000A0E0B0E0E80EF91E0A1F1B1FE092AE0149
+:1076A000F092AF010093B0011093B10104C08B318F
+:1076B00011F08FE39CDD83E08093E9009091E80076
+:1076C0008091E8008E778093E80095FF04C010C099
+:1076D0008EB38823C9F08091E80080FFF9CF8091B4
+:1076E000E8008E778093E80003C08EB3882361F0B2
+:1076F0008091E80080FFF9CF84E08093E9008091D9
+:10770000E8008B778093E800DF91CF911F910F9174
+:10771000FF90EF90DF90CF90BF90AF909F908F90B1
+:107720007F906F905F904F9008959091B601892F50
+:107730008F77813249F58091B7018032A1F0813293
+:1077400019F5913A09F58091E800877F8093E80068
+:107750008DE091E067E070E00BD28091E8008B77DC
+:107760008093E8000895913279F48091E800877F52
+:107770008093E8008DE091E067E070E05DD2809159
+:10778000E8008E778093E800089582E061EC42E0A3
+:10779000B5D083E061E842E1B1D084E060E842E145
+:1077A000ADC084B7877F84BF88E10FB6F89480931B
+:1077B0006000109260000FBE20E880E090E00FB6FD
+:1077C000F89420936100809361000FBE81E085BF33
+:1077D00092E095BF3F9A209A559AE1E6F0E0208327
+:1077E000108247985D982898109289008AEF8093BC
+:1077F000880090936F0083E080938100F0C04091F7
+:10780000000850910108109201081092000894B7E6
+:1078100014BE88E10FB6F894809360001092600067
+:107820000FBE292F30E0F901E270F07091FD18C011
+:1078300090FF05C0859194918F5F9F4F81F423FF46
+:107840000FC08091090190910A014817590741F032
+:10785000E0E0F0E0859194918F5F9F4F09F042DC6A
+:10786000A0DF78941092AD011092AC010CC0DEDC68
+:1078700036D38091AC019091AD0181549F4110F0BD
+:107880001092140141DC80911401882381F78091CA
+:10789000E00081608093E00025DC80E090E00895C6
+:1078A000FA01923049F0933061F09130F9F485E1BA
+:1078B00091E022E130E01EC087E291E02EE330E06B
+:1078C00019C0882329F485E691E024E030E012C055
+:1078D000813029F489E691E022E230E00BC0823069
+:1078E00029F48DE891E028E130E004C080E090E0E8
+:1078F00020E030E091838083C90108958093E900FE
+:107900008091EB0081608093EB001092ED0060931A
+:10791000EC004093ED008091EE00881F8827881FBF
+:1079200008958091B60188238CF403C08EB3882318
+:10793000B1F08091E80082FFF9CF8091E8008B7769
+:107940008093E80008958EB3882349F08091E80081
+:1079500080FFF9CF8091E8008E778093E80008954A
+:10796000EF92FF920F931F9345D04CD008ED10E09B
+:10797000F80180818F778083808180688083808117
+:107980008F7D808319BC1EBA1092B40180EEE82E60
+:10799000F12CF70180818B7F8083F80180818160E9
+:1079A000808380E060E042E0A9DFE1EEF0E08081EA
+:1079B0008E7F8083E2EEF0E0808181608083808131
+:1079C00088608083F70180818E7F8083F8018081C9
+:1079D000806180831F910F91FF90EF900895E7EDF4
+:1079E000F0E08081816080838AE482BF81E08093BF
+:1079F000B501B6CFE8EDF0E080818E7F80831092F4
+:107A0000E20008951092DA001092E10008951F92AA
+:107A10000F920FB60F9211242F933F934F935F93C2
+:107A20006F937F938F939F93AF93BF93EF93FF9346
+:107A30008091DA0080FF1BC08091D80080FF17C0C2
+:107A40008091DA008E7F8093DA008091D90080FFE8
+:107A50000BC080E189BD82E189BD09B400FEFDCF84
+:107A600081E08EBB3BD203C019BC1EBA37D28091D5
+:107A7000E10080FF17C08091E20080FF13C0809179
+:107A8000E2008E7F8093E2008091E200806180932B
+:107A9000E2008091D80080628093D80019BC85E014
+:107AA0008EBB1CD28091E10084FF2CC08091E2004B
+:107AB00084FF28C080E189BD82E189BD09B400FE50
+:107AC000FDCF8091D8008F7D8093D8008091E10018
+:107AD0008F7E8093E1008091E2008F7E8093E200B0
+:107AE0008091E20081608093E2008091B40188235C
+:107AF00031F48091E30087FD02C081E001C084E0A1
+:107B00008EBBECD18091E10083FF21C08091E20027
+:107B100083FF1DC08091E100877F8093E10082E0B8
+:107B20008EBB1092B4018091E1008E7F8093E100C2
+:107B30008091E2008E7F8093E2008091E20080617C
+:107B40008093E20080E060E042E0D8DEC7D1FF91A0
+:107B5000EF91BF91AF919F918F917F916F915F91C5
+:107B60004F913F912F910F900FBE0F901F9018953E
+:107B70009C014091BC015091BD014617570718F474
+:107B8000F90190E044C06115710511F0AB01F8CF27
+:107B90008091E8008E778093E80040E050E0F0CFDD
+:107BA0008EB3882309F444C0853009F443C0809122
+:107BB000E80083FF02C081E008958091E80082FD23
+:107BC00031C08091E80080FF22C08091F300909145
+:107BD000F200782F60E0292F30E0262B372B07C0EA
+:107BE00081918093F100415050402F5F3F4F4115EC
+:107BF000510519F02830310598F390E0283031050F
+:107C000009F491E08091E8008E778093E8004115B7
+:107C1000510531F6992321F605C08EB3882341F032
+:107C2000853041F08091E80082FFF7CF80E0089531
+:107C300082E0089583E008959C016115710529F49F
+:107C40008091E8008B778093E800F90126C08EB31D
+:107C5000882391F1853091F18091E80083FF02C083
+:107C600081E008958091E80082FFF1CF06C0809105
+:107C7000F10081936150704059F02091F3008091A0
+:107C8000F200322F20E090E0822B932B892B79F7A2
+:107C90008091E8008B778093E80061157105B9F653
+:107CA00005C08EB3882341F0853041F08091E80013
+:107CB00080FFF7CF80E0089582E0089583E0089583
+:107CC0000F931F93DF93CF9300D0CDB7DEB7E6EBD2
+:107CD000F1E08091F100819381E0EE3BF807C9F774
+:107CE00024DD8091E80083FFE4C08091B60190918B
+:107CF000B701953009F46DC0963040F4913081F1B0
+:107D0000913070F0933009F0D4C02AC0983009F453
+:107D1000A3C0993009F4B2C0963009F0CAC07CC043
+:107D2000803809F4C6C0823809F0C3C08091BA0116
+:107D300087708093E9008091EB001092E900209118
+:107D4000E800277F2093E80090E025E0969587954E
+:107D50002A95E1F781708093F1001092F10087C0BD
+:107D6000882319F0823009F0A4C08F71823009F0A5
+:107D7000A0C08091B801882331F52091BA01277005
+:107D800009F497C02093E9008091EB0080FF1BC0AD
+:107D9000933021F48091EB00806213C08091EB005E
+:107DA00080618093EB0081E090E002C0880F991F12
+:107DB0002A95E2F78093EA001092EA008091EB00A6
+:107DC00088608093EB001092E9008091E800877F43
+:107DD00051C0882309F06DC01091B8011F770FB70B
+:107DE000F8948091E800877F8093E8009ADD809185
+:107DF000E80080FFFCCF8091E3008078812B8093A6
+:107E0000E30080688093E300112311F482E001C055
+:107E100083E08EBB0FBF4DC08058823008F049C050
+:107E20008091B8019091B9016091BA01AE014F5FA4
+:107E30005F4F36DDBC01009709F43BC08091E8003C
+:107E4000877F8093E80089819A8192DE8091E800A3
+:107E50008B778093E8002DC0803859F58091E80039
+:107E6000877F8093E8008091B4018093F100809136
+:107E7000E8008E778093E80054DD1BC08823C9F4A6
+:107E80009091B8019230A8F48091E800877F8093A8
+:107E9000E8009093B40145DD8091B401882331F46A
+:107EA0008091E30087FD02C081E001C084E08EBBC9
+:107EB0006CDC8091E80083FF0AC08091EB00806257
+:107EC0008093EB008091E800877F8093E8000F901B
+:107ED0000F90CF91DF911F910F91089508951F93F7
+:107EE0008EB3882361F01091E9001092E90080912F
+:107EF000E80083FF01C0E4DE17701093E9001F91D2
+:107F00000895F999FECF92BD81BDF89A992780B561
+:107F10000895262FF999FECF1FBA92BD81BD20BDCD
+:107F20000FB6F894FA9AF99A0FBE01960895F8944C
+:027F3000FFCF81
+:107F32004341544552494E41007777000800000002
+:107F4200000000080112011001020000084123375D
+:107F52000201000201000109023E0002010080321A
+:107F6200090400000102020100052400100104249A
+:107F720002040524060001070582030800FF090424
+:107F82000100020A000000070504021000010705B3
+:107F92008302100001040309042203470065006EF6
+:107FA20000750069006E006F0020004D00690063DB
+:107FB2000072006F00200020002000000018034122
+:107FC2000072006400750069006E006F0020004CB2
+:087FD200004C00430000000018
+:040000030000700089
+:00000001FF
diff --git a/bootloaders/caterina/Caterina-Genuino-Micro.txt b/bootloaders/caterina/Caterina-Genuino-Micro.txt
new file mode 100644
index 0000000..fd29bd8
--- /dev/null
+++ b/bootloaders/caterina/Caterina-Genuino-Micro.txt
@@ -0,0 +1,19 @@
+GENUINO MICRO PRODUCTION FIRMWARES
+==================================
+
+Bootloader:
+-----------
+
+Name: Caterina-Genuino-Micro.hex
+
+Notes:
+Builds against LUFA version 111009
+make version 3.81
+avrdude version 5.11
+
+All AVR tools except avrdude were installed by CrossPack 20100115:
+avr-gcc version 4.3.3 (GCC)
+Thread model: single
+Configured with: ../configure —prefix=/usr/local/CrossPack-AVR-20100115 —disable-dependency-tracking —disable-nls —disable-werror —target=avr —enable-languages=c,c++ —disable-nls —disable-libssp —with-dwarf2
+avr-libc version 1.6.7
+binutils version 2.19
diff --git a/bootloaders/optiboot/optiboot.c b/bootloaders/optiboot/optiboot.c
index 41545b7..bd3a1db 100644
--- a/bootloaders/optiboot/optiboot.c
+++ b/bootloaders/optiboot/optiboot.c
@@ -231,7 +231,7 @@ void appStart() __attribute__ ((naked));
#if defined(__AVR_ATmega168__)
#define RAMSTART (0x100)
#define NRWWSTART (0x3800)
-#elif defined(__AVR_ATmega328P__)
+#elif defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
#define RAMSTART (0x100)
#define NRWWSTART (0x7000)
#elif defined (__AVR_ATmega644P__)
diff --git a/bootloaders/optiboot/pin_defs.h b/bootloaders/optiboot/pin_defs.h
index 27d7772..61ce64e 100644
--- a/bootloaders/optiboot/pin_defs.h
+++ b/bootloaders/optiboot/pin_defs.h
@@ -1,4 +1,4 @@
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove */
#define LED_DDR DDRB
#define LED_PORT PORTB
diff --git a/bootloaders/stk500v2/avrinterruptnames.h b/bootloaders/stk500v2/avrinterruptnames.h
index f862f9a..e7e3ed9 100644
--- a/bootloaders/stk500v2/avrinterruptnames.h
+++ b/bootloaders/stk500v2/avrinterruptnames.h
@@ -327,8 +327,8 @@
//**************************************************************************************************
-#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
-#pragma mark __AVR_ATmega168__ / __AVR_ATmega328P__
+#if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega328__)
+#pragma mark __AVR_ATmega168__ / __AVR_ATmega328P__ / __AVR_ATmega328__
#define _INTERRUPT_NAMES_DEFINED_
@@ -496,8 +496,8 @@ PGM_P gInterruptNameTable[] PROGMEM =
//**************************************************************************************************
-#if defined(__AVR_ATmega324P__ ) || defined(__AVR_ATmega644__ ) || defined(__AVR_ATmega644P__)
-#pragma mark __AVR_ATmega324P__ __AVR_ATmega644__ __AVR_ATmega644P__
+#if defined(__AVR_ATmega324P__ ) || defined(__AVR_ATmega644__ ) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__)
+#pragma mark __AVR_ATmega324P__ __AVR_ATmega644__ __AVR_ATmega644P__ __AVR_ATmega1284P__
#define _INTERRUPT_NAMES_DEFINED_
diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp
index 5d4f2a0..f19b44c 100644
--- a/cores/arduino/CDC.cpp
+++ b/cores/arduino/CDC.cpp
@@ -18,9 +18,9 @@
#include "USBAPI.h"
#include <avr/wdt.h>
+#include <util/atomic.h>
#if defined(USBCON)
-#ifdef CDC_ENABLED
typedef struct
{
@@ -32,6 +32,7 @@ typedef struct
} LineInfo;
static volatile LineInfo _usbLineInfo = { 57600, 0x00, 0x00, 0x00, 0x00 };
+static volatile int32_t breakValue = -1;
#define WEAK __attribute__ ((weak))
@@ -50,17 +51,17 @@ const CDCDescriptor _cdcInterface =
// CDC data interface
D_INTERFACE(CDC_DATA_INTERFACE,2,CDC_DATA_INTERFACE_CLASS,0,0),
- D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,0x40,0),
- D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,0x40,0)
+ D_ENDPOINT(USB_ENDPOINT_OUT(CDC_ENDPOINT_OUT),USB_ENDPOINT_TYPE_BULK,USB_EP_SIZE,0),
+ D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_IN ),USB_ENDPOINT_TYPE_BULK,USB_EP_SIZE,0)
};
-int WEAK CDC_GetInterface(u8* interfaceNum)
+int CDC_GetInterface(u8* interfaceNum)
{
interfaceNum[0] += 2; // uses 2
return USB_SendControl(TRANSFER_PGM,&_cdcInterface,sizeof(_cdcInterface));
}
-bool WEAK CDC_Setup(Setup& setup)
+bool CDC_Setup(USBSetup& setup)
{
u8 r = setup.bRequest;
u8 requestType = setup.bmRequestType;
@@ -76,6 +77,11 @@ bool WEAK CDC_Setup(Setup& setup)
if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType)
{
+ if (CDC_SEND_BREAK == r)
+ {
+ breakValue = ((uint16_t)setup.wValueH << 8) | setup.wValueL;
+ }
+
if (CDC_SET_LINE_CODING == r)
{
USB_RecvControl((void*)&_usbLineInfo,7);
@@ -93,10 +99,24 @@ bool WEAK CDC_Setup(Setup& setup)
// with a relatively long period so it can finish housekeeping tasks
// like servicing endpoints before the sketch ends
+#ifndef MAGIC_KEY
+#define MAGIC_KEY 0x7777
+#endif
+#ifndef MAGIC_KEY_POS
+#define MAGIC_KEY_POS 0x0800
+#endif
+
// We check DTR state to determine if host port is open (bit 0 of lineState).
if (1200 == _usbLineInfo.dwDTERate && (_usbLineInfo.lineState & 0x01) == 0)
{
- *(uint16_t *)0x0800 = 0x7777;
+#if MAGIC_KEY_POS != (RAMEND-1)
+ *(uint16_t *)(RAMEND-1) = *(uint16_t *)MAGIC_KEY_POS;
+ *(uint16_t *)MAGIC_KEY_POS = MAGIC_KEY;
+#else
+ // for future boards save the key in the inproblematic RAMEND
+ // which is reserved for the main() return value (which will never return)
+ *(uint16_t *)MAGIC_KEY_POS = MAGIC_KEY;
+#endif
wdt_enable(WDTO_120MS);
}
else
@@ -108,7 +128,11 @@ bool WEAK CDC_Setup(Setup& setup)
wdt_disable();
wdt_reset();
- *(uint16_t *)0x0800 = 0x0;
+#if MAGIC_KEY_POS != (RAMEND-1)
+ *(uint16_t *)MAGIC_KEY_POS = *(uint16_t *)(RAMEND-1);
+#else
+ *(uint16_t *)MAGIC_KEY_POS = 0x0000;
+#endif
}
}
return true;
@@ -156,6 +180,11 @@ int Serial_::read(void)
return USB_Recv(CDC_RX);
}
+int Serial_::availableForWrite(void)
+{
+ return USB_SendSpace(CDC_TX);
+}
+
void Serial_::flush(void)
{
USB_Flush(CDC_TX);
@@ -205,7 +234,46 @@ Serial_::operator bool() {
return result;
}
+unsigned long Serial_::baud() {
+ // Disable interrupts while reading a multi-byte value
+ uint32_t baudrate;
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
+ baudrate = _usbLineInfo.dwDTERate;
+ }
+ return baudrate;
+}
+
+uint8_t Serial_::stopbits() {
+ return _usbLineInfo.bCharFormat;
+}
+
+uint8_t Serial_::paritytype() {
+ return _usbLineInfo.bParityType;
+}
+
+uint8_t Serial_::numbits() {
+ return _usbLineInfo.bDataBits;
+}
+
+bool Serial_::dtr() {
+ return _usbLineInfo.lineState & 0x1;
+}
+
+bool Serial_::rts() {
+ return _usbLineInfo.lineState & 0x2;
+}
+
+int32_t Serial_::readBreak() {
+ int32_t ret;
+ // Disable IRQs while reading and clearing breakValue to make
+ // sure we don't overwrite a value just set by the ISR.
+ ATOMIC_BLOCK(ATOMIC_RESTORESTATE) {
+ ret = breakValue;
+ breakValue = -1;
+ }
+ return ret;
+}
+
Serial_ Serial;
-#endif
#endif /* if defined(USBCON) */
diff --git a/cores/arduino/HID.cpp b/cores/arduino/HID.cpp
deleted file mode 100644
index 75c37b2..0000000
--- a/cores/arduino/HID.cpp
+++ /dev/null
@@ -1,518 +0,0 @@
-
-
-/* Copyright (c) 2011, Peter Barrett
-**
-** Permission to use, copy, modify, and/or distribute this software for
-** any purpose with or without fee is hereby granted, provided that the
-** above copyright notice and this permission notice appear in all copies.
-**
-** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
-** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-** SOFTWARE.
-*/
-
-#include "USBAPI.h"
-
-#if defined(USBCON)
-#ifdef HID_ENABLED
-
-//#define RAWHID_ENABLED
-
-// Singletons for mouse and keyboard
-
-Mouse_ Mouse;
-Keyboard_ Keyboard;
-
-//================================================================================
-//================================================================================
-
-// HID report descriptor
-
-#define LSB(_x) ((_x) & 0xFF)
-#define MSB(_x) ((_x) >> 8)
-
-#define RAWHID_USAGE_PAGE 0xFFC0
-#define RAWHID_USAGE 0x0C00
-#define RAWHID_TX_SIZE 64
-#define RAWHID_RX_SIZE 64
-
-extern const u8 _hidReportDescriptor[] PROGMEM;
-const u8 _hidReportDescriptor[] = {
-
- // Mouse
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 54
- 0x09, 0x02, // USAGE (Mouse)
- 0xa1, 0x01, // COLLECTION (Application)
- 0x09, 0x01, // USAGE (Pointer)
- 0xa1, 0x00, // COLLECTION (Physical)
- 0x85, 0x01, // REPORT_ID (1)
- 0x05, 0x09, // USAGE_PAGE (Button)
- 0x19, 0x01, // USAGE_MINIMUM (Button 1)
- 0x29, 0x03, // USAGE_MAXIMUM (Button 3)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x75, 0x01, // REPORT_SIZE (1)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x05, // REPORT_SIZE (5)
- 0x81, 0x03, // INPUT (Cnst,Var,Abs)
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop)
- 0x09, 0x30, // USAGE (X)
- 0x09, 0x31, // USAGE (Y)
- 0x09, 0x38, // USAGE (Wheel)
- 0x15, 0x81, // LOGICAL_MINIMUM (-127)
- 0x25, 0x7f, // LOGICAL_MAXIMUM (127)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x95, 0x03, // REPORT_COUNT (3)
- 0x81, 0x06, // INPUT (Data,Var,Rel)
- 0xc0, // END_COLLECTION
- 0xc0, // END_COLLECTION
-
- // Keyboard
- 0x05, 0x01, // USAGE_PAGE (Generic Desktop) // 47
- 0x09, 0x06, // USAGE (Keyboard)
- 0xa1, 0x01, // COLLECTION (Application)
- 0x85, 0x02, // REPORT_ID (2)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
-
- 0x19, 0xe0, // USAGE_MINIMUM (Keyboard LeftControl)
- 0x29, 0xe7, // USAGE_MAXIMUM (Keyboard Right GUI)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x01, // LOGICAL_MAXIMUM (1)
- 0x75, 0x01, // REPORT_SIZE (1)
-
- 0x95, 0x08, // REPORT_COUNT (8)
- 0x81, 0x02, // INPUT (Data,Var,Abs)
- 0x95, 0x01, // REPORT_COUNT (1)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x81, 0x03, // INPUT (Cnst,Var,Abs)
-
- 0x95, 0x06, // REPORT_COUNT (6)
- 0x75, 0x08, // REPORT_SIZE (8)
- 0x15, 0x00, // LOGICAL_MINIMUM (0)
- 0x25, 0x65, // LOGICAL_MAXIMUM (101)
- 0x05, 0x07, // USAGE_PAGE (Keyboard)
-
- 0x19, 0x00, // USAGE_MINIMUM (Reserved (no event indicated))
- 0x29, 0x65, // USAGE_MAXIMUM (Keyboard Application)
- 0x81, 0x00, // INPUT (Data,Ary,Abs)
- 0xc0, // END_COLLECTION
-
-#ifdef RAWHID_ENABLED
- // RAW HID
- 0x06, LSB(RAWHID_USAGE_PAGE), MSB(RAWHID_USAGE_PAGE), // 30
- 0x0A, LSB(RAWHID_USAGE), MSB(RAWHID_USAGE),
-
- 0xA1, 0x01, // Collection 0x01
- 0x85, 0x03, // REPORT_ID (3)
- 0x75, 0x08, // report size = 8 bits
- 0x15, 0x00, // logical minimum = 0
- 0x26, 0xFF, 0x00, // logical maximum = 255
-
- 0x95, 64, // report count TX
- 0x09, 0x01, // usage
- 0x81, 0x02, // Input (array)
-
- 0x95, 64, // report count RX
- 0x09, 0x02, // usage
- 0x91, 0x02, // Output (array)
- 0xC0 // end collection
-#endif
-};
-
-extern const HIDDescriptor _hidInterface PROGMEM;
-const HIDDescriptor _hidInterface =
-{
- D_INTERFACE(HID_INTERFACE,1,3,0,0),
- D_HIDREPORT(sizeof(_hidReportDescriptor)),
- D_ENDPOINT(USB_ENDPOINT_IN (HID_ENDPOINT_INT),USB_ENDPOINT_TYPE_INTERRUPT,0x40,0x01)
-};
-
-//================================================================================
-//================================================================================
-// Driver
-
-u8 _hid_protocol = 1;
-u8 _hid_idle = 1;
-
-#define WEAK __attribute__ ((weak))
-
-int WEAK HID_GetInterface(u8* interfaceNum)
-{
- interfaceNum[0] += 1; // uses 1
- return USB_SendControl(TRANSFER_PGM,&_hidInterface,sizeof(_hidInterface));
-}
-
-int WEAK HID_GetDescriptor(int /* i */)
-{
- return USB_SendControl(TRANSFER_PGM,_hidReportDescriptor,sizeof(_hidReportDescriptor));
-}
-
-void WEAK HID_SendReport(u8 id, const void* data, int len)
-{
- USB_Send(HID_TX, &id, 1);
- USB_Send(HID_TX | TRANSFER_RELEASE,data,len);
-}
-
-bool WEAK HID_Setup(Setup& setup)
-{
- u8 r = setup.bRequest;
- u8 requestType = setup.bmRequestType;
- if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType)
- {
- if (HID_GET_REPORT == r)
- {
- //HID_GetReport();
- return true;
- }
- if (HID_GET_PROTOCOL == r)
- {
- //Send8(_hid_protocol); // TODO
- return true;
- }
- }
-
- if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType)
- {
- if (HID_SET_PROTOCOL == r)
- {
- _hid_protocol = setup.wValueL;
- return true;
- }
-
- if (HID_SET_IDLE == r)
- {
- _hid_idle = setup.wValueL;
- return true;
- }
- }
- return false;
-}
-
-//================================================================================
-//================================================================================
-// Mouse
-
-Mouse_::Mouse_(void) : _buttons(0)
-{
-}
-
-void Mouse_::begin(void)
-{
-}
-
-void Mouse_::end(void)
-{
-}
-
-void Mouse_::click(uint8_t b)
-{
- _buttons = b;
- move(0,0,0);
- _buttons = 0;
- move(0,0,0);
-}
-
-void Mouse_::move(signed char x, signed char y, signed char wheel)
-{
- u8 m[4];
- m[0] = _buttons;
- m[1] = x;
- m[2] = y;
- m[3] = wheel;
- HID_SendReport(1,m,4);
-}
-
-void Mouse_::buttons(uint8_t b)
-{
- if (b != _buttons)
- {
- _buttons = b;
- move(0,0,0);
- }
-}
-
-void Mouse_::press(uint8_t b)
-{
- buttons(_buttons | b);
-}
-
-void Mouse_::release(uint8_t b)
-{
- buttons(_buttons & ~b);
-}
-
-bool Mouse_::isPressed(uint8_t b)
-{
- if ((b & _buttons) > 0)
- return true;
- return false;
-}
-
-//================================================================================
-//================================================================================
-// Keyboard
-
-Keyboard_::Keyboard_(void)
-{
-}
-
-void Keyboard_::begin(void)
-{
-}
-
-void Keyboard_::end(void)
-{
-}
-
-void Keyboard_::sendReport(KeyReport* keys)
-{
- HID_SendReport(2,keys,sizeof(KeyReport));
-}
-
-extern
-const uint8_t _asciimap[128] PROGMEM;
-
-#define SHIFT 0x80
-const uint8_t _asciimap[128] =
-{
- 0x00, // NUL
- 0x00, // SOH
- 0x00, // STX
- 0x00, // ETX
- 0x00, // EOT
- 0x00, // ENQ
- 0x00, // ACK
- 0x00, // BEL
- 0x2a, // BS Backspace
- 0x2b, // TAB Tab
- 0x28, // LF Enter
- 0x00, // VT
- 0x00, // FF
- 0x00, // CR
- 0x00, // SO
- 0x00, // SI
- 0x00, // DEL
- 0x00, // DC1
- 0x00, // DC2
- 0x00, // DC3
- 0x00, // DC4
- 0x00, // NAK
- 0x00, // SYN
- 0x00, // ETB
- 0x00, // CAN
- 0x00, // EM
- 0x00, // SUB
- 0x00, // ESC
- 0x00, // FS
- 0x00, // GS
- 0x00, // RS
- 0x00, // US
-
- 0x2c, // ' '
- 0x1e|SHIFT, // !
- 0x34|SHIFT, // "
- 0x20|SHIFT, // #
- 0x21|SHIFT, // $
- 0x22|SHIFT, // %
- 0x24|SHIFT, // &
- 0x34, // '
- 0x26|SHIFT, // (
- 0x27|SHIFT, // )
- 0x25|SHIFT, // *
- 0x2e|SHIFT, // +
- 0x36, // ,
- 0x2d, // -
- 0x37, // .
- 0x38, // /
- 0x27, // 0
- 0x1e, // 1
- 0x1f, // 2
- 0x20, // 3
- 0x21, // 4
- 0x22, // 5
- 0x23, // 6
- 0x24, // 7
- 0x25, // 8
- 0x26, // 9
- 0x33|SHIFT, // :
- 0x33, // ;
- 0x36|SHIFT, // <
- 0x2e, // =
- 0x37|SHIFT, // >
- 0x38|SHIFT, // ?
- 0x1f|SHIFT, // @
- 0x04|SHIFT, // A
- 0x05|SHIFT, // B
- 0x06|SHIFT, // C
- 0x07|SHIFT, // D
- 0x08|SHIFT, // E
- 0x09|SHIFT, // F
- 0x0a|SHIFT, // G
- 0x0b|SHIFT, // H
- 0x0c|SHIFT, // I
- 0x0d|SHIFT, // J
- 0x0e|SHIFT, // K
- 0x0f|SHIFT, // L
- 0x10|SHIFT, // M
- 0x11|SHIFT, // N
- 0x12|SHIFT, // O
- 0x13|SHIFT, // P
- 0x14|SHIFT, // Q
- 0x15|SHIFT, // R
- 0x16|SHIFT, // S
- 0x17|SHIFT, // T
- 0x18|SHIFT, // U
- 0x19|SHIFT, // V
- 0x1a|SHIFT, // W
- 0x1b|SHIFT, // X
- 0x1c|SHIFT, // Y
- 0x1d|SHIFT, // Z
- 0x2f, // [
- 0x31, // bslash
- 0x30, // ]
- 0x23|SHIFT, // ^
- 0x2d|SHIFT, // _
- 0x35, // `
- 0x04, // a
- 0x05, // b
- 0x06, // c
- 0x07, // d
- 0x08, // e
- 0x09, // f
- 0x0a, // g
- 0x0b, // h
- 0x0c, // i
- 0x0d, // j
- 0x0e, // k
- 0x0f, // l
- 0x10, // m
- 0x11, // n
- 0x12, // o
- 0x13, // p
- 0x14, // q
- 0x15, // r
- 0x16, // s
- 0x17, // t
- 0x18, // u
- 0x19, // v
- 0x1a, // w
- 0x1b, // x
- 0x1c, // y
- 0x1d, // z
- 0x2f|SHIFT, //
- 0x31|SHIFT, // |
- 0x30|SHIFT, // }
- 0x35|SHIFT, // ~
- 0 // DEL
-};
-
-uint8_t USBPutChar(uint8_t c);
-
-// press() adds the specified key (printing, non-printing, or modifier)
-// to the persistent key report and sends the report. Because of the way
-// USB HID works, the host acts like the key remains pressed until we
-// call release(), releaseAll(), or otherwise clear the report and resend.
-size_t Keyboard_::press(uint8_t k)
-{
- uint8_t i;
- if (k >= 136) { // it's a non-printing key (not a modifier)
- k = k - 136;
- } else if (k >= 128) { // it's a modifier key
- _keyReport.modifiers |= (1<<(k-128));
- k = 0;
- } else { // it's a printing key
- k = pgm_read_byte(_asciimap + k);
- if (!k) {
- setWriteError();
- return 0;
- }
- if (k & 0x80) { // it's a capital letter or other character reached with shift
- _keyReport.modifiers |= 0x02; // the left shift modifier
- k &= 0x7F;
- }
- }
-
- // Add k to the key report only if it's not already present
- // and if there is an empty slot.
- if (_keyReport.keys[0] != k && _keyReport.keys[1] != k &&
- _keyReport.keys[2] != k && _keyReport.keys[3] != k &&
- _keyReport.keys[4] != k && _keyReport.keys[5] != k) {
-
- for (i=0; i<6; i++) {
- if (_keyReport.keys[i] == 0x00) {
- _keyReport.keys[i] = k;
- break;
- }
- }
- if (i == 6) {
- setWriteError();
- return 0;
- }
- }
- sendReport(&_keyReport);
- return 1;
-}
-
-// release() takes the specified key out of the persistent key report and
-// sends the report. This tells the OS the key is no longer pressed and that
-// it shouldn't be repeated any more.
-size_t Keyboard_::release(uint8_t k)
-{
- uint8_t i;
- if (k >= 136) { // it's a non-printing key (not a modifier)
- k = k - 136;
- } else if (k >= 128) { // it's a modifier key
- _keyReport.modifiers &= ~(1<<(k-128));
- k = 0;
- } else { // it's a printing key
- k = pgm_read_byte(_asciimap + k);
- if (!k) {
- return 0;
- }
- if (k & 0x80) { // it's a capital letter or other character reached with shift
- _keyReport.modifiers &= ~(0x02); // the left shift modifier
- k &= 0x7F;
- }
- }
-
- // Test the key report to see if k is present. Clear it if it exists.
- // Check all positions in case the key is present more than once (which it shouldn't be)
- for (i=0; i<6; i++) {
- if (0 != k && _keyReport.keys[i] == k) {
- _keyReport.keys[i] = 0x00;
- }
- }
-
- sendReport(&_keyReport);
- return 1;
-}
-
-void Keyboard_::releaseAll(void)
-{
- _keyReport.keys[0] = 0;
- _keyReport.keys[1] = 0;
- _keyReport.keys[2] = 0;
- _keyReport.keys[3] = 0;
- _keyReport.keys[4] = 0;
- _keyReport.keys[5] = 0;
- _keyReport.modifiers = 0;
- sendReport(&_keyReport);
-}
-
-size_t Keyboard_::write(uint8_t c)
-{
- uint8_t p = press(c); // Keydown
- release(c); // Keyup
- return p; // just return the result of press() since release() almost always returns 1
-}
-
-#endif
-
-#endif /* if defined(USBCON) */
diff --git a/cores/arduino/HardwareSerial.cpp b/cores/arduino/HardwareSerial.cpp
index a2029a8..5cd89e5 100644
--- a/cores/arduino/HardwareSerial.cpp
+++ b/cores/arduino/HardwareSerial.cpp
@@ -138,8 +138,7 @@ void HardwareSerial::begin(unsigned long baud, byte config)
void HardwareSerial::end()
{
// wait for transmission of outgoing data
- while (_tx_buffer_head != _tx_buffer_tail)
- ;
+ flush();
cbi(*_ucsrb, RXEN0);
cbi(*_ucsrb, TXEN0);
diff --git a/cores/arduino/HardwareSerial.h b/cores/arduino/HardwareSerial.h
index 1beafc5..8a5bf95 100644
--- a/cores/arduino/HardwareSerial.h
+++ b/cores/arduino/HardwareSerial.h
@@ -40,14 +40,14 @@
// often work, but occasionally a race condition can occur that makes
// Serial behave erratically. See https://github.com/arduino/Arduino/issues/2405
#if !defined(SERIAL_TX_BUFFER_SIZE)
-#if (RAMEND < 1000)
+#if ((RAMEND - RAMSTART) < 1023)
#define SERIAL_TX_BUFFER_SIZE 16
#else
#define SERIAL_TX_BUFFER_SIZE 64
#endif
#endif
#if !defined(SERIAL_RX_BUFFER_SIZE)
-#if (RAMEND < 1000)
+#if ((RAMEND - RAMSTART) < 1023)
#define SERIAL_RX_BUFFER_SIZE 16
#else
#define SERIAL_RX_BUFFER_SIZE 64
diff --git a/cores/arduino/IPAddress.cpp b/cores/arduino/IPAddress.cpp
index 899cbd4..76aefa8 100644
--- a/cores/arduino/IPAddress.cpp
+++ b/cores/arduino/IPAddress.cpp
@@ -43,6 +43,48 @@ IPAddress::IPAddress(const uint8_t *address)
memcpy(_address.bytes, address, sizeof(_address.bytes));
}
+bool IPAddress::fromString(const char *address)
+{
+ // TODO: add support for "a", "a.b", "a.b.c" formats
+
+ uint16_t acc = 0; // Accumulator
+ uint8_t dots = 0;
+
+ while (*address)
+ {
+ char c = *address++;
+ if (c >= '0' && c <= '9')
+ {
+ acc = acc * 10 + (c - '0');
+ if (acc > 255) {
+ // Value out of [0..255] range
+ return false;
+ }
+ }
+ else if (c == '.')
+ {
+ if (dots == 3) {
+ // Too much dots (there must be 3 dots)
+ return false;
+ }
+ _address.bytes[dots++] = acc;
+ acc = 0;
+ }
+ else
+ {
+ // Invalid char
+ return false;
+ }
+ }
+
+ if (dots != 3) {
+ // Too few dots (there must be 3 dots)
+ return false;
+ }
+ _address.bytes[3] = acc;
+ return true;
+}
+
IPAddress& IPAddress::operator=(const uint8_t *address)
{
memcpy(_address.bytes, address, sizeof(_address.bytes));
diff --git a/cores/arduino/IPAddress.h b/cores/arduino/IPAddress.h
index 94acdc4..d762f2c 100644
--- a/cores/arduino/IPAddress.h
+++ b/cores/arduino/IPAddress.h
@@ -21,7 +21,8 @@
#define IPAddress_h
#include <stdint.h>
-#include <Printable.h>
+#include "Printable.h"
+#include "WString.h"
// A class to make it easier to handle and pass around IP addresses
@@ -45,6 +46,9 @@ public:
IPAddress(uint32_t address);
IPAddress(const uint8_t *address);
+ bool fromString(const char *address);
+ bool fromString(const String &address) { return fromString(address.c_str()); }
+
// Overloaded cast operator to allow IPAddress objects to be used where a pointer
// to a four-byte uint8_t array is expected
operator uint32_t() const { return _address.dword; };
@@ -71,5 +75,4 @@ public:
const IPAddress INADDR_NONE(0,0,0,0);
-
#endif
diff --git a/cores/arduino/PluggableUSB.cpp b/cores/arduino/PluggableUSB.cpp
new file mode 100644
index 0000000..c489d9f
--- /dev/null
+++ b/cores/arduino/PluggableUSB.cpp
@@ -0,0 +1,115 @@
+/*
+ PluggableUSB.cpp
+ Copyright (c) 2015 Arduino LLC
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#include "USBAPI.h"
+#include "PluggableUSB.h"
+
+#if defined(USBCON)
+#ifdef PLUGGABLE_USB_ENABLED
+
+extern uint8_t _initEndpoints[];
+
+int PluggableUSB_::getInterface(uint8_t* interfaceCount)
+{
+ int sent = 0;
+ PluggableUSBModule* node;
+ for (node = rootNode; node; node = node->next) {
+ int res = node->getInterface(interfaceCount);
+ if (res < 0)
+ return -1;
+ sent += res;
+ }
+ return sent;
+}
+
+int PluggableUSB_::getDescriptor(USBSetup& setup)
+{
+ PluggableUSBModule* node;
+ for (node = rootNode; node; node = node->next) {
+ int ret = node->getDescriptor(setup);
+ // ret!=0 -> request has been processed
+ if (ret)
+ return ret;
+ }
+ return 0;
+}
+
+void PluggableUSB_::getShortName(char *iSerialNum)
+{
+ PluggableUSBModule* node;
+ for (node = rootNode; node; node = node->next) {
+ iSerialNum += node->getShortName(iSerialNum);
+ }
+ *iSerialNum = 0;
+}
+
+bool PluggableUSB_::setup(USBSetup& setup)
+{
+ PluggableUSBModule* node;
+ for (node = rootNode; node; node = node->next) {
+ if (node->setup(setup)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool PluggableUSB_::plug(PluggableUSBModule *node)
+{
+ if ((lastEp + node->numEndpoints) > USB_ENDPOINTS) {
+ return false;
+ }
+
+ if (!rootNode) {
+ rootNode = node;
+ } else {
+ PluggableUSBModule *current = rootNode;
+ while (current->next) {
+ current = current->next;
+ }
+ current->next = node;
+ }
+
+ node->pluggedInterface = lastIf;
+ node->pluggedEndpoint = lastEp;
+ lastIf += node->numInterfaces;
+ for (uint8_t i = 0; i < node->numEndpoints; i++) {
+ _initEndpoints[lastEp] = node->endpointType[i];
+ lastEp++;
+ }
+ return true;
+ // restart USB layer???
+}
+
+PluggableUSB_& PluggableUSB()
+{
+ static PluggableUSB_ obj;
+ return obj;
+}
+
+PluggableUSB_::PluggableUSB_() : lastIf(CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT),
+ lastEp(CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT),
+ rootNode(NULL)
+{
+ // Empty
+}
+
+#endif
+
+#endif /* if defined(USBCON) */
diff --git a/cores/arduino/PluggableUSB.h b/cores/arduino/PluggableUSB.h
new file mode 100644
index 0000000..507f0df
--- /dev/null
+++ b/cores/arduino/PluggableUSB.h
@@ -0,0 +1,74 @@
+/*
+ PluggableUSB.h
+ Copyright (c) 2015 Arduino LLC
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+*/
+
+#ifndef PUSB_h
+#define PUSB_h
+
+#include "USBAPI.h"
+#include <stdint.h>
+
+#if defined(USBCON)
+
+class PluggableUSBModule {
+public:
+ PluggableUSBModule(uint8_t numEps, uint8_t numIfs, uint8_t *epType) :
+ numEndpoints(numEps), numInterfaces(numIfs), endpointType(epType)
+ { }
+
+protected:
+ virtual bool setup(USBSetup& setup) = 0;
+ virtual int getInterface(uint8_t* interfaceCount) = 0;
+ virtual int getDescriptor(USBSetup& setup) = 0;
+ virtual uint8_t getShortName(char *name) { name[0] = 'A'+pluggedInterface; return 1; }
+
+ uint8_t pluggedInterface;
+ uint8_t pluggedEndpoint;
+
+ const uint8_t numEndpoints;
+ const uint8_t numInterfaces;
+ const uint8_t *endpointType;
+
+ PluggableUSBModule *next = NULL;
+
+ friend class PluggableUSB_;
+};
+
+class PluggableUSB_ {
+public:
+ PluggableUSB_();
+ bool plug(PluggableUSBModule *node);
+ int getInterface(uint8_t* interfaceCount);
+ int getDescriptor(USBSetup& setup);
+ bool setup(USBSetup& setup);
+ void getShortName(char *iSerialNum);
+
+private:
+ uint8_t lastIf;
+ uint8_t lastEp;
+ PluggableUSBModule* rootNode;
+};
+
+// Replacement for global singleton.
+// This function prevents static-initialization-order-fiasco
+// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
+PluggableUSB_& PluggableUSB();
+
+#endif
+
+#endif
diff --git a/cores/arduino/Print.cpp b/cores/arduino/Print.cpp
index 782d50b..bc97c85 100644
--- a/cores/arduino/Print.cpp
+++ b/cores/arduino/Print.cpp
@@ -17,6 +17,7 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Modified 23 November 2006 by David A. Mellis
+ Modified 03 August 2015 by Chuck Todd
*/
#include <stdlib.h>
@@ -34,7 +35,8 @@ size_t Print::write(const uint8_t *buffer, size_t size)
{
size_t n = 0;
while (size--) {
- n += write(*buffer++);
+ if (write(*buffer++)) n++;
+ else break;
}
return n;
}
@@ -46,7 +48,8 @@ size_t Print::print(const __FlashStringHelper *ifsh)
while (1) {
unsigned char c = pgm_read_byte(p++);
if (c == 0) break;
- n += write(c);
+ if (write(c)) n++;
+ else break;
}
return n;
}
diff --git a/cores/arduino/Stream.cpp b/cores/arduino/Stream.cpp
index b31942f..f665465 100644
--- a/cores/arduino/Stream.cpp
+++ b/cores/arduino/Stream.cpp
@@ -26,7 +26,6 @@
#include "Stream.h"
#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait
-#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field
// private method to read stream with timeout
int Stream::timedRead()
@@ -54,14 +53,30 @@ int Stream::timedPeek()
// returns peek of the next digit in the stream or -1 if timeout
// discards non-numeric characters
-int Stream::peekNextDigit()
+int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal)
{
int c;
while (1) {
c = timedPeek();
- if (c < 0) return c; // timeout
- if (c == '-') return c;
- if (c >= '0' && c <= '9') return c;
+
+ if( c < 0 ||
+ c == '-' ||
+ (c >= '0' && c <= '9') ||
+ (detectDecimal && c == '.')) return c;
+
+ switch( lookahead ){
+ case SKIP_NONE: return -1; // Fail code.
+ case SKIP_WHITESPACE:
+ switch( c ){
+ case ' ':
+ case '\t':
+ case '\r':
+ case '\n': break;
+ default: return -1; // Fail code.
+ }
+ case SKIP_ALL:
+ break;
+ }
read(); // discard non-numeric
}
}
@@ -107,31 +122,25 @@ bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t
}
}
-
// returns the first valid (long) integer value from the current position.
-// initial characters that are not digits (or the minus sign) are skipped
-// function is terminated by the first character that is not a digit.
-long Stream::parseInt()
-{
- return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout)
-}
-
-// as above but a given skipChar is ignored
-// this allows format characters (typically commas) in values to be ignored
-long Stream::parseInt(char skipChar)
+// lookahead determines how parseInt looks ahead in the stream.
+// See LookaheadMode enumeration at the top of the file.
+// Lookahead is terminated by the first character that is not a valid part of an integer.
+// Once parsing commences, 'ignore' will be skipped in the stream.
+long Stream::parseInt(LookaheadMode lookahead, char ignore)
{
bool isNegative = false;
long value = 0;
int c;
- c = peekNextDigit();
+ c = peekNextDigit(lookahead, false);
// ignore non numeric leading characters
if(c < 0)
return 0; // zero returned if timeout
do{
- if(c == skipChar)
- ; // ignore this charactor
+ if(c == ignore)
+ ; // ignore this character
else if(c == '-')
isNegative = true;
else if(c >= '0' && c <= '9') // is c a digit?
@@ -139,36 +148,29 @@ long Stream::parseInt(char skipChar)
read(); // consume the character we got with peek
c = timedPeek();
}
- while( (c >= '0' && c <= '9') || c == skipChar );
+ while( (c >= '0' && c <= '9') || c == ignore );
if(isNegative)
value = -value;
return value;
}
-
// as parseInt but returns a floating point value
-float Stream::parseFloat()
+float Stream::parseFloat(LookaheadMode lookahead, char ignore)
{
- return parseFloat(NO_SKIP_CHAR);
-}
-
-// as above but the given skipChar is ignored
-// this allows format characters (typically commas) in values to be ignored
-float Stream::parseFloat(char skipChar){
bool isNegative = false;
bool isFraction = false;
long value = 0;
- char c;
+ int c;
float fraction = 1.0;
- c = peekNextDigit();
+ c = peekNextDigit(lookahead, true);
// ignore non numeric leading characters
if(c < 0)
return 0; // zero returned if timeout
do{
- if(c == skipChar)
+ if(c == ignore)
; // ignore
else if(c == '-')
isNegative = true;
@@ -182,7 +184,7 @@ float Stream::parseFloat(char skipChar){
read(); // consume the character we got with peek
c = timedPeek();
}
- while( (c >= '0' && c <= '9') || c == '.' || c == skipChar );
+ while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
if(isNegative)
value = -value;
diff --git a/cores/arduino/Stream.h b/cores/arduino/Stream.h
index 15f6761..db71bb6 100644
--- a/cores/arduino/Stream.h
+++ b/cores/arduino/Stream.h
@@ -28,13 +28,24 @@
// compatability macros for testing
/*
#define getInt() parseInt()
-#define getInt(skipChar) parseInt(skipchar)
+#define getInt(ignore) parseInt(ignore)
#define getFloat() parseFloat()
-#define getFloat(skipChar) parseFloat(skipChar)
+#define getFloat(ignore) parseFloat(ignore)
#define getString( pre_string, post_string, buffer, length)
readBytesBetween( pre_string, terminator, buffer, length)
*/
+// This enumeration provides the lookahead options for parseInt(), parseFloat()
+// The rules set out here are used until either the first valid character is found
+// or a time out occurs due to lack of input.
+enum LookaheadMode{
+ SKIP_ALL, // All invalid characters are ignored.
+ SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
+ SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped.
+};
+
+#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field
+
class Stream : public Print
{
protected:
@@ -42,7 +53,7 @@ class Stream : public Print
unsigned long _startMillis; // used for timeout measurement
int timedRead(); // private method to read stream with timeout
int timedPeek(); // private method to peek stream with timeout
- int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout
+ int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout
public:
virtual int available() = 0;
@@ -72,12 +83,15 @@ class Stream : public Print
bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found
bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); }
+ long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR);
+ // returns the first valid (long) integer value from the current position.
+ // lookahead determines how parseInt looks ahead in the stream.
+ // See LookaheadMode enumeration at the top of the file.
+ // Lookahead is terminated by the first character that is not a valid part of an integer.
+ // Once parsing commences, 'ignore' will be skipped in the stream.
- long parseInt(); // returns the first valid (long) integer value from the current position.
- // initial characters that are not digits (or the minus sign) are skipped
- // integer is terminated by the first character that is not a digit.
-
- float parseFloat(); // float version of parseInt
+ float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR);
+ // float version of parseInt
size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer
size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }
@@ -94,11 +108,11 @@ class Stream : public Print
String readStringUntil(char terminator);
protected:
- long parseInt(char skipChar); // as above but the given skipChar is ignored
- // as above but the given skipChar is ignored
- // this allows format characters (typically commas) in values to be ignored
-
- float parseFloat(char skipChar); // as above but the given skipChar is ignored
+ long parseInt(char ignore) { return parseInt(SKIP_ALL, ignore); }
+ float parseFloat(char ignore) { return parseFloat(SKIP_ALL, ignore); }
+ // These overload exists for compatibility with any class that has derived
+ // Stream and used parseFloat/Int with a custom ignore character. To keep
+ // the public API simple, these overload remains protected.
struct MultiTarget {
const char *str; // string you're searching for
@@ -111,5 +125,5 @@ class Stream : public Print
int findMulti(struct MultiTarget *targets, int tCount);
};
-
+#undef NO_IGNORE_CHAR
#endif
diff --git a/cores/arduino/Tone.cpp b/cores/arduino/Tone.cpp
index 7216219..1bfb3e3 100644
--- a/cores/arduino/Tone.cpp
+++ b/cores/arduino/Tone.cpp
@@ -209,7 +209,7 @@ static int8_t toneBegin(uint8_t _pin)
#if defined(WGM42)
bitWrite(TCCR4B, WGM42, 1);
#elif defined(CS43)
- #warning this may not be correct
+ // TODO this may not be correct
// atmega32u4
bitWrite(TCCR4B, CS43, 1);
#endif
@@ -485,6 +485,7 @@ void noTone(uint8_t _pin)
if (tone_pins[i] == _pin) {
_timer = pgm_read_byte(tone_pin_to_timer_PGM + i);
tone_pins[i] = 255;
+ break;
}
}
diff --git a/cores/arduino/USBAPI.h b/cores/arduino/USBAPI.h
index 5837b3e..358444e 100644
--- a/cores/arduino/USBAPI.h
+++ b/cores/arduino/USBAPI.h
@@ -32,6 +32,12 @@ typedef unsigned long u32;
#include "Arduino.h"
+// This definitions is usefull if you want to reduce the EP_SIZE to 16
+// at the moment only 64 and 16 as EP_SIZE for all EPs are supported except the control endpoint
+#ifndef USB_EP_SIZE
+#define USB_EP_SIZE 64
+#endif
+
#if defined(USBCON)
#include "USBDesc.h"
@@ -41,6 +47,14 @@ typedef unsigned long u32;
//================================================================================
// USB
+#define EP_TYPE_CONTROL (0x00)
+#define EP_TYPE_BULK_IN ((1<<EPTYPE1) | (1<<EPDIR))
+#define EP_TYPE_BULK_OUT (1<<EPTYPE1)
+#define EP_TYPE_INTERRUPT_IN ((1<<EPTYPE1) | (1<<EPTYPE0) | (1<<EPDIR))
+#define EP_TYPE_INTERRUPT_OUT ((1<<EPTYPE1) | (1<<EPTYPE0))
+#define EP_TYPE_ISOCHRONOUS_IN ((1<<EPTYPE0) | (1<<EPDIR))
+#define EP_TYPE_ISOCHRONOUS_OUT (1<<EPTYPE0)
+
class USBDevice_
{
public:
@@ -50,6 +64,7 @@ public:
void attach();
void detach(); // Serial port goes down too...
void poll();
+ bool wakeupHost(); // returns false, when wakeup cannot be processed
};
extern USBDevice_ USBDevice;
@@ -60,7 +75,7 @@ extern USBDevice_ USBDevice;
struct ring_buffer;
#ifndef SERIAL_BUFFER_SIZE
-#if (RAMEND < 1000)
+#if ((RAMEND - RAMSTART) < 1023)
#define SERIAL_BUFFER_SIZE 16
#else
#define SERIAL_BUFFER_SIZE 64
@@ -83,6 +98,7 @@ public:
virtual int available(void);
virtual int peek(void);
virtual int read(void);
+ int availableForWrite(void);
virtual void flush(void);
virtual size_t write(uint8_t);
virtual size_t write(const uint8_t*, size_t);
@@ -92,105 +108,54 @@ public:
volatile uint8_t _rx_buffer_head;
volatile uint8_t _rx_buffer_tail;
unsigned char _rx_buffer[SERIAL_BUFFER_SIZE];
-};
-extern Serial_ Serial;
-#define HAVE_CDCSERIAL
+ // This method allows processing "SEND_BREAK" requests sent by
+ // the USB host. Those requests indicate that the host wants to
+ // send a BREAK signal and are accompanied by a single uint16_t
+ // value, specifying the duration of the break. The value 0
+ // means to end any current break, while the value 0xffff means
+ // to start an indefinite break.
+ // readBreak() will return the value of the most recent break
+ // request, but will return it at most once, returning -1 when
+ // readBreak() is called again (until another break request is
+ // received, which is again returned once).
+ // This also mean that if two break requests are received
+ // without readBreak() being called in between, the value of the
+ // first request is lost.
+ // Note that the value returned is a long, so it can return
+ // 0-0xffff as well as -1.
+ int32_t readBreak();
+
+ // These return the settings specified by the USB host for the
+ // serial port. These aren't really used, but are offered here
+ // in case a sketch wants to act on these settings.
+ uint32_t baud();
+ uint8_t stopbits();
+ uint8_t paritytype();
+ uint8_t numbits();
+ bool dtr();
+ bool rts();
+ enum {
+ ONE_STOP_BIT = 0,
+ ONE_AND_HALF_STOP_BIT = 1,
+ TWO_STOP_BITS = 2,
+ };
+ enum {
+ NO_PARITY = 0,
+ ODD_PARITY = 1,
+ EVEN_PARITY = 2,
+ MARK_PARITY = 3,
+ SPACE_PARITY = 4,
+ };
-//================================================================================
-//================================================================================
-// Mouse
-
-#define MOUSE_LEFT 1
-#define MOUSE_RIGHT 2
-#define MOUSE_MIDDLE 4
-#define MOUSE_ALL (MOUSE_LEFT | MOUSE_RIGHT | MOUSE_MIDDLE)
-
-class Mouse_
-{
-private:
- uint8_t _buttons;
- void buttons(uint8_t b);
-public:
- Mouse_(void);
- void begin(void);
- void end(void);
- void click(uint8_t b = MOUSE_LEFT);
- void move(signed char x, signed char y, signed char wheel = 0);
- void press(uint8_t b = MOUSE_LEFT); // press LEFT by default
- void release(uint8_t b = MOUSE_LEFT); // release LEFT by default
- bool isPressed(uint8_t b = MOUSE_LEFT); // check LEFT by default
};
-extern Mouse_ Mouse;
-
-//================================================================================
-//================================================================================
-// Keyboard
-
-#define KEY_LEFT_CTRL 0x80
-#define KEY_LEFT_SHIFT 0x81
-#define KEY_LEFT_ALT 0x82
-#define KEY_LEFT_GUI 0x83
-#define KEY_RIGHT_CTRL 0x84
-#define KEY_RIGHT_SHIFT 0x85
-#define KEY_RIGHT_ALT 0x86
-#define KEY_RIGHT_GUI 0x87
-
-#define KEY_UP_ARROW 0xDA
-#define KEY_DOWN_ARROW 0xD9
-#define KEY_LEFT_ARROW 0xD8
-#define KEY_RIGHT_ARROW 0xD7
-#define KEY_BACKSPACE 0xB2
-#define KEY_TAB 0xB3
-#define KEY_RETURN 0xB0
-#define KEY_ESC 0xB1
-#define KEY_INSERT 0xD1
-#define KEY_DELETE 0xD4
-#define KEY_PAGE_UP 0xD3
-#define KEY_PAGE_DOWN 0xD6
-#define KEY_HOME 0xD2
-#define KEY_END 0xD5
-#define KEY_CAPS_LOCK 0xC1
-#define KEY_F1 0xC2
-#define KEY_F2 0xC3
-#define KEY_F3 0xC4
-#define KEY_F4 0xC5
-#define KEY_F5 0xC6
-#define KEY_F6 0xC7
-#define KEY_F7 0xC8
-#define KEY_F8 0xC9
-#define KEY_F9 0xCA
-#define KEY_F10 0xCB
-#define KEY_F11 0xCC
-#define KEY_F12 0xCD
-
-// Low level key report: up to 6 keys and shift, ctrl etc at once
-typedef struct
-{
- uint8_t modifiers;
- uint8_t reserved;
- uint8_t keys[6];
-} KeyReport;
+extern Serial_ Serial;
-class Keyboard_ : public Print
-{
-private:
- KeyReport _keyReport;
- void sendReport(KeyReport* keys);
-public:
- Keyboard_(void);
- void begin(void);
- void end(void);
- virtual size_t write(uint8_t k);
- virtual size_t press(uint8_t k);
- virtual size_t release(uint8_t k);
- virtual void releaseAll(void);
-};
-extern Keyboard_ Keyboard;
+#define HAVE_CDCSERIAL
//================================================================================
//================================================================================
-// Low level API
+// Low level API
typedef struct
{
@@ -200,16 +165,7 @@ typedef struct
uint8_t wValueH;
uint16_t wIndex;
uint16_t wLength;
-} Setup;
-
-//================================================================================
-//================================================================================
-// HID 'Driver'
-
-int HID_GetInterface(uint8_t* interfaceNum);
-int HID_GetDescriptor(int i);
-bool HID_Setup(Setup& setup);
-void HID_SendReport(uint8_t id, const void* data, int len);
+} USBSetup;
//================================================================================
//================================================================================
@@ -217,7 +173,7 @@ void HID_SendReport(uint8_t id, const void* data, int len);
int MSC_GetInterface(uint8_t* interfaceNum);
int MSC_GetDescriptor(int i);
-bool MSC_Setup(Setup& setup);
+bool MSC_Setup(USBSetup& setup);
bool MSC_Data(uint8_t rx,uint8_t tx);
//================================================================================
@@ -226,7 +182,7 @@ bool MSC_Data(uint8_t rx,uint8_t tx);
int CDC_GetInterface(uint8_t* interfaceNum);
int CDC_GetDescriptor(int i);
-bool CDC_Setup(Setup& setup);
+bool CDC_Setup(USBSetup& setup);
//================================================================================
//================================================================================
@@ -237,8 +193,10 @@ bool CDC_Setup(Setup& setup);
int USB_SendControl(uint8_t flags, const void* d, int len);
int USB_RecvControl(void* d, int len);
+int USB_RecvControlLong(void* d, int len);
uint8_t USB_Available(uint8_t ep);
+uint8_t USB_SendSpace(uint8_t ep);
int USB_Send(uint8_t ep, const void* data, int len); // blocking
int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
int USB_Recv(uint8_t ep); // non-blocking
diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp
index b4f7bed..62b90ed 100644
--- a/cores/arduino/USBCore.cpp
+++ b/cores/arduino/USBCore.cpp
@@ -17,17 +17,11 @@
*/
#include "USBAPI.h"
+#include "PluggableUSB.h"
+#include <stdlib.h>
#if defined(USBCON)
-#define EP_TYPE_CONTROL 0x00
-#define EP_TYPE_BULK_IN 0x81
-#define EP_TYPE_BULK_OUT 0x80
-#define EP_TYPE_INTERRUPT_IN 0xC1
-#define EP_TYPE_INTERRUPT_OUT 0xC0
-#define EP_TYPE_ISOCHRONOUS_IN 0x41
-#define EP_TYPE_ISOCHRONOUS_OUT 0x40
-
/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */
#define TX_RX_LED_PULSE_MS 100
volatile u8 TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */
@@ -40,7 +34,7 @@ extern const u16 STRING_LANGUAGE[] PROGMEM;
extern const u8 STRING_PRODUCT[] PROGMEM;
extern const u8 STRING_MANUFACTURER[] PROGMEM;
extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM;
-extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM;
+extern const DeviceDescriptor USB_DeviceDescriptorB PROGMEM;
const u16 STRING_LANGUAGE[2] = {
(3<<8) | (2+2),
@@ -72,23 +66,21 @@ const u8 STRING_PRODUCT[] PROGMEM = USB_PRODUCT;
const u8 STRING_MANUFACTURER[] PROGMEM = USB_MANUFACTURER;
-#ifdef CDC_ENABLED
#define DEVICE_CLASS 0x02
-#else
-#define DEVICE_CLASS 0x00
-#endif
// DEVICE DESCRIPTOR
const DeviceDescriptor USB_DeviceDescriptor =
- D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
+ D_DEVICE(0x00,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,ISERIAL,1);
-const DeviceDescriptor USB_DeviceDescriptorA =
- D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1);
+const DeviceDescriptor USB_DeviceDescriptorB =
+ D_DEVICE(0xEF,0x02,0x01,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,ISERIAL,1);
//==================================================================
//==================================================================
volatile u8 _usbConfiguration = 0;
+volatile u8 _usbCurrentStatus = 0; // meaning of bits see usb_20.pdf, Figure 9-4. Information Returned by a GetStatus() Request to a Device
+volatile u8 _usbSuspendState = 0; // copy of UDINT to check SUSPI and WAKEUPI bits
static inline void WaitIN(void)
{
@@ -119,7 +111,7 @@ static inline void ClearOUT(void)
UEINTX = ~(1<<RXOUTI);
}
-void Recv(volatile u8* data, u8 count)
+static inline void Recv(volatile u8* data, u8 count)
{
while (count--)
*data++ = UEDATX;
@@ -262,7 +254,7 @@ u8 USB_SendSpace(u8 ep)
LockEP lock(ep);
if (!ReadWriteAllowed())
return 0;
- return 64 - FifoByteCount();
+ return USB_EP_SIZE - FifoByteCount();
}
// Blocking Send of data to an endpoint
@@ -317,30 +309,26 @@ int USB_Send(u8 ep, const void* d, int len)
return r;
}
-extern const u8 _initEndpoints[] PROGMEM;
-const u8 _initEndpoints[] =
+u8 _initEndpoints[USB_ENDPOINTS] =
{
- 0,
+ 0, // Control Endpoint
-#ifdef CDC_ENABLED
- EP_TYPE_INTERRUPT_IN, // CDC_ENDPOINT_ACM
- EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT
- EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN
-#endif
+ EP_TYPE_INTERRUPT_IN, // CDC_ENDPOINT_ACM
+ EP_TYPE_BULK_OUT, // CDC_ENDPOINT_OUT
+ EP_TYPE_BULK_IN, // CDC_ENDPOINT_IN
-#ifdef HID_ENABLED
- EP_TYPE_INTERRUPT_IN // HID_ENDPOINT_INT
-#endif
+ // Following endpoints are automatically initialized to 0
};
#define EP_SINGLE_64 0x32 // EP0
#define EP_DOUBLE_64 0x36 // Other endpoints
+#define EP_SINGLE_16 0x12
static
void InitEP(u8 index, u8 type, u8 size)
{
UENUM = index;
- UECONX = 1;
+ UECONX = (1<<EPEN);
UECFG0X = type;
UECFG1X = size;
}
@@ -348,12 +336,18 @@ void InitEP(u8 index, u8 type, u8 size)
static
void InitEndpoints()
{
- for (u8 i = 1; i < sizeof(_initEndpoints); i++)
+ for (u8 i = 1; i < sizeof(_initEndpoints) && _initEndpoints[i] != 0; i++)
{
UENUM = i;
- UECONX = 1;
- UECFG0X = pgm_read_byte(_initEndpoints+i);
+ UECONX = (1<<EPEN);
+ UECFG0X = _initEndpoints[i];
+#if USB_EP_SIZE == 16
+ UECFG1X = EP_SINGLE_16;
+#elif USB_EP_SIZE == 64
UECFG1X = EP_DOUBLE_64;
+#else
+#error Unsupported value for USB_EP_SIZE
+#endif
}
UERST = 0x7E; // And reset them
UERST = 0;
@@ -361,24 +355,21 @@ void InitEndpoints()
// Handle CLASS_INTERFACE requests
static
-bool ClassInterfaceRequest(Setup& setup)
+bool ClassInterfaceRequest(USBSetup& setup)
{
u8 i = setup.wIndex;
-#ifdef CDC_ENABLED
if (CDC_ACM_INTERFACE == i)
return CDC_Setup(setup);
-#endif
-#ifdef HID_ENABLED
- if (HID_INTERFACE == i)
- return HID_Setup(setup);
+#ifdef PLUGGABLE_USB_ENABLED
+ return PluggableUSB().setup(setup);
#endif
return false;
}
-int _cmark;
-int _cend;
+static int _cmark;
+static int _cend;
void InitControl(int end)
{
SetEP(0);
@@ -419,11 +410,12 @@ int USB_SendControl(u8 flags, const void* d, int len)
// Send a USB descriptor string. The string is stored in PROGMEM as a
// plain ASCII string but is sent out as UTF-16 with the correct 2-byte
// prefix
-static bool USB_SendStringDescriptor(const u8*string_P, u8 string_len) {
+static bool USB_SendStringDescriptor(const u8*string_P, u8 string_len, uint8_t flags) {
SendControl(2 + string_len * 2);
SendControl(3);
+ bool pgm = flags & TRANSFER_PGM;
for(u8 i = 0; i < string_len; i++) {
- bool r = SendControl(pgm_read_byte(&string_P[i]));
+ bool r = SendControl(pgm ? pgm_read_byte(&string_P[i]) : string_P[i]);
r &= SendControl(0); // high byte
if(!r) {
return false;
@@ -433,27 +425,35 @@ static bool USB_SendStringDescriptor(const u8*string_P, u8 string_len) {
}
// Does not timeout or cross fifo boundaries
-// Will only work for transfers <= 64 bytes
-// TODO
int USB_RecvControl(void* d, int len)
{
- WaitOUT();
- Recv((u8*)d,len);
- ClearOUT();
+ auto length = len;
+ while(length)
+ {
+ // Dont receive more than the USB Control EP has to offer
+ // Use fixed 64 because control EP always have 64 bytes even on 16u2.
+ auto recvLength = length;
+ if(recvLength > 64){
+ recvLength = 64;
+ }
+
+ // Write data to fit to the end (not the beginning) of the array
+ WaitOUT();
+ Recv((u8*)d + len - length, recvLength);
+ ClearOUT();
+ length -= recvLength;
+ }
return len;
}
-int SendInterfaces()
+static u8 SendInterfaces()
{
- int total = 0;
u8 interfaces = 0;
-#ifdef CDC_ENABLED
- total = CDC_GetInterface(&interfaces);
-#endif
+ CDC_GetInterface(&interfaces);
-#ifdef HID_ENABLED
- total += HID_GetInterface(&interfaces);
+#ifdef PLUGGABLE_USB_ENABLED
+ PluggableUSB().getInterface(&interfaces);
#endif
return interfaces;
@@ -467,7 +467,7 @@ bool SendConfiguration(int maxlen)
{
// Count and measure interfaces
InitControl(0);
- int interfaces = SendInterfaces();
+ u8 interfaces = SendInterfaces();
ConfigDescriptor config = D_CONFIG(_cmark + sizeof(ConfigDescriptor),interfaces);
// Now send them
@@ -477,19 +477,22 @@ bool SendConfiguration(int maxlen)
return true;
}
-u8 _cdcComposite = 0;
+static u8 _cdcComposite = 0;
static
-bool SendDescriptor(Setup& setup)
+bool SendDescriptor(USBSetup& setup)
{
+ int ret;
u8 t = setup.wValueH;
if (USB_CONFIGURATION_DESCRIPTOR_TYPE == t)
return SendConfiguration(setup.wLength);
InitControl(setup.wLength);
-#ifdef HID_ENABLED
- if (HID_REPORT_DESCRIPTOR_TYPE == t)
- return HID_GetDescriptor(t);
+#ifdef PLUGGABLE_USB_ENABLED
+ ret = PluggableUSB().getDescriptor(setup);
+ if (ret != 0) {
+ return (ret > 0 ? true : false);
+ }
#endif
const u8* desc_addr = 0;
@@ -497,7 +500,7 @@ bool SendDescriptor(Setup& setup)
{
if (setup.wLength == 8)
_cdcComposite = 1;
- desc_addr = _cdcComposite ? (const u8*)&USB_DeviceDescriptorA : (const u8*)&USB_DeviceDescriptor;
+ desc_addr = _cdcComposite ? (const u8*)&USB_DeviceDescriptorB : (const u8*)&USB_DeviceDescriptor;
}
else if (USB_STRING_DESCRIPTOR_TYPE == t)
{
@@ -505,10 +508,17 @@ bool SendDescriptor(Setup& setup)
desc_addr = (const u8*)&STRING_LANGUAGE;
}
else if (setup.wValueL == IPRODUCT) {
- return USB_SendStringDescriptor(STRING_PRODUCT, strlen(USB_PRODUCT));
+ return USB_SendStringDescriptor(STRING_PRODUCT, strlen(USB_PRODUCT), TRANSFER_PGM);
}
else if (setup.wValueL == IMANUFACTURER) {
- return USB_SendStringDescriptor(STRING_MANUFACTURER, strlen(USB_MANUFACTURER));
+ return USB_SendStringDescriptor(STRING_MANUFACTURER, strlen(USB_MANUFACTURER), TRANSFER_PGM);
+ }
+ else if (setup.wValueL == ISERIAL) {
+#ifdef PLUGGABLE_USB_ENABLED
+ char name[ISERIAL_MAX_LEN];
+ PluggableUSB().getShortName(name);
+ return USB_SendStringDescriptor((uint8_t*)name, strlen(name), 0);
+#endif
}
else
return false;
@@ -529,7 +539,7 @@ ISR(USB_COM_vect)
if (!ReceivedSetupInt())
return;
- Setup setup;
+ USBSetup setup;
Recv((u8*)&setup,8);
ClearSetupInt();
@@ -544,16 +554,37 @@ ISR(USB_COM_vect)
{
// Standard Requests
u8 r = setup.bRequest;
+ u16 wValue = setup.wValueL | (setup.wValueH << 8);
if (GET_STATUS == r)
{
- Send8(0); // TODO
- Send8(0);
+ if (requestType == (REQUEST_DEVICETOHOST | REQUEST_STANDARD | REQUEST_DEVICE))
+ {
+ Send8(_usbCurrentStatus);
+ Send8(0);
+ }
+ else
+ {
+ // TODO: handle the HALT state of an endpoint here
+ // see "Figure 9-6. Information Returned by a GetStatus() Request to an Endpoint" in usb_20.pdf for more information
+ Send8(0);
+ Send8(0);
+ }
}
else if (CLEAR_FEATURE == r)
{
+ if((requestType == (REQUEST_HOSTTODEVICE | REQUEST_STANDARD | REQUEST_DEVICE))
+ && (wValue == DEVICE_REMOTE_WAKEUP))
+ {
+ _usbCurrentStatus &= ~FEATURE_REMOTE_WAKEUP_ENABLED;
+ }
}
else if (SET_FEATURE == r)
{
+ if((requestType == (REQUEST_HOSTTODEVICE | REQUEST_STANDARD | REQUEST_DEVICE))
+ && (wValue == DEVICE_REMOTE_WAKEUP))
+ {
+ _usbCurrentStatus |= FEATURE_REMOTE_WAKEUP_ENABLED;
+ }
}
else if (SET_ADDRESS == r)
{
@@ -609,11 +640,97 @@ void USB_Flush(u8 ep)
ReleaseTX();
}
+static inline void USB_ClockDisable()
+{
+#if defined(OTGPADE)
+ USBCON = (USBCON & ~(1<<OTGPADE)) | (1<<FRZCLK); // freeze clock and disable VBUS Pad
+#else // u2 Series
+ USBCON = (1 << FRZCLK); // freeze clock
+#endif
+ PLLCSR &= ~(1<<PLLE); // stop PLL
+}
+
+static inline void USB_ClockEnable()
+{
+#if defined(UHWCON)
+ UHWCON |= (1<<UVREGE); // power internal reg
+#endif
+ USBCON = (1<<USBE) | (1<<FRZCLK); // clock frozen, usb enabled
+
+// ATmega32U4
+#if defined(PINDIV)
+#if F_CPU == 16000000UL
+ PLLCSR |= (1<<PINDIV); // Need 16 MHz xtal
+#elif F_CPU == 8000000UL
+ PLLCSR &= ~(1<<PINDIV); // Need 8 MHz xtal
+#else
+#error "Clock rate of F_CPU not supported"
+#endif
+
+#elif defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)
+ // for the u2 Series the datasheet is confusing. On page 40 its called PINDIV and on page 290 its called PLLP0
+#if F_CPU == 16000000UL
+ // Need 16 MHz xtal
+ PLLCSR |= (1 << PLLP0);
+#elif F_CPU == 8000000UL
+ // Need 8 MHz xtal
+ PLLCSR &= ~(1 << PLLP0);
+#endif
+
+// AT90USB646, AT90USB647, AT90USB1286, AT90USB1287
+#elif defined(PLLP2)
+#if F_CPU == 16000000UL
+#if defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__)
+ // For Atmel AT90USB128x only. Do not use with Atmel AT90USB64x.
+ PLLCSR = (PLLCSR & ~(1<<PLLP1)) | ((1<<PLLP2) | (1<<PLLP0)); // Need 16 MHz xtal
+#elif defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__)
+ // For AT90USB64x only. Do not use with AT90USB128x.
+ PLLCSR = (PLLCSR & ~(1<<PLLP0)) | ((1<<PLLP2) | (1<<PLLP1)); // Need 16 MHz xtal
+#else
+#error "USB Chip not supported, please defined method of USB PLL initialization"
+#endif
+#elif F_CPU == 8000000UL
+ // for Atmel AT90USB128x and AT90USB64x
+ PLLCSR = (PLLCSR & ~(1<<PLLP2)) | ((1<<PLLP1) | (1<<PLLP0)); // Need 8 MHz xtal
+#else
+#error "Clock rate of F_CPU not supported"
+#endif
+#else
+#error "USB Chip not supported, please defined method of USB PLL initialization"
+#endif
+
+ PLLCSR |= (1<<PLLE);
+ while (!(PLLCSR & (1<<PLOCK))) // wait for lock pll
+ {
+ }
+
+ // Some tests on specific versions of macosx (10.7.3), reported some
+ // strange behaviors when the board is reset using the serial
+ // port touch at 1200 bps. This delay fixes this behavior.
+ delay(1);
+#if defined(OTGPADE)
+ USBCON = (USBCON & ~(1<<FRZCLK)) | (1<<OTGPADE); // start USB clock, enable VBUS Pad
+#else
+ USBCON &= ~(1 << FRZCLK); // start USB clock
+#endif
+
+#if defined(RSTCPU)
+#if defined(LSM)
+ UDCON &= ~((1<<RSTCPU) | (1<<LSM) | (1<<RMWKUP) | (1<<DETACH)); // enable attach resistor, set full speed mode
+#else // u2 Series
+ UDCON &= ~((1 << RSTCPU) | (1 << RMWKUP) | (1 << DETACH)); // enable attach resistor, set full speed mode
+#endif
+#else
+ // AT90USB64x and AT90USB128x don't have RSTCPU
+ UDCON &= ~((1<<LSM) | (1<<RMWKUP) | (1<<DETACH)); // enable attach resistor, set full speed mode
+#endif
+}
+
// General interrupt
ISR(USB_GEN_vect)
{
u8 udint = UDINT;
- UDINT = 0;
+ UDINT = UDINT &= ~((1<<EORSTI) | (1<<SOFI)); // clear the IRQ flags for the IRQs which are handled here, except WAKEUPI and SUSPI (see below)
// End of Reset
if (udint & (1<<EORSTI))
@@ -626,9 +743,7 @@ ISR(USB_GEN_vect)
// Start of Frame - happens every millisecond so we use it for TX and RX LED one-shot timing, too
if (udint & (1<<SOFI))
{
-#ifdef CDC_ENABLED
USB_Flush(CDC_TX); // Send a tx frame if found
-#endif
// check whether the one-shot period has elapsed. if so, turn off the LED
if (TxLEDPulse && !(--TxLEDPulse))
@@ -636,6 +751,30 @@ ISR(USB_GEN_vect)
if (RxLEDPulse && !(--RxLEDPulse))
RXLED0;
}
+
+ // the WAKEUPI interrupt is triggered as soon as there are non-idle patterns on the data
+ // lines. Thus, the WAKEUPI interrupt can occur even if the controller is not in the "suspend" mode.
+ // Therefore the we enable it only when USB is suspended
+ if (udint & (1<<WAKEUPI))
+ {
+ UDIEN = (UDIEN & ~(1<<WAKEUPE)) | (1<<SUSPE); // Disable interrupts for WAKEUP and enable interrupts for SUSPEND
+
+ //TODO
+ // WAKEUPI shall be cleared by software (USB clock inputs must be enabled before).
+ //USB_ClockEnable();
+ UDINT &= ~(1<<WAKEUPI);
+ _usbSuspendState = (_usbSuspendState & ~(1<<SUSPI)) | (1<<WAKEUPI);
+ }
+ else if (udint & (1<<SUSPI)) // only one of the WAKEUPI / SUSPI bits can be active at time
+ {
+ UDIEN = (UDIEN & ~(1<<SUSPE)) | (1<<WAKEUPE); // Disable interrupts for SUSPEND and enable interrupts for WAKEUP
+
+ //TODO
+ //USB_ClockDisable();
+
+ UDINT &= ~((1<<WAKEUPI) | (1<<SUSPI)); // clear any already pending WAKEUP IRQs and the SUSPI request
+ _usbSuspendState = (_usbSuspendState & ~(1<<WAKEUPI)) | (1<<SUSPI);
+ }
}
// VBUS or counting frames
@@ -659,24 +798,12 @@ USBDevice_::USBDevice_()
void USBDevice_::attach()
{
_usbConfiguration = 0;
- UHWCON = 0x01; // power internal reg
- USBCON = (1<<USBE)|(1<<FRZCLK); // clock frozen, usb enabled
-#if F_CPU == 16000000UL
- PLLCSR = 0x12; // Need 16 MHz xtal
-#elif F_CPU == 8000000UL
- PLLCSR = 0x02; // Need 8 MHz xtal
-#endif
- while (!(PLLCSR & (1<<PLOCK))) // wait for lock pll
- ;
+ _usbCurrentStatus = 0;
+ _usbSuspendState = 0;
+ USB_ClockEnable();
- // Some tests on specific versions of macosx (10.7.3), reported some
- // strange behaviuors when the board is reset using the serial
- // port touch at 1200 bps. This delay fixes this behaviour.
- delay(1);
-
- USBCON = ((1<<USBE)|(1<<OTGPADE)); // start USB clock
- UDIEN = (1<<EORSTE)|(1<<SOFE); // Enable interrupts for EOR (End of Reset) and SOF (start of frame)
- UDCON = 0; // enable attach resistor
+ UDINT &= ~((1<<WAKEUPI) | (1<<SUSPI)); // clear already pending WAKEUP / SUSPEND requests
+ UDIEN = (1<<EORSTE) | (1<<SOFE) | (1<<SUSPE); // Enable interrupts for EOR (End of Reset), SOF (start of frame) and SUSPEND
TX_RX_LED_INIT;
}
@@ -696,4 +823,24 @@ void USBDevice_::poll()
{
}
+bool USBDevice_::wakeupHost()
+{
+ // clear any previous wakeup request which might have been set but could be processed at that time
+ // e.g. because the host was not suspended at that time
+ UDCON &= ~(1 << RMWKUP);
+
+ if(!(UDCON & (1 << RMWKUP))
+ && (_usbSuspendState & (1<<SUSPI))
+ && (_usbCurrentStatus & FEATURE_REMOTE_WAKEUP_ENABLED))
+ {
+ // This short version will only work, when the device has not been suspended. Currently the
+ // Arduino core doesn't handle SUSPEND at all, so this is ok.
+ USB_ClockEnable();
+ UDCON |= (1 << RMWKUP); // send the wakeup request
+ return true;
+ }
+
+ return false;
+}
+
#endif /* if defined(USBCON) */
diff --git a/cores/arduino/USBCore.h b/cores/arduino/USBCore.h
index 8d13806..4e08d71 100644
--- a/cores/arduino/USBCore.h
+++ b/cores/arduino/USBCore.h
@@ -18,6 +18,8 @@
#ifndef __USBCORE_H__
#define __USBCORE_H__
+#include "USBAPI.h"
+
// Standard requests
#define GET_STATUS 0
#define CLEAR_FEATURE 1
@@ -47,25 +49,20 @@
#define REQUEST_OTHER 0x03
#define REQUEST_RECIPIENT 0x03
-#define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST + REQUEST_CLASS + REQUEST_INTERFACE)
-#define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE + REQUEST_CLASS + REQUEST_INTERFACE)
+#define REQUEST_DEVICETOHOST_CLASS_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_CLASS | REQUEST_INTERFACE)
+#define REQUEST_HOSTTODEVICE_CLASS_INTERFACE (REQUEST_HOSTTODEVICE | REQUEST_CLASS | REQUEST_INTERFACE)
+#define REQUEST_DEVICETOHOST_STANDARD_INTERFACE (REQUEST_DEVICETOHOST | REQUEST_STANDARD | REQUEST_INTERFACE)
// Class requests
#define CDC_SET_LINE_CODING 0x20
#define CDC_GET_LINE_CODING 0x21
#define CDC_SET_CONTROL_LINE_STATE 0x22
+#define CDC_SEND_BREAK 0x23
#define MSC_RESET 0xFF
#define MSC_GET_MAX_LUN 0xFE
-#define HID_GET_REPORT 0x01
-#define HID_GET_IDLE 0x02
-#define HID_GET_PROTOCOL 0x03
-#define HID_SET_REPORT 0x09
-#define HID_SET_IDLE 0x0A
-#define HID_SET_PROTOCOL 0x0B
-
// Descriptors
#define USB_DEVICE_DESC_SIZE 18
@@ -79,6 +76,15 @@
#define USB_INTERFACE_DESCRIPTOR_TYPE 4
#define USB_ENDPOINT_DESCRIPTOR_TYPE 5
+// usb_20.pdf Table 9.6 Standard Feature Selectors
+#define DEVICE_REMOTE_WAKEUP 1
+#define ENDPOINT_HALT 2
+#define TEST_MODE 3
+
+// usb_20.pdf Figure 9-4. Information Returned by a GetStatus() Request to a Device
+#define FEATURE_SELFPOWERED_ENABLED (1 << 0)
+#define FEATURE_REMOTE_WAKEUP_ENABLED (1 << 1)
+
#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02
#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03
#define USB_DEVICE_CLASS_STORAGE 0x08
@@ -94,8 +100,8 @@
// bEndpointAddress in Endpoint Descriptor
#define USB_ENDPOINT_DIRECTION_MASK 0x80
-#define USB_ENDPOINT_OUT(addr) ((addr) | 0x00)
-#define USB_ENDPOINT_IN(addr) ((addr) | 0x80)
+#define USB_ENDPOINT_OUT(addr) (lowByte((addr) | 0x00))
+#define USB_ENDPOINT_IN(addr) (lowByte((addr) | 0x80))
#define USB_ENDPOINT_TYPE_MASK 0x03
#define USB_ENDPOINT_TYPE_CONTROL 0x00
@@ -120,11 +126,6 @@
#define MSC_SUBCLASS_SCSI 0x06
#define MSC_PROTOCOL_BULK_ONLY 0x50
-#define HID_HID_DESCRIPTOR_TYPE 0x21
-#define HID_REPORT_DESCRIPTOR_TYPE 0x22
-#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
-
-
// Device
typedef struct {
u8 len; // 18
@@ -257,32 +258,12 @@ typedef struct
EndpointDescriptor out;
} MSCDescriptor;
-typedef struct
-{
- u8 len; // 9
- u8 dtype; // 0x21
- u8 addr;
- u8 versionL; // 0x101
- u8 versionH; // 0x101
- u8 country;
- u8 desctype; // 0x22 report
- u8 descLenL;
- u8 descLenH;
-} HIDDescDescriptor;
-
-typedef struct
-{
- InterfaceDescriptor hid;
- HIDDescDescriptor desc;
- EndpointDescriptor in;
-} HIDDescriptor;
-
#define D_DEVICE(_class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs) \
{ 18, 1, 0x200, _class,_subClass,_proto,_packetSize0,_vid,_pid,_version,_im,_ip,_is,_configs }
#define D_CONFIG(_totalLength,_interfaces) \
- { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED, USB_CONFIG_POWER_MA(500) }
+ { 9, 2, _totalLength,_interfaces, 1, 0, USB_CONFIG_BUS_POWERED | USB_CONFIG_REMOTE_WAKEUP, USB_CONFIG_POWER_MA(500) }
#define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \
{ 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 }
@@ -293,11 +274,8 @@ typedef struct
#define D_IAD(_firstInterface, _count, _class, _subClass, _protocol) \
{ 8, 11, _firstInterface, _count, _class, _subClass, _protocol, 0 }
-#define D_HIDREPORT(_descriptorLength) \
- { 9, 0x21, 0x1, 0x1, 0, 1, 0x22, _descriptorLength, 0 }
-
#define D_CDCCS(_subtype,_d0,_d1) { 5, 0x24, _subtype, _d0, _d1 }
#define D_CDCCS4(_subtype,_d0) { 4, 0x24, _subtype, _d0 }
-#endif \ No newline at end of file
+#endif
diff --git a/cores/arduino/USBDesc.h b/cores/arduino/USBDesc.h
index 900713e..c0dce07 100644
--- a/cores/arduino/USBDesc.h
+++ b/cores/arduino/USBDesc.h
@@ -1,40 +1,33 @@
+/*
+ Copyright (c) 2011, Peter Barrett
+ Copyright (c) 2015, Arduino LLC
+
+ Permission to use, copy, modify, and/or distribute this software for
+ any purpose with or without fee is hereby granted, provided that the
+ above copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
+ */
+
+#define PLUGGABLE_USB_ENABLED
+
+#if defined(EPRST6)
+#define USB_ENDPOINTS 7 // AtMegaxxU4
+#else
+#define USB_ENDPOINTS 5 // AtMegaxxU2
+#endif
+#define ISERIAL_MAX_LEN 20
-/* Copyright (c) 2011, Peter Barrett
-**
-** Permission to use, copy, modify, and/or distribute this software for
-** any purpose with or without fee is hereby granted, provided that the
-** above copyright notice and this permission notice appear in all copies.
-**
-** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-** WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-** WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
-** BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
-** OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-** WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-** ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-** SOFTWARE.
-*/
-
-#define CDC_ENABLED
-#define HID_ENABLED
-
-
-#ifdef CDC_ENABLED
#define CDC_INTERFACE_COUNT 2
#define CDC_ENPOINT_COUNT 3
-#else
-#define CDC_INTERFACE_COUNT 0
-#define CDC_ENPOINT_COUNT 0
-#endif
-
-#ifdef HID_ENABLED
-#define HID_INTERFACE_COUNT 1
-#define HID_ENPOINT_COUNT 1
-#else
-#define HID_INTERFACE_COUNT 0
-#define HID_ENPOINT_COUNT 0
-#endif
#define CDC_ACM_INTERFACE 0 // CDC ACM
#define CDC_DATA_INTERFACE 1 // CDC Data
@@ -43,21 +36,11 @@
#define CDC_ENDPOINT_OUT (CDC_FIRST_ENDPOINT+1)
#define CDC_ENDPOINT_IN (CDC_FIRST_ENDPOINT+2)
-#define HID_INTERFACE (CDC_ACM_INTERFACE + CDC_INTERFACE_COUNT) // HID Interface
-#define HID_FIRST_ENDPOINT (CDC_FIRST_ENDPOINT + CDC_ENPOINT_COUNT)
-#define HID_ENDPOINT_INT (HID_FIRST_ENDPOINT)
-
#define INTERFACE_COUNT (MSC_INTERFACE + MSC_INTERFACE_COUNT)
-#ifdef CDC_ENABLED
#define CDC_RX CDC_ENDPOINT_OUT
#define CDC_TX CDC_ENDPOINT_IN
-#endif
-
-#ifdef HID_ENABLED
-#define HID_TX HID_ENDPOINT_INT
-#endif
-
-#define IMANUFACTURER 1
-#define IPRODUCT 2
+#define IMANUFACTURER 1
+#define IPRODUCT 2
+#define ISERIAL 3 \ No newline at end of file
diff --git a/cores/arduino/WInterrupts.c b/cores/arduino/WInterrupts.c
index 71dd45c..7e9f717 100644
--- a/cores/arduino/WInterrupts.c
+++ b/cores/arduino/WInterrupts.c
@@ -32,7 +32,39 @@
#include "wiring_private.h"
-static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
+static void nothing(void) {
+}
+
+static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS] = {
+#if EXTERNAL_NUM_INTERRUPTS > 8
+ #warning There are more than 8 external interrupts. Some callbacks may not be initialized.
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 7
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 6
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 5
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 4
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 3
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 2
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 1
+ nothing,
+#endif
+#if EXTERNAL_NUM_INTERRUPTS > 0
+ nothing,
+#endif
+};
// volatile static voidFuncPtr twiIntFunc;
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {
@@ -238,7 +270,7 @@ void detachInterrupt(uint8_t interruptNum) {
#endif
}
- intFunc[interruptNum] = 0;
+ intFunc[interruptNum] = nothing;
}
}
@@ -250,87 +282,71 @@ void attachInterruptTwi(void (*userFunc)(void) ) {
#if defined(__AVR_ATmega32U4__)
ISR(INT0_vect) {
- if(intFunc[EXTERNAL_INT_0])
- intFunc[EXTERNAL_INT_0]();
+ intFunc[EXTERNAL_INT_0]();
}
ISR(INT1_vect) {
- if(intFunc[EXTERNAL_INT_1])
- intFunc[EXTERNAL_INT_1]();
+ intFunc[EXTERNAL_INT_1]();
}
ISR(INT2_vect) {
- if(intFunc[EXTERNAL_INT_2])
- intFunc[EXTERNAL_INT_2]();
+ intFunc[EXTERNAL_INT_2]();
}
ISR(INT3_vect) {
- if(intFunc[EXTERNAL_INT_3])
- intFunc[EXTERNAL_INT_3]();
+ intFunc[EXTERNAL_INT_3]();
}
ISR(INT6_vect) {
- if(intFunc[EXTERNAL_INT_4])
- intFunc[EXTERNAL_INT_4]();
+ intFunc[EXTERNAL_INT_4]();
}
#elif defined(EICRA) && defined(EICRB)
ISR(INT0_vect) {
- if(intFunc[EXTERNAL_INT_2])
intFunc[EXTERNAL_INT_2]();
}
ISR(INT1_vect) {
- if(intFunc[EXTERNAL_INT_3])
intFunc[EXTERNAL_INT_3]();
}
ISR(INT2_vect) {
- if(intFunc[EXTERNAL_INT_4])
intFunc[EXTERNAL_INT_4]();
}
ISR(INT3_vect) {
- if(intFunc[EXTERNAL_INT_5])
intFunc[EXTERNAL_INT_5]();
}
ISR(INT4_vect) {
- if(intFunc[EXTERNAL_INT_0])
intFunc[EXTERNAL_INT_0]();
}
ISR(INT5_vect) {
- if(intFunc[EXTERNAL_INT_1])
intFunc[EXTERNAL_INT_1]();
}
ISR(INT6_vect) {
- if(intFunc[EXTERNAL_INT_6])
intFunc[EXTERNAL_INT_6]();
}
ISR(INT7_vect) {
- if(intFunc[EXTERNAL_INT_7])
intFunc[EXTERNAL_INT_7]();
}
#else
ISR(INT0_vect) {
- if(intFunc[EXTERNAL_INT_0])
intFunc[EXTERNAL_INT_0]();
}
ISR(INT1_vect) {
- if(intFunc[EXTERNAL_INT_1])
intFunc[EXTERNAL_INT_1]();
}
#if defined(EICRA) && defined(ISC20)
ISR(INT2_vect) {
- if(intFunc[EXTERNAL_INT_2])
intFunc[EXTERNAL_INT_2]();
}
#endif
diff --git a/cores/arduino/WString.cpp b/cores/arduino/WString.cpp
index dcd469d..cd3e0e8 100644
--- a/cores/arduino/WString.cpp
+++ b/cores/arduino/WString.cpp
@@ -43,7 +43,7 @@ String::String(const __FlashStringHelper *pstr)
*this = pstr;
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
String::String(String &&rval)
{
init();
@@ -189,7 +189,7 @@ String & String::copy(const __FlashStringHelper *pstr, unsigned int length)
return *this;
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
void String::move(String &rhs)
{
if (buffer) {
@@ -221,7 +221,7 @@ String & String::operator = (const String &rhs)
return *this;
}
-#ifdef __GXX_EXPERIMENTAL_CXX0X__
+#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
String & String::operator = (String &&rval)
{
if (this != &rval) move(rval);
diff --git a/cores/arduino/WString.h b/cores/arduino/WString.h
index 7402430..b047980 100644
--- a/cores/arduino/WString.h
+++ b/cores/arduino/WString.h
@@ -59,7 +59,7 @@ public:
String(const char *cstr = "");
String(const String &str);
String(const __FlashStringHelper *str);
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
+ #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
String(String &&rval);
String(StringSumHelper &&rval);
#endif
@@ -86,7 +86,7 @@ public:
String & operator = (const String &rhs);
String & operator = (const char *cstr);
String & operator = (const __FlashStringHelper *str);
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
+ #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
String & operator = (String &&rval);
String & operator = (StringSumHelper &&rval);
#endif
@@ -200,7 +200,7 @@ protected:
// copy and move
String & copy(const char *cstr, unsigned int length);
String & copy(const __FlashStringHelper *pstr, unsigned int length);
- #ifdef __GXX_EXPERIMENTAL_CXX0X__
+ #if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
void move(String &rhs);
#endif
};
diff --git a/cores/arduino/main.cpp b/cores/arduino/main.cpp
index 72074de..434cd40 100644
--- a/cores/arduino/main.cpp
+++ b/cores/arduino/main.cpp
@@ -27,6 +27,9 @@ int atexit(void (* /*func*/ )()) { return 0; }
void initVariant() __attribute__((weak));
void initVariant() { }
+void setupUSB() __attribute__((weak));
+void setupUSB() { }
+
int main(void)
{
init();
diff --git a/cores/arduino/wiring.c b/cores/arduino/wiring.c
index f1a14ef..b956f78 100644
--- a/cores/arduino/wiring.c
+++ b/cores/arduino/wiring.c
@@ -105,11 +105,11 @@ unsigned long micros() {
void delay(unsigned long ms)
{
- uint16_t start = (uint16_t)micros();
+ uint32_t start = micros();
while (ms > 0) {
yield();
- if (((uint16_t)micros() - start) >= 1000) {
+ while ( ms > 0 && (micros() - start) >= 1000) {
ms--;
start += 1000;
}
@@ -303,8 +303,6 @@ void init()
// put timer 1 in 8-bit phase correct pwm mode
#if defined(TCCR1A) && defined(WGM10)
sbi(TCCR1A, WGM10);
-#elif defined(TCCR1)
- #warning this needs to be finished
#endif
// set timer 2 prescale factor to 64
@@ -312,8 +310,8 @@ void init()
sbi(TCCR2, CS22);
#elif defined(TCCR2B) && defined(CS22)
sbi(TCCR2B, CS22);
-#else
- #warning Timer 2 not finished (may not be present on this CPU)
+//#else
+ // Timer 2 not finished (may not be present on this CPU)
#endif
// configure timer 2 for phase correct pwm (8-bit)
@@ -321,8 +319,8 @@ void init()
sbi(TCCR2, WGM20);
#elif defined(TCCR2A) && defined(WGM20)
sbi(TCCR2A, WGM20);
-#else
- #warning Timer 2 not finished (may not be present on this CPU)
+//#else
+ // Timer 2 not finished (may not be present on this CPU)
#endif
#if defined(TCCR3B) && defined(CS31) && defined(WGM30)
diff --git a/cores/arduino/wiring_digital.c b/cores/arduino/wiring_digital.c
index 51adb2c..27a62fc 100644
--- a/cores/arduino/wiring_digital.c
+++ b/cores/arduino/wiring_digital.c
@@ -94,7 +94,7 @@ static void turnOffPWM(uint8_t timer)
case TIMER0A: cbi(TCCR0A, COM0A1); break;
#endif
- #if defined(TIMER0B) && defined(COM0B1)
+ #if defined(TCCR0A) && defined(COM0B1)
case TIMER0B: cbi(TCCR0A, COM0B1); break;
#endif
#if defined(TCCR2A) && defined(COM2A1)
diff --git a/cores/arduino/wiring_private.h b/cores/arduino/wiring_private.h
index ed7c8f0..a277b14 100644
--- a/cores/arduino/wiring_private.h
+++ b/cores/arduino/wiring_private.h
@@ -52,7 +52,8 @@ uint32_t countPulseASM(volatile uint8_t *port, uint8_t bit, uint8_t stateMask, u
#define EXTERNAL_INT_6 6
#define EXTERNAL_INT_7 7
-#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__)
+#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega128RFA1__) || defined(__AVR_ATmega256RFR2__) || \
+ defined(__AVR_AT90USB82__) || defined(__AVR_AT90USB162__) || defined(__AVR_ATmega32U2__) || defined(__AVR_ATmega16U2__) || defined(__AVR_ATmega8U2__)
#define EXTERNAL_NUM_INTERRUPTS 8
#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644__) || defined(__AVR_ATmega644A__) || defined(__AVR_ATmega644P__) || defined(__AVR_ATmega644PA__)
#define EXTERNAL_NUM_INTERRUPTS 3
diff --git a/cores/arduino/wiring_pulse.c b/cores/arduino/wiring_pulse.c
index 76383e9..d6e0434 100644
--- a/cores/arduino/wiring_pulse.c
+++ b/cores/arduino/wiring_pulse.c
@@ -69,25 +69,24 @@ unsigned long pulseInLong(uint8_t pin, uint8_t state, unsigned long timeout)
uint8_t port = digitalPinToPort(pin);
uint8_t stateMask = (state ? bit : 0);
- // convert the timeout from microseconds to a number of times through
- // the initial loop; it takes 16 clock cycles per iteration.
- unsigned long numloops = 0;
- unsigned long maxloops = microsecondsToClockCycles(timeout);
+ unsigned long startMicros = micros();
// wait for any previous pulse to end
- while ((*portInputRegister(port) & bit) == stateMask)
- if (numloops++ == maxloops)
+ while ((*portInputRegister(port) & bit) == stateMask) {
+ if (micros() - startMicros > timeout)
return 0;
+ }
// wait for the pulse to start
- while ((*portInputRegister(port) & bit) != stateMask)
- if (numloops++ == maxloops)
+ while ((*portInputRegister(port) & bit) != stateMask) {
+ if (micros() - startMicros > timeout)
return 0;
+ }
unsigned long start = micros();
// wait for the pulse to stop
while ((*portInputRegister(port) & bit) == stateMask) {
- if (numloops++ == maxloops)
+ if (micros() - startMicros > timeout)
return 0;
}
return micros() - start;
diff --git a/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex b/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex
new file mode 100644
index 0000000..80c358b
--- /dev/null
+++ b/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-R3.hex
@@ -0,0 +1,490 @@
+:200000009EC00000B7C00000B5C00000B3C00000B1C00000AFC00000ADC00000ABC000006B
+:20002000A9C00000A7C00000A5C00000FCC30000A1C400009FC000009DC000009BC0000050
+:2000400099C0000097C0000095C0000093C0000091C000008FC000008DC00000C6C10000D4
+:2000600089C0000087C0000085C0000083C0000081C00000160538052206380522067A05C3
+:2000800097052206EA05FC052403470065006E00750069006E006F0020004D006500670077
+:2000A00061002000320035003600300000003A03410072006400750069006E006F002000C3
+:2000C0004C004C004300200028007700770077002E00610072006400750069006E006F0078
+:2000E0002E0063006300290000000403090409023E00020100C0320904000001020201007E
+:200100000524000110042402060524060001070582030800FF09040100020A000000070587
+:2001200004024000010705830240000112011001020000084123420201000102DC011124BA
+:200140001FBECFEFD2E0DEBFCDBF11E0A0E0B1E0EEE4FFE002C005900D92A631B107D9F721
+:2001600012E0A6E1B1E001C01D92AF32B107E1F764D0EBC645CFFC01E058FF4FA081B181C5
+:200180006C93A081B1819D012F5F3F4F318320832E173F0721F412969C938E9311972FB7D6
+:2001A000F894FC01EC57FF4F80818F5F80832FBF0895DC01AE57BF4FED91FC911197419133
+:2001C0001196FC93EE939C0120583F4FE217F30711F48D939C932FB7F894FC01EC57FF4F7E
+:2001E0009081915090832FBF842F089584B7877F84BF88E10FB6F894809360001092600009
+:200200000FBE87E690E09093CD008093CC0086E08093CA001092C80088E18093C900539A86
+:200220005A9A8AB180638AB98BB180638BB9F0D284E085BD5F9A579A0895D8DF2FB7F894EE
+:200240008EE991E090931F0280931E0290932102809320022FBF2FB7F89489E191E0909366
+:200260009A018093990190939C0180939B012FBF7894D3E09FB7F894809122029FBF8038ED
+:2002800049F080E091E00ED697FD04C0682F8EE991E071DF8FB7F894C0919D018FBFA899F9
+:2002A00002C0C13658F1A89A80919D01882319F05D98D0931601CC2349F089E191E079DFCD
+:2002C000682F80E091E093D5C150F5CF80911601882341F0809116018150809316018111C0
+:2002E00001C05D9A80911701882341F080911701815080931701811101C05C9A9FB7F894F1
+:20030000809122029FBF882361F08EE991E051DF9091C80095FFFCCF8093CE005C98D093B6
+:20032000170180E091E0B0D59AD4A4CF80E091E011C580E091E0A5C41F93CF93DF93EC011A
+:200340008C89813031F0823011F010E003C010E201C010E38B89823009F418608D898730A2
+:2003600031F0883031F0863029F4126003C0146001C016601092C9001092C8001092CA008F
+:200380002F85388949895A89211581EE38074105510571F0CA01B90196958795779567957E
+:2003A00060587B47814E9F4FA8D52150310902C020E130E03093CD002093CC001093CA008F
+:2003C0008F859889A989BA898115914EA105B10511F480E001C082E08093C80088E98093BB
+:2003E000C900DF91CF911F9108951F920F920FB60F9211242F933F934F935F936F937F93AE
+:200400008F939F93AF93BF93EF93FF936091CE008EB3843019F489E191E0ADDEFF91EF91A9
+:20042000BF91AF919F918F917F916F915F914F913F912F910F900FBE0F901F901895FC0108
+:20044000858580FF02C05F9808955F9A0895292F33272230310559F02330310569F0213071
+:200460003105F9F482E190E02CE231E01EC08EE390E02EEE30E019C099278130910541F06B
+:200480008230910541F0892B61F4EAEEF0E005C0EEEAF0E002C0E8E8F0E0849190E09F013E
+:2004A00004C080E090E020E030E0FA0131832083089528E030E040E02817390720F44F5F30
+:2004C000220F331FF9CF842F8295807F08958093E900EBEEF0E0808181608083EDEEF0E036
+:2004E00010826093EC0040838091EE00881F8827881F08951092F40080E08093E90010929B
+:20050000F0001092E8001092ED009091EB009E7F9093EB008F5F853081F7089580912702A9
+:2005200087FD05C08091E80080FF0DC010C08091E80082FD04C08EB38111F9CF08958091D8
+:20054000E8008B7707C08EB38111ECCF08958091E8008E778093E800089585E69091EC00B1
+:2005600090FF05C09091E80090FF05C01BC09091E80092FD17C09EB39923B1F09EB39530BC
+:20058000A9F09091EB0095FD13C09091E10092FFE5CF9091E1009B7F9093E1008150F1F632
+:2005A00084E0089580E0089582E0089583E0089581E0089520912D0230912E0226173707F4
+:2005C00048F06115710539F42091E8002E772093E80001C0B90130E06115710591F1209147
+:2005E000E80023FD38C02091E80022FF06C08091E80082FF29C080E008952EB3222369F19B
+:200600002EB3253061F12091E80020FFE5CF2091F200FC01CF016115710549F0283038F4CD
+:2006200081918093F100615071092F5FF3CF31E0283009F030E02091E8002E772093E800DE
+:20064000CBCF3111CCCFD3CF8EB3882331F08EB3853069F604C081E0089582E0089583E0FB
+:20066000089520912D0230912E022617370748F06115710539F42091E8002E772093E80067
+:2006800001C0B90130E06115710599F12091E80023FD39C02091E80022FF06C08091E8002E
+:2006A00082FF2AC080E008952EB3222371F12EB3253069F12091E80020FFE5CF2091F200AB
+:2006C000FC01CF016115710551F0283040F484918093F100615071092F5F3196F2CF31E029
+:2006E000283009F030E02091E8002E772093E800CACF3111CBCFD2CF8EB3882331F08EB35C
+:20070000853061F604C081E0089582E0089583E008956115710529F42091E8002B77209315
+:20072000E8006115710549F12091E80023FD2AC02EB3222359F12EB3253051F12091E80087
+:2007400022FFF2CFFC018091F200882371F09F012F5F3F4FC9014091F10040836150710975
+:2007600061157105C9F2F901EECFCF01D5CF8EB3882361F08EB3853059F08091E80080FFB3
+:20078000F6CF02C081E0089580E0089582E0089583E0089542D044D01EBA1092250210926F
+:2007A00024021092230284E089BD89B5826089BD09B400FEFDCF8091D800982F9F779093CC
+:2007C000D80080688093D800809163008E7F809363008091D8008F7D8093D8008091E000A6
+:2007E0008E7F8093E0008091E1008E7F8093E1008091E20081608093E2008091E100877F45
+:200800008093E1008091E20088608093E2000895C1DF81E08093260208951092E20008957D
+:200820001092E10008951F920F920FB60F9211242F933F934F935F936F937F938F939F93DB
+:20084000AF93BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F809349
+:20086000E1008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80023
+:2008800019BC1EBAEBD18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD26
+:2008A00009B400FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7EDE
+:2008C0008093E2008091E20081608093E20080912502882311F084E001C081E08EBBBED118
+:2008E0008091E10083FF27C08091E20083FF23C08091E100877F8093E10082E08EBB10920C
+:2009000025028091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200FF
+:20092000E9DD42E060E080E0D2DD8091F00088608093F00093D18091E10082FF0AC08091E2
+:20094000E20082FF06C08091E1008B7F8093E10085D1FF91EF91BF91AF919F918F917F9128
+:200960006F915F914F913F912F910F900FBE0F901F9018951F920F920FB60F9211242F9301
+:200980003F934F935F936F937F938F939F93AF93BF93CF93EF93FF93E9EEF0E0C081C77020
+:2009A0001082E0EFF0E08081877F808378941CD0F894E9EEF0E01082A0EFB0E08C9188601B
+:2009C0008C93C083FF91EF91CF91BF91AF919F918F917F916F915F914F913F912F910F9056
+:2009E0000FBE0F901F9018951F93CF93DF93CDB7DEB7AA970FB6F894DEBF0FBECDBFE7E23F
+:200A0000F2E08091F100819322E0EF32F207C9F72091270230912802832F90E08A309105DB
+:200A200008F010C1FC01E65CFF4F89C2203881F0223809F007C180912B0287708093E90000
+:200A40008091EB0085FB882780F91092E90006C08091230290912402911182609091E80097
+:200A6000977F9093E8008093F1001092F100BDC0822F8D7F09F0E6C0222319F0223061F0F4
+:200A8000D2C080912902813009F0CDC0333009F080E08093240228C080912902811124C0C2
+:200AA00020912B02277009F4BEC02093E9008091EB0080FFB8C08091EB00333011F4806271
+:200AC00011C080618093EB0081E090E0022E01C0880F0A94EAF78093EA001092EA008091F4
+:200AE000EB0088608093EB001092E9008091E800877F7EC02111A6C0109129028091E80000
+:200B0000877F8093E8000ADD8091E80080FD04C08EB38111F9CF87C0812F8F7711F093E0A7
+:200B200001C092E09EBB80688093E3007CC02058223008F087C08091290290912A028C3DB4
+:200B400023E0920781F583E08A838AE289834FB7F894DE01139620E03EE051E2E32FF0E04E
+:200B600050935700E49120FF03C0E295EF703F5FEF7090E39E0F9A3310F0E95C01C0E92F06
+:200B80008E2F90E08D939D932F5F243139F74FBF8091E800877F8093E8006AE270E0CE0152
+:200BA000019608DD11C0AE014F5F5F4F60912B024EDC0097C1F12091E800277F2093E80072
+:200BC000BC0189819A814DDD8091E8008B778093E80029C02038B1F58091E800877F80931A
+:200BE000E800809125028093F1008091E8008E778093E80093DC17C0211124C09091290230
+:200C0000923088F48091E800877F8093E8009093250284DC80912502882311F084E001C0E9
+:200C200083E08EBB83DB8091E80083FF0DC08091EB0080628093EB008091E800877F809374
+:200C4000E80002C076DBEFCFAA960FB6F894DEBF0FBECDBFDF91CF911F9108950895CF9338
+:200C60008EB3882359F0C091E900C7701092E9008091E80083FDB8DEC093E900CF910895FB
+:200C80000895CF93DF93EC018091E80083FF5FC0888190E020912B0230912C022817390797
+:200CA00009F055C080912802813249F018F48032C9F04DC0823261F18332C9F148C08091ED
+:200CC0002702813A09F043C08091E800877F8093E80067E070E0CE010F966CDC8091E800EE
+:200CE0008B7713C080912702813289F58091E800877F8093E80067E070E0CE010F9609DDC9
+:200D0000CE011ADB8091E8008E778093E8001FC0809127028132D9F48091E800877F80936B
+:200D2000E800809129028D87CE0189DB0DC080912702813261F48091E800877F8093E8003F
+:200D400060912902CE019CDFDF91CF91E7CBDF91CF9108950F931F93CF93DF93EC01FC012C
+:200D60003D9689E0DF011D928A95E9F72A813B818C81882311F014E001C010E00981C90190
+:200D800098DB412F482B426061E8802FA0DB882341F12E813F818885882311F014E001C02E
+:200DA00010E00D81C90185DB412F482B426060E8802F8DDB8823A9F02A853B858C85882338
+:200DC00011F014E001C010E0C985C90172DB412F482B426061EC8C2FDF91CF911F910F915B
+:200DE00076CB80E0DF91CF911F910F910895CF93C62F2EB32430E9F4FC01478550896189A0
+:200E00007289452B462B472BA1F081818093E9008091E80085FF04C0C093F10080E00AC046
+:200E20008091E8008E778093E80097DB8823A1F301C082E0CF9108952EB3243019F5FC01A8
+:200E40004785508961897289452B462B472BD1F081818093E9008091F200882389F09091AE
+:200E6000E8008091E8008E778093E80095FD08C074DB811108C08091E8008E778093E80095
+:200E800080E0089582E008952EB3243051F4FC014785508961897289452B462B472B09F009
+:200EA000CBCF08952EB3243019F08FEF9FEF0895FC014785508961897289452B462B472B3A
+:200EC000A1F385818093E9008091E80082FFEDCF8091F200882321F02091F10030E002C013
+:200EE0002FEF3FEF8091F200811105C08091E8008B778093E800C9010895A1E21A2EAA1B5F
+:200F0000BB1BFD010DC0AA1FBB1FEE1FFF1FA217B307E407F50720F0A21BB30BE40BF50B8E
+:200F2000661F771F881F991F1A9469F760957095809590959B01AC01BD01CF010895EE0F84
+:200F4000FF1F0590F491E02D0994F894FFCF000340000004400000020800000000000000C4
+:200F600000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF8D
+:200F800020F0A21BB30BE40BF50B661F771F881F991F1A9469F760957095809590959B017F
+:200FA000AC01BD01CF010895F894FFCF00034000000440000002080000000000000000006E
+:200FC0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F
+:200FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11
+:20100000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
+:20102000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
+:20104000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
+:20106000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF90
+:20108000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF70
+:2010A000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFF12
+:202EE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2
+:202F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1
+:202F2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB1
+:202F4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF91
+:202F6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF71
+:202F8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF51
+:202FA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF31
+:202FC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11
+:202FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1
+:203000004BC0000064C0000062C0000060C000005EC000005CC000005AC0000058C00000D3
+:2030200056C0000054C0000052C00000CBC400004EC000004CC000004AC0000048C0000099
+:2030400046C0000044C0000042C0000040C000003EC000003CC000003AC0000038C0000078
+:2030600036C0000034C0000032C0000030C000002EC000002CC000002AC0000028C00000D8
+:2030800026C0000024C0000022C0000020C000001EC000001CC0000011241FBECFEFD2E068
+:2030A000DEBFCDBF11E0A0E0B1E0E4EBFCE302C005900D92A836B107D9F711E0A8E6B1E0CB
+:2030C00001C01D92A738B107E1F74FD3F1C598CF982F15C08091F200882371F48091E8002A
+:2030E0008B7F8093E80003C08EB3882351F08091E80082FFF9CF02C08091F1009150992338
+:2031000049F708952091760130917501809174019091730180936D0190936E01C901809368
+:203120006F0190937001089580917101843009F45AC0853030F4813059F0833009F0C3C09E
+:203140001FC0853009F4A0C0863009F0BCC0AFC080917201823008F0B6C0D4DF8091720109
+:20316000882361F480916D0190916E0123E0FC0120935700E89507B600FCFDCF85E008C007
+:2031800080917201882311F0823029F4BBDF89E0809301010895813009F095C020E030E06C
+:2031A00040E050E0F90184918F3F81F0CA01AA27BB2780936C0130936E0120936D018AE0B6
+:2031C0008093010185E08093690108952F5F3F4F4F4F5F4F2030F0E33F07F0E04F07F0E094
+:2031E0005F0701F7089580917201833051F581E0809368018091770190917801892B71F042
+:2032000080917301813009F05EC0809176019091750190936B0180936A0108958091730113
+:20322000882361F42CE088E190E00FB6F894A895809360000FBE2093600008951092000188
+:203240000895882309F03FC0809173018F3F09F03AC0E0E0F0E093E085E090935700E89589
+:2032600007B600FCFDCF80935700E89507B600FCFDCFE058FF4F20E3E030F20771F781E101
+:2032800080935700E8950895E091730180917201882321F4F0E0EB5FFE4F05C0813099F417
+:2032A000F0E0EE52FF4F808180937C01089580917201833041F480917301882321F48091C0
+:2032C000740180936C0108952F923F924F925F926F927F929F92AF92BF92CF92DF92EF92D0
+:2032E000FF920F931F93CF93DF938091850190918601909378018093770180917901882379
+:2033000051F08091790181508093790180917901882309F45D9A80917A01882351F08091D0
+:203320007A01815080937A0180917A01882309F45C9A80918001833009F4B2C1843030F4FC
+:20334000813071F0823009F0E3C111C1853009F4C5C1853008F4BAC1863009F0D9C1CDC1FF
+:203360005C9883E080937A018091E800877F8093E80080916801882329F0D6DE5D9A5C9A8F
+:203380001092680120917701309178012115310529F42AC08EB3882309F4BAC18091E800EF
+:2033A00082FFF8CF8091F10080937101215030403093780120937701E2E7F1E00CC080917F
+:2033C000F10081932150304081E0E737F80719F43183208308C08091F200882381F7309374
+:2033E000780120937701A0DE80910101853009F0BAC08091770190917801892B21F482E022
+:2034000080930101B0C08AE163DE80916D018F715FDEC0916F01D091700120916D0130914C
+:203420006E0121968E01021B130B219780917201882309F093C0180136942794C901A091D0
+:203440006C01B0E09C01AD0162E0E62EF12C012D112DE20EF31E041F151F59016A0190E0B8
+:2034600099249394B5E0A3E048C08091F200882371F48091E8008B7F8093E80004C08EB332
+:20348000882309F445C18091E80082FFF8CF0894210831088091F100682F8091F100782FFD
+:2034A000F5010B0190925700E89511249F5F903419F021143104A1F4F901B0935700E89504
+:2034C00007B600FCFDCF2114310451F0F701A0935700E89507B600FCFDCFA801970190E087
+:2034E00042E0442E512C612C712CE40CF51C061D171DA40CB51CC61CD71C2114310409F080
+:20350000B4CFD0936E01C0936D0181E180935700E89527C08091F200882371F48091E80059
+:203520008B7F8093E80004C08EB3882309F4F0C08091E80082FFF8CF6091F10080916D0187
+:2035400090916E01A7D380916D0190916E01019690936E0180936D010150104001151105DB
+:20356000C9F680E1B5DD8091E8008B7FC3C08091E800877F8093E8005D9883E08093790134
+:2035800004C08EB3882309F4C3C08091E80080FFF8CF80910101893091F08A3069F4809147
+:2035A0007201813049F480916D0190916E018093F1009093F1009BC080917C0196C0609153
+:2035C0006F017091700120916D0130916E016F5F7F4F7B01E21AF30A6150704080917201C4
+:2035E000882389F5870116950795C901A0916C01B0E09C01AD011FC08091F200803271F497
+:203600008091E8008E7F8093E80004C08EB3882309F47EC08091E80080FFF8CFF90185916F
+:2036200094918093F1009093F100015010402E5F3F4F4F4F5F4F01151105F1F670936E01C0
+:2036400060936D0129C0823039F523C08091F200803271F48091E8008E7F8093E80004C07E
+:203660008EB3882309F454C08091E80080FFF8CF00916D0110916E01C80104D38093F1005B
+:203680000F5F1F4F10936E0100936D010894E108F108E114F104D1F682E08093010127C0AE
+:2036A0008091E800877F8093E800809169018093F1001092F1001092F1001092F1008091C7
+:2036C00001018093F1001092F10011C08091E800877F8093E8001092690119C08091E800A8
+:2036E000877F8093E800809101018093F1008091E8008E7F8093E8000AC08091E800877FE8
+:203700008093E8005D9A5C9A82E08093010187D0DF91CF911F910F91FF90EF90DF90CF90F7
+:20372000BF90AF909F907F906F905F904F903F902F9008952BD181E085BF15BE089584B779
+:20374000877F84BF88E10FB6F89480936000109260000FBE81E085BF82E085BF8AB18063BB
+:203760008AB98BB180638BB90CC1E9DF789401C080D2809100018823D9F78091680188233D
+:20378000B9F7D8DFE0916A01F0916B010995FA01923071F0933089F0913029F488E091E04A
+:2037A00022E130E019C080E090E020E030E014C08AE191E02BE130E00FC0882339F48091B9
+:2037C0003501282F30E085E391E006C080913901282F30E089E391E091838083C9010895A0
+:2037E0008091EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881FC4
+:2038000008951092F4001092F0001092E8001092ED00EBEEF0E080818E7F80830895809162
+:203820007F0188238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B7F8093E8004D
+:2038400008958EB3882349F08091E80080FFF9CF8091E8008E7F8093E80008959C0140915A
+:203860008501509186014617570718F4F90120E038C06115710511F0AB01F8CF8091E80048
+:203880008E7F8093E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC071
+:2038A0008EB3882381F18EB3853079F18091E80080FF17C09091F20006C081918093F1000C
+:2038C000415050409F5F4115510511F09032A8F320E0903209F421E08091E8008E7F8093E6
+:2038E000E8004115510591F6222381F606C08EB3882349F08EB3853041F08091E80082FF65
+:20390000F6CF80E0089582E0089583E0089554D056D01EBA10927D0184E089BD89B58260DA
+:2039200089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809163008E7FA5
+:20394000809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1008E7F80930E
+:20396000E1008091E20081608093E2008091E100877F8093E1008091E20088608093E200E1
+:203980000895C5DF81E080937E010895C0DFE0EEF0E0808181608083E8EDF0E080818F7788
+:2039A00080830AD00CD019BCE3E6F0E080818160808310927E0108951092E200089510927A
+:2039C000E10008951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF936A
+:2039E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E100D9
+:203A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC5D
+:203A20001EBA26D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B431
+:203A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093B6
+:203A6000E2008091E20081608093E20080917D01882311F481E001C084E08EBBF9D08091B3
+:203A8000E10083FF22C08091E20083FF1EC08091E100877F8093E10082E08EBB10927D01D7
+:203AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200A1DED6
+:203AC00080E060E042E28CDED3D08091E10082FF0AC08091E20082FF06C08091E1008B7FA2
+:203AE0008093E100C5D0FF91EF91BF91AF919F918F917F916F915F914F913F912F910F903E
+:203B00000FBE0F901F9018951F93DF93CF9300D0CDB7DEB7EFE7F1E08091F100819381E050
+:203B2000E738F807C9F790917F0180918001853011F1863040F48130B9F0813070F08330B5
+:203B400009F081C011C0883009F453C0893009F462C0863009F077C02DC0903809F474C0EE
+:203B6000923809F070C070C0992309F46DC0923009F069C069C0992309F065C01091810132
+:203B80008091E800877F8093E80049DE04C08EB3882309F459C08091E80080FFF8CF812F4F
+:203BA0008F7711F492E001C093E09EBB80688093E3004AC09058923008F045C080918101D9
+:203BC0009091820160918301AE014F5F5F4FDFDDBC010097C9F18091E800877F8093E800FD
+:203BE00089819A813BDE8091E8008B7F8093E8002BC0903841F58091E800877F8093E800A6
+:203C000080917D018093F1008091E8008E7F8093E80005DE19C09923B1F49091810192308E
+:203C200098F48091E800877F8093E80090937D01F6DD80917D01882311F483E001C084E0C3
+:203C40008EBB16D001C040DB8091E80083FF0AC08091EB0080628093EB008091E800877F39
+:203C60008093E8000F900F90CF91DF911F91089508958EB3882329F08091E80083FF01C010
+:203C800043CF0895F999FECF92BD81BDF89A992780B50895262FF999FECF1FBA92BD81BD4B
+:203CA00020BD0FB6F894FA9AF99A0FBE01960895F894FFCF01021E948920DCFB12011001FB
+:203CC00000000020EB03EF2F00000001000109021B0001010080320904000000FE010200CE
+:203CE0000921030000000C0001040309042C03410054006D0065006700610031003600555C
+:1C3D00000032002000440046005500200020002000200020002000200000000096
+:00000001FF
diff --git a/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Uno-R3.hex b/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Uno-R3.hex
new file mode 100644
index 0000000..a6fe194
--- /dev/null
+++ b/firmwares/atmegaxxu2/Genuino-COMBINED-dfu-usbserial-atmega16u2-Uno-R3.hex
@@ -0,0 +1,490 @@
+:2000000098C00000B1C00000AFC00000ADC00000ABC00000A9C00000A7C00000A5C000009B
+:20002000A3C00000A1C000009FC00000F6C300009BC4000099C0000097C0000095C0000080
+:2000400093C0000091C000008FC000008DC000008BC0000089C0000087C00000C0C1000004
+:2000600083C0000081C000007FC000007DC000007BC00000100532051C0632051C06740505
+:2000800091051C06E405F6051803470065006E00750069006E006F00200055006E006F0082
+:2000A00000003A03410072006400750069006E006F0020004C004C00430020002800770077
+:2000C000770077002E00610072006400750069006E006F002E0063006300290000000403EE
+:2000E000090409023E00020100C03209040000010202010005240001100424020605240609
+:200100000001070582030800FF09040100020A000000070504024000010705830240000107
+:2001200012011001020000084123430201000102DC0111241FBECFEFD2E0DEBFCDBF11E06B
+:20014000A0E0B1E0E2E4FFE002C005900D92A631B107D9F712E0A6E1B1E001C01D92AF3239
+:20016000B107E1F764D0EBC64BCFFC01E058FF4FA081B1816C93A081B1819D012F5F3F4F0E
+:20018000318320832E173F0721F412969C938E9311972FB7F894FC01EC57FF4F80818F5FD9
+:2001A00080832FBF0895DC01AE57BF4FED91FC91119741911196FC93EE939C0120583F4FE2
+:2001C000E217F30711F48D939C932FB7F894FC01EC57FF4F9081915090832FBF842F089595
+:2001E00084B7877F84BF88E10FB6F89480936000109260000FBE87E690E09093CD0080939F
+:20020000CC0086E08093CA001092C80088E18093C900539A5A9A8AB180638AB98BB18063BF
+:200220008BB9F0D284E085BD5F9A579A0895D8DF2FB7F8948EE991E090931F0280931E0203
+:2002400090932102809320022FBF2FB7F89489E191E090939A018093990190939C018093AA
+:200260009B012FBF7894D3E09FB7F894809122029FBF803849F080E091E00ED697FD04C0C2
+:20028000682F8EE991E071DF8FB7F894C0919D018FBFA89902C0C13658F1A89A80919D014C
+:2002A000882319F05D98D0931601CC2349F089E191E079DF682F80E091E093D5C150F5CF1B
+:2002C00080911601882341F080911601815080931601811101C05D9A80911701882341F0A8
+:2002E00080911701815080931701811101C05C9A9FB7F894809122029FBF882361F08EE9A8
+:2003000091E051DF9091C80095FFFCCF8093CE005C98D093170180E091E0B0D59AD4A4CF6D
+:2003200080E091E011C580E091E0A5C41F93CF93DF93EC018C89813031F0823011F010E0DF
+:2003400003C010E201C010E38B89823009F418608D89873031F0883031F0863029F41260ED
+:2003600003C0146001C016601092C9001092C8001092CA002F85388949895A89211581EEFF
+:2003800038074105510571F0CA01B901969587957795679560587B47814E9F4FA8D5215028
+:2003A000310902C020E130E03093CD002093CC001093CA008F859889A989BA898115914E95
+:2003C000A105B10511F480E001C082E08093C80088E98093C900DF91CF911F9108951F9243
+:2003E0000F920FB60F9211242F933F934F935F936F937F938F939F93AF93BF93EF93FF9349
+:200400006091CE008EB3843019F489E191E0ADDEFF91EF91BF91AF919F918F917F916F91B5
+:200420005F914F913F912F910F900FBE0F901F901895FC01858580FF02C05F9808955F9A20
+:200440000895292F33272230310559F02330310569F021303105F9F482E190E020E231E040
+:200460001EC08EE390E022EE30E019C099278130910541F08230910541F0892B61F4EEED2F
+:20048000F0E005C0E2EAF0E002C0E8E8F0E0849190E09F0104C080E090E020E030E0FA0105
+:2004A00031832083089528E030E040E02817390720F44F5F220F331FF9CF842F8295807FBB
+:2004C00008958093E900EBEEF0E0808181608083EDEEF0E010826093EC0040838091EE0017
+:2004E000881F8827881F08951092F40080E08093E9001092F0001092E8001092ED009091A4
+:20050000EB009E7F9093EB008F5F853081F708958091270287FD05C08091E80080FF0DC045
+:2005200010C08091E80082FD04C08EB38111F9CF08958091E8008B7707C08EB38111ECCF27
+:2005400008958091E8008E778093E800089585E69091EC0090FF05C09091E80090FF05C03F
+:200560001BC09091E80092FD17C09EB39923B1F09EB39530A9F09091EB0095FD13C0909142
+:20058000E10092FFE5CF9091E1009B7F9093E1008150F1F684E0089580E0089582E0089560
+:2005A00083E0089581E0089520912D0230912E022617370748F06115710539F42091E80007
+:2005C0002E772093E80001C0B90130E06115710591F12091E80023FD38C02091E80022FF77
+:2005E00006C08091E80082FF29C080E008952EB3222369F12EB3253061F12091E80020FF15
+:20060000E5CF2091F200FC01CF016115710549F0283038F481918093F100615071092F5F3E
+:20062000F3CF31E0283009F030E02091E8002E772093E800CBCF3111CCCFD3CF8EB38823A8
+:2006400031F08EB3853069F604C081E0089582E0089583E0089520912D0230912E02261755
+:20066000370748F06115710539F42091E8002E772093E80001C0B90130E06115710599F111
+:200680002091E80023FD39C02091E80022FF06C08091E80082FF2AC080E008952EB32223A1
+:2006A00071F12EB3253069F12091E80020FFE5CF2091F200FC01CF016115710551F02830E7
+:2006C00040F484918093F100615071092F5F3196F2CF31E0283009F030E02091E8002E77DC
+:2006E0002093E800CACF3111CBCFD2CF8EB3882331F08EB3853061F604C081E0089582E0CB
+:20070000089583E008956115710529F42091E8002B772093E8006115710549F12091E8009E
+:2007200023FD2AC02EB3222359F12EB3253051F12091E80022FFF2CFFC018091F2008823A1
+:2007400071F09F012F5F3F4FC9014091F10040836150710961157105C9F2F901EECFCF01D4
+:20076000D5CF8EB3882361F08EB3853059F08091E80080FFF6CF02C081E0089580E008955F
+:2007800082E0089583E0089542D044D01EBA10922502109224021092230284E089BD89B51C
+:2007A000826089BD09B400FEFDCF8091D800982F9F779093D80080688093D8008091630082
+:2007C0008E7F809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1008E7FC6
+:2007E0008093E1008091E20081608093E2008091E100877F8093E1008091E2008860809362
+:20080000E2000895C1DF81E08093260208951092E20008951092E10008951F920F920FB628
+:200820000F9211242F933F934F935F936F937F938F939F93AF93BF93EF93FF938091E10078
+:2008400080FF1BC08091E20080FF17C08091E1008E7F8093E1008091E2008E7F8093E2000D
+:200860008091E20080618093E2008091D80080628093D80019BC1EBAEBD18091E10084FF1B
+:2008800029C08091E20084FF25C084E089BD89B5826089BD09B400FEFDCF8091D8008F7D88
+:2008A0008093D8008091E1008F7E8093E1008091E2008F7E8093E2008091E200816080937E
+:2008C000E20080912502882311F084E001C081E08EBBBED18091E10083FF27C08091E200A6
+:2008E00083FF23C08091E100877F8093E10082E08EBB109225028091E1008E7F8093E10040
+:200900008091E2008E7F8093E2008091E20080618093E200E9DD42E060E080E0D2DD8091D1
+:20092000F00088608093F00093D18091E10082FF0AC08091E20082FF06C08091E1008B7F05
+:200940008093E10085D1FF91EF91BF91AF919F918F917F916F915F914F913F912F910F904E
+:200960000FBE0F901F9018951F920F920FB60F9211242F933F934F935F936F937F938F9324
+:200980009F93AF93BF93CF93EF93FF93E9EEF0E0C081C7701082E0EFF0E08081877F8083C1
+:2009A00078941CD0F894E9EEF0E01082A0EFB0E08C9188608C93C083FF91EF91CF91BF9134
+:2009C000AF919F918F917F916F915F914F913F912F910F900FBE0F901F9018951F93CF939C
+:2009E000DF93CDB7DEB7AA970FB6F894DEBF0FBECDBFE7E2F2E08091F100819322E0EF3210
+:200A0000F207C9F72091270230912802832F90E08A30910508F010C1FC01E65CFF4F89C245
+:200A2000203881F0223809F007C180912B0287708093E9008091EB0085FB882780F910925B
+:200A4000E90006C08091230290912402911182609091E800977F9093E8008093F100109216
+:200A6000F100BDC0822F8D7F09F0E6C0222319F0223061F0D2C080912902813009F0CDC0B6
+:200A8000333009F080E08093240228C080912902811124C020912B02277009F4BEC0209324
+:200AA000E9008091EB0080FFB8C08091EB00333011F4806211C080618093EB0081E090E093
+:200AC000022E01C0880F0A94EAF78093EA001092EA008091EB0088608093EB001092E90019
+:200AE0008091E800877F7EC02111A6C0109129028091E800877F8093E8000ADD8091E8007B
+:200B000080FD04C08EB38111F9CF87C0812F8F7711F093E001C092E09EBB80688093E3001E
+:200B20007CC02058223008F087C08091290290912A028C3D23E0920781F583E08A838AE230
+:200B400089834FB7F894DE01139620E03EE051E2E32FF0E050935700E49120FF03C0E29534
+:200B6000EF703F5FEF7090E39E0F9A3310F0E95C01C0E92F8E2F90E08D939D932F5F2431AE
+:200B800039F74FBF8091E800877F8093E8006AE270E0CE01019608DD11C0AE014F5F5F4F5A
+:200BA00060912B024EDC0097C1F12091E800277F2093E800BC0189819A814DDD8091E800C5
+:200BC0008B778093E80029C02038B1F58091E800877F8093E800809125028093F1008091EA
+:200BE000E8008E778093E80093DC17C0211124C090912902923088F48091E800877F809315
+:200C0000E8009093250284DC80912502882311F084E001C083E08EBB83DB8091E80083FFB4
+:200C20000DC08091EB0080628093EB008091E800877F8093E80002C076DBEFCFAA960FB63B
+:200C4000F894DEBF0FBECDBFDF91CF911F9108950895CF938EB3882359F0C091E900C77050
+:200C60001092E9008091E80083FDB8DEC093E900CF9108950895CF93DF93EC018091E8004A
+:200C800083FF5FC0888190E020912B0230912C022817390709F055C080912802813249F0B9
+:200CA00018F48032C9F04DC0823261F18332C9F148C080912702813A09F043C08091E80049
+:200CC000877F8093E80067E070E0CE010F966CDC8091E8008B7713C080912702813289F587
+:200CE0008091E800877F8093E80067E070E0CE010F9609DDCE011ADB8091E8008E77809334
+:200D0000E8001FC0809127028132D9F48091E800877F8093E800809129028D87CE0189DBD5
+:200D20000DC080912702813261F48091E800877F8093E80060912902CE019CDFDF91CF9174
+:200D4000E7CBDF91CF9108950F931F93CF93DF93EC01FC013D9689E0DF011D928A95E9F798
+:200D60002A813B818C81882311F014E001C010E00981C90198DB412F482B426061E8802F6A
+:200D8000A0DB882341F12E813F818885882311F014E001C010E00D81C90185DB412F482B93
+:200DA000426060E8802F8DDB8823A9F02A853B858C85882311F014E001C010E0C985C90105
+:200DC00072DB412F482B426061EC8C2FDF91CF911F910F9176CB80E0DF91CF911F910F9158
+:200DE0000895CF93C62F2EB32430E9F4FC014785508961897289452B462B472BA1F0818180
+:200E00008093E9008091E80085FF04C0C093F10080E00AC08091E8008E778093E80097DBBC
+:200E20008823A1F301C082E0CF9108952EB3243019F5FC014785508961897289452B462BA8
+:200E4000472BD1F081818093E9008091F200882389F09091E8008091E8008E778093E80038
+:200E600095FD08C074DB811108C08091E8008E778093E80080E0089582E008952EB3243045
+:200E800051F4FC014785508961897289452B462B472B09F0CBCF08952EB3243019F08FEF47
+:200EA0009FEF0895FC014785508961897289452B462B472BA1F385818093E9008091E8009E
+:200EC00082FFEDCF8091F200882321F02091F10030E002C02FEF3FEF8091F200811105C0FC
+:200EE0008091E8008B778093E800C9010895A1E21A2EAA1BBB1BFD010DC0AA1FBB1FEE1FB4
+:200F0000FF1FA217B307E407F50720F0A21BB30BE40BF50B661F771F881F991F1A9469F757
+:200F200060957095809590959B01AC01BD01CF010895EE0FFF1F0590F491E02D0994F8949E
+:200F4000FFCF00034000000440000002080000000000000000000000FFFFFFFFFFFFFFFF3A
+:200F6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF91
+:200F800020F0A21BB30BE40BF50B661F771F881F991F1A9469F760957095809590959B017F
+:200FA000AC01BD01CF010895F894FFCF00034000000440000002080000000000000000006E
+:200FC0000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2F
+:200FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11
+:20100000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0
+:20102000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD0
+:20104000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB0
+:20106000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFF52
+:202EA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF32
+:202EC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF12
+:202EE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF2
+:202F0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFD1
+:202F2000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFB1
+:202F4000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF91
+:202F6000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF71
+:202F8000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF51
+:202FA000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF31
+:202FC000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11
+:202FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF1
+:203000004BC0000064C0000062C0000060C000005EC000005CC000005AC0000058C00000D3
+:2030200056C0000054C0000052C00000CBC400004EC000004CC000004AC0000048C0000099
+:2030400046C0000044C0000042C0000040C000003EC000003CC000003AC0000038C0000078
+:2030600036C0000034C0000032C0000030C000002EC000002CC000002AC0000028C00000D8
+:2030800026C0000024C0000022C0000020C000001EC000001CC0000011241FBECFEFD2E068
+:2030A000DEBFCDBF11E0A0E0B1E0E4EBFCE302C005900D92A836B107D9F711E0A8E6B1E0CB
+:2030C00001C01D92A738B107E1F74FD3F1C598CF982F15C08091F200882371F48091E8002A
+:2030E0008B7F8093E80003C08EB3882351F08091E80082FFF9CF02C08091F1009150992338
+:2031000049F708952091760130917501809174019091730180936D0190936E01C901809368
+:203120006F0190937001089580917101843009F45AC0853030F4813059F0833009F0C3C09E
+:203140001FC0853009F4A0C0863009F0BCC0AFC080917201823008F0B6C0D4DF8091720109
+:20316000882361F480916D0190916E0123E0FC0120935700E89507B600FCFDCF85E008C007
+:2031800080917201882311F0823029F4BBDF89E0809301010895813009F095C020E030E06C
+:2031A00040E050E0F90184918F3F81F0CA01AA27BB2780936C0130936E0120936D018AE0B6
+:2031C0008093010185E08093690108952F5F3F4F4F4F5F4F2030F0E33F07F0E04F07F0E094
+:2031E0005F0701F7089580917201833051F581E0809368018091770190917801892B71F042
+:2032000080917301813009F05EC0809176019091750190936B0180936A0108958091730113
+:20322000882361F42CE088E190E00FB6F894A895809360000FBE2093600008951092000188
+:203240000895882309F03FC0809173018F3F09F03AC0E0E0F0E093E085E090935700E89589
+:2032600007B600FCFDCF80935700E89507B600FCFDCFE058FF4F20E3E030F20771F781E101
+:2032800080935700E8950895E091730180917201882321F4F0E0EB5FFE4F05C0813099F417
+:2032A000F0E0EE52FF4F808180937C01089580917201833041F480917301882321F48091C0
+:2032C000740180936C0108952F923F924F925F926F927F929F92AF92BF92CF92DF92EF92D0
+:2032E000FF920F931F93CF93DF938091850190918601909378018093770180917901882379
+:2033000051F08091790181508093790180917901882309F45D9A80917A01882351F08091D0
+:203320007A01815080937A0180917A01882309F45C9A80918001833009F4B2C1843030F4FC
+:20334000813071F0823009F0E3C111C1853009F4C5C1853008F4BAC1863009F0D9C1CDC1FF
+:203360005C9883E080937A018091E800877F8093E80080916801882329F0D6DE5D9A5C9A8F
+:203380001092680120917701309178012115310529F42AC08EB3882309F4BAC18091E800EF
+:2033A00082FFF8CF8091F10080937101215030403093780120937701E2E7F1E00CC080917F
+:2033C000F10081932150304081E0E737F80719F43183208308C08091F200882381F7309374
+:2033E000780120937701A0DE80910101853009F0BAC08091770190917801892B21F482E022
+:2034000080930101B0C08AE163DE80916D018F715FDEC0916F01D091700120916D0130914C
+:203420006E0121968E01021B130B219780917201882309F093C0180136942794C901A091D0
+:203440006C01B0E09C01AD0162E0E62EF12C012D112DE20EF31E041F151F59016A0190E0B8
+:2034600099249394B5E0A3E048C08091F200882371F48091E8008B7F8093E80004C08EB332
+:20348000882309F445C18091E80082FFF8CF0894210831088091F100682F8091F100782FFD
+:2034A000F5010B0190925700E89511249F5F903419F021143104A1F4F901B0935700E89504
+:2034C00007B600FCFDCF2114310451F0F701A0935700E89507B600FCFDCFA801970190E087
+:2034E00042E0442E512C612C712CE40CF51C061D171DA40CB51CC61CD71C2114310409F080
+:20350000B4CFD0936E01C0936D0181E180935700E89527C08091F200882371F48091E80059
+:203520008B7F8093E80004C08EB3882309F4F0C08091E80082FFF8CF6091F10080916D0187
+:2035400090916E01A7D380916D0190916E01019690936E0180936D010150104001151105DB
+:20356000C9F680E1B5DD8091E8008B7FC3C08091E800877F8093E8005D9883E08093790134
+:2035800004C08EB3882309F4C3C08091E80080FFF8CF80910101893091F08A3069F4809147
+:2035A0007201813049F480916D0190916E018093F1009093F1009BC080917C0196C0609153
+:2035C0006F017091700120916D0130916E016F5F7F4F7B01E21AF30A6150704080917201C4
+:2035E000882389F5870116950795C901A0916C01B0E09C01AD011FC08091F200803271F497
+:203600008091E8008E7F8093E80004C08EB3882309F47EC08091E80080FFF8CFF90185916F
+:2036200094918093F1009093F100015010402E5F3F4F4F4F5F4F01151105F1F670936E01C0
+:2036400060936D0129C0823039F523C08091F200803271F48091E8008E7F8093E80004C07E
+:203660008EB3882309F454C08091E80080FFF8CF00916D0110916E01C80104D38093F1005B
+:203680000F5F1F4F10936E0100936D010894E108F108E114F104D1F682E08093010127C0AE
+:2036A0008091E800877F8093E800809169018093F1001092F1001092F1001092F1008091C7
+:2036C00001018093F1001092F10011C08091E800877F8093E8001092690119C08091E800A8
+:2036E000877F8093E800809101018093F1008091E8008E7F8093E8000AC08091E800877FE8
+:203700008093E8005D9A5C9A82E08093010187D0DF91CF911F910F91FF90EF90DF90CF90F7
+:20372000BF90AF909F907F906F905F904F903F902F9008952BD181E085BF15BE089584B779
+:20374000877F84BF88E10FB6F89480936000109260000FBE81E085BF82E085BF8AB18063BB
+:203760008AB98BB180638BB90CC1E9DF789401C080D2809100018823D9F78091680188233D
+:20378000B9F7D8DFE0916A01F0916B010995FA01923071F0933089F0913029F488E091E04A
+:2037A00022E130E019C080E090E020E030E014C08AE191E02BE130E00FC0882339F48091B9
+:2037C0003501282F30E085E391E006C080913901282F30E089E391E091838083C9010895A0
+:2037E0008091EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881FC4
+:2038000008951092F4001092F0001092E8001092ED00EBEEF0E080818E7F80830895809162
+:203820007F0188238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B7F8093E8004D
+:2038400008958EB3882349F08091E80080FFF9CF8091E8008E7F8093E80008959C0140915A
+:203860008501509186014617570718F4F90120E038C06115710511F0AB01F8CF8091E80048
+:203880008E7F8093E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC071
+:2038A0008EB3882381F18EB3853079F18091E80080FF17C09091F20006C081918093F1000C
+:2038C000415050409F5F4115510511F09032A8F320E0903209F421E08091E8008E7F8093E6
+:2038E000E8004115510591F6222381F606C08EB3882349F08EB3853041F08091E80082FF65
+:20390000F6CF80E0089582E0089583E0089554D056D01EBA10927D0184E089BD89B58260DA
+:2039200089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809163008E7FA5
+:20394000809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1008E7F80930E
+:20396000E1008091E20081608093E2008091E100877F8093E1008091E20088608093E200E1
+:203980000895C5DF81E080937E010895C0DFE0EEF0E0808181608083E8EDF0E080818F7788
+:2039A00080830AD00CD019BCE3E6F0E080818160808310927E0108951092E200089510927A
+:2039C000E10008951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF936A
+:2039E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E100D9
+:203A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC5D
+:203A20001EBA26D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B431
+:203A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093B6
+:203A6000E2008091E20081608093E20080917D01882311F481E001C084E08EBBF9D08091B3
+:203A8000E10083FF22C08091E20083FF1EC08091E100877F8093E10082E08EBB10927D01D7
+:203AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200A1DED6
+:203AC00080E060E042E28CDED3D08091E10082FF0AC08091E20082FF06C08091E1008B7FA2
+:203AE0008093E100C5D0FF91EF91BF91AF919F918F917F916F915F914F913F912F910F903E
+:203B00000FBE0F901F9018951F93DF93CF9300D0CDB7DEB7EFE7F1E08091F100819381E050
+:203B2000E738F807C9F790917F0180918001853011F1863040F48130B9F0813070F08330B5
+:203B400009F081C011C0883009F453C0893009F462C0863009F077C02DC0903809F474C0EE
+:203B6000923809F070C070C0992309F46DC0923009F069C069C0992309F065C01091810132
+:203B80008091E800877F8093E80049DE04C08EB3882309F459C08091E80080FFF8CF812F4F
+:203BA0008F7711F492E001C093E09EBB80688093E3004AC09058923008F045C080918101D9
+:203BC0009091820160918301AE014F5F5F4FDFDDBC010097C9F18091E800877F8093E800FD
+:203BE00089819A813BDE8091E8008B7F8093E8002BC0903841F58091E800877F8093E800A6
+:203C000080917D018093F1008091E8008E7F8093E80005DE19C09923B1F49091810192308E
+:203C200098F48091E800877F8093E80090937D01F6DD80917D01882311F483E001C084E0C3
+:203C40008EBB16D001C040DB8091E80083FF0AC08091EB0080628093EB008091E800877F39
+:203C60008093E8000F900F90CF91DF911F91089508958EB3882329F08091E80083FF01C010
+:203C800043CF0895F999FECF92BD81BDF89A992780B50895262FF999FECF1FBA92BD81BD4B
+:203CA00020BD0FB6F894FA9AF99A0FBE01960895F894FFCF01021E948920DCFB12011001FB
+:203CC00000000020EB03EF2F00000001000109021B0001010080320904000000FE010200CE
+:203CE0000921030000000C0001040309042C03410054006D0065006700610031003600555C
+:1C3D00000032002000440046005500200020002000200020002000200000000096
+:00000001FF
diff --git a/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Mega2560-R3.hex b/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Mega2560-R3.hex
new file mode 100644
index 0000000..5393cf6
--- /dev/null
+++ b/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Mega2560-R3.hex
@@ -0,0 +1,248 @@
+:100000009EC00000B7C00000B5C00000B3C0000033
+:10001000B1C00000AFC00000ADC00000ABC0000028
+:10002000A9C00000A7C00000A5C00000FCC30000DC
+:10003000A1C400009FC000009DC000009BC0000044
+:1000400099C0000097C0000095C0000093C0000058
+:1000500091C000008FC000008DC00000C6C100002C
+:1000600089C0000087C0000085C0000083C0000078
+:1000700081C00000160538052206380522067A05DB
+:1000800097052206EA05FC052403470065006E007B
+:10009000750069006E006F0020004D00650067006C
+:1000A00061002000320035003600300000003A03C5
+:1000B000410072006400750069006E006F0020004E
+:1000C0004C004C00430020002800770077007700A8
+:1000D0002E00610072006400750069006E006F0000
+:1000E0002E006300630029000000040309040902D4
+:1000F0003E00020100C032090400000102020100BA
+:100100000524000110042402060524060001070549
+:1001100082030800FF09040100020A00000007052D
+:100120000402400001070583024000011201100192
+:10013000020000084123420201000102DC011124F7
+:100140001FBECFEFD2E0DEBFCDBF11E0A0E0B1E037
+:10015000EEE4FFE002C005900D92A631B107D9F799
+:1001600012E0A6E1B1E001C01D92AF32B107E1F7A4
+:1001700064D0EBC645CFFC01E058FF4FA081B181B0
+:100180006C93A081B1819D012F5F3F4F318320830C
+:100190002E173F0721F412969C938E9311972FB739
+:1001A000F894FC01EC57FF4F80818F5F80832FBF55
+:1001B0000895DC01AE57BF4FED91FC91119741912D
+:1001C0001196FC93EE939C0120583F4FE217F307E2
+:1001D00011F48D939C932FB7F894FC01EC57FF4FCB
+:1001E0009081915090832FBF842F089584B7877F8B
+:1001F00084BF88E10FB6F89480936000109260008D
+:100200000FBE87E690E09093CD008093CC0086E00F
+:100210008093CA001092C80088E18093C900539A65
+:100220005A9A8AB180638AB98BB180638BB9F0D254
+:1002300084E085BD5F9A579A0895D8DF2FB7F89468
+:100240008EE991E090931F0280931E029093210209
+:10025000809320022FBF2FB7F89489E191E090930B
+:100260009A018093990190939C0180939B012FBFE9
+:100270007894D3E09FB7F894809122029FBF803892
+:1002800049F080E091E00ED697FD04C0682F8EE91A
+:1002900091E071DF8FB7F894C0919D018FBFA8994D
+:1002A00002C0C13658F1A89A80919D01882319F0A7
+:1002B0005D98D0931601CC2349F089E191E079DF74
+:1002C000682F80E091E093D5C150F5CF8091160161
+:1002D000882341F08091160181508093160181118D
+:1002E00001C05D9A80911701882341F08091170128
+:1002F000815080931701811101C05C9A9FB7F894D7
+:10030000809122029FBF882361F08EE991E051DF46
+:100310009091C80095FFFCCF8093CE005C98D0935D
+:10032000170180E091E0B0D59AD4A4CF80E091E0AD
+:1003300011C580E091E0A5C41F93CF93DF93EC013A
+:100340008C89813031F0823011F010E003C010E26E
+:1003500001C010E38B89823009F418608D898730E1
+:1003600031F0883031F0863029F4126003C0146017
+:1003700001C016601092C9001092C8001092CA0005
+:100380002F85388949895A89211581EE3807410519
+:10039000510571F0CA01B9019695879577956795D2
+:1003A00060587B47814E9F4FA8D52150310902C02C
+:1003B00020E130E03093CD002093CC001093CA00B0
+:1003C0008F859889A989BA898115914EA105B105B2
+:1003D00011F480E001C082E08093C80088E9809336
+:1003E000C900DF91CF911F9108951F920F920FB610
+:1003F0000F9211242F933F934F935F936F937F93AB
+:100400008F939F93AF93BF93EF93FF936091CE0031
+:100410008EB3843019F489E191E0ADDEFF91EF9164
+:10042000BF91AF919F918F917F916F915F914F910C
+:100430003F912F910F900FBE0F901F901895FC01C8
+:10044000858580FF02C05F9808955F9A0895292FDF
+:1004500033272230310559F02330310569F021303E
+:100460003105F9F482E190E02CE231E01EC08EE328
+:1004700090E02EEE30E019C099278130910541F0CF
+:100480008230910541F0892B61F4EAEEF0E005C07D
+:10049000EEEAF0E002C0E8E8F0E0849190E09F012D
+:1004A00004C080E090E020E030E0FA013183208356
+:1004B000089528E030E040E02817390720F44F5F26
+:1004C000220F331FF9CF842F8295807F0895809368
+:1004D000E900EBEEF0E0808181608083EDEEF0E0FA
+:1004E00010826093EC0040838091EE00881F882783
+:1004F000881F08951092F40080E08093E900109224
+:10050000F0001092E8001092ED009091EB009E7FB9
+:100510009093EB008F5F853081F7089580912702DB
+:1005200087FD05C08091E80080FF0DC010C080915C
+:10053000E80082FD04C08EB38111F9CF0895809147
+:10054000E8008B7707C08EB38111ECCF08958091BE
+:10055000E8008E778093E800089585E69091EC009E
+:1005600090FF05C09091E80090FF05C01BC09091DE
+:10057000E80092FD17C09EB39923B1F09EB3953069
+:10058000A9F09091EB0095FD13C09091E10092FFCE
+:10059000E5CF9091E1009B7F9093E1008150F1F6CF
+:1005A00084E0089580E0089582E0089583E008954E
+:1005B00081E0089520912D0230912E0226173707F1
+:1005C00048F06115710539F42091E8002E772093E9
+:1005D000E80001C0B90130E06115710591F1209189
+:1005E000E80023FD38C02091E80022FF06C080917A
+:1005F000E80082FF29C080E008952EB3222369F12C
+:100600002EB3253061F12091E80020FFE5CF209145
+:10061000F200FC01CF016115710549F0283038F472
+:1006200081918093F100615071092F5FF3CF31E028
+:10063000283009F030E02091E8002E772093E80080
+:10064000CBCF3111CCCFD3CF8EB3882331F08EB343
+:10065000853069F604C081E0089582E0089583E062
+:10066000089520912D0230912E022617370748F069
+:100670006115710539F42091E8002E772093E80088
+:1006800001C0B90130E06115710599F12091E800D0
+:1006900023FD39C02091E80022FF06C08091E800C8
+:1006A00082FF2AC080E008952EB3222371F12EB379
+:1006B000253069F12091E80020FFE5CF2091F2007C
+:1006C000FC01CF016115710551F0283040F484918F
+:1006D0008093F100615071092F5F3196F2CF31E0C4
+:1006E000283009F030E02091E8002E772093E800D0
+:1006F000CACF3111CBCFD2CF8EB3882331F08EB396
+:10070000853061F604C081E0089582E0089583E0B9
+:1007100008956115710529F42091E8002B77209345
+:10072000E8006115710549F12091E80023FD2AC018
+:100730002EB3222359F12EB3253051F12091E80038
+:1007400022FFF2CFFC018091F200882371F09F011B
+:100750002F5F3F4FC9014091F10040836150710903
+:1007600061157105C9F2F901EECFCF01D5CF8EB376
+:10077000882361F08EB3853059F08091E80080FFC6
+:10078000F6CF02C081E0089580E0089582E00895E8
+:1007900083E0089542D044D01EBA109225021092F0
+:1007A00024021092230284E089BD89B5826089BD4C
+:1007B00009B400FEFDCF8091D800982F9F779093C9
+:1007C000D80080688093D800809163008E7F8093EA
+:1007D00063008091D8008F7D8093D8008091E000E5
+:1007E0008E7F8093E0008091E1008E7F8093E10016
+:1007F0008091E20081608093E2008091E100877F38
+:100800008093E1008091E20088608093E200089587
+:10081000C1DF81E08093260208951092E2000895DE
+:100820001092E10008951F920F920FB60F921124BB
+:100830002F933F934F935F936F937F938F939F93E8
+:10084000AF93BF93EF93FF938091E10080FF1BC0B4
+:100850008091E20080FF17C08091E1008E7F80933D
+:10086000E1008091E2008E7F8093E2008091E200BF
+:1008700080618093E2008091D80080628093D800EC
+:1008800019BC1EBAEBD18091E10084FF29C0809190
+:10089000E20084FF25C084E089BD89B5826089BDFE
+:1008A00009B400FEFDCF8091D8008F7D8093D800E1
+:1008B0008091E1008F7E8093E1008091E2008F7E45
+:1008C0008093E2008091E20081608093E200809159
+:1008D0002502882311F084E001C081E08EBBBED1E7
+:1008E0008091E10083FF27C08091E20083FF23C055
+:1008F0008091E100877F8093E10082E08EBB1092BF
+:1009000025028091E1008E7F8093E1008091E200DA
+:100910008E7F8093E2008091E20080618093E2000C
+:10092000E9DD42E060E080E0D2DD8091F0008860A7
+:100930008093F00093D18091E10082FF0AC0809102
+:10094000E20082FF06C08091E1008B7F8093E1008E
+:1009500085D1FF91EF91BF91AF919F918F917F9141
+:100960006F915F914F913F912F910F900FBE0F901C
+:100970001F9018951F920F920FB60F9211242F936C
+:100980003F934F935F936F937F938F939F93AF9317
+:10099000BF93CF93EF93FF93E9EEF0E0C081C77070
+:1009A0001082E0EFF0E08081877F808378941CD014
+:1009B000F894E9EEF0E01082A0EFB0E08C9188604E
+:1009C0008C93C083FF91EF91CF91BF91AF919F9195
+:1009D0008F917F916F915F914F913F912F910F90E8
+:1009E0000FBE0F901F9018951F93CF93DF93CDB735
+:1009F000DEB7AA970FB6F894DEBF0FBECDBFE7E211
+:100A0000F2E08091F100819322E0EF32F207C9F722
+:100A10002091270230912802832F90E08A3091059F
+:100A200008F010C1FC01E65CFF4F89C2203881F05C
+:100A3000223809F007C180912B0287708093E9006A
+:100A40008091EB0085FB882780F91092E90006C0B1
+:100A50008091230290912402911182609091E8008C
+:100A6000977F9093E8008093F1001092F100BDC051
+:100A7000822F8D7F09F0E6C0222319F0223061F029
+:100A8000D2C080912902813009F0CDC0333009F005
+:100A900080E08093240228C080912902811124C023
+:100AA00020912B02277009F4BEC02093E9008091A9
+:100AB000EB0080FFB8C08091EB00333011F480620E
+:100AC00011C080618093EB0081E090E0022E01C0B4
+:100AD000880F0A94EAF78093EA001092EA00809166
+:100AE000EB0088608093EB001092E9008091E800B1
+:100AF000877F7EC02111A6C0109129028091E80055
+:100B0000877F8093E8000ADD8091E80080FD04C0C3
+:100B10008EB38111F9CF87C0812F8F7711F093E0C9
+:100B200001C092E09EBB80688093E3007CC02058A7
+:100B3000223008F087C08091290290912A028C3DD2
+:100B400023E0920781F583E08A838AE289834FB7A5
+:100B5000F894DE01139620E03EE051E2E32FF0E04E
+:100B600050935700E49120FF03C0E295EF703F5F80
+:100B7000EF7090E39E0F9A3310F0E95C01C0E92F0B
+:100B80008E2F90E08D939D932F5F243139F74FBFC7
+:100B90008091E800877F8093E8006AE270E0CE01F0
+:100BA000019608DD11C0AE014F5F5F4F60912B02CF
+:100BB0004EDC0097C1F12091E800277F2093E800E8
+:100BC000BC0189819A814DDD8091E8008B7780930B
+:100BD000E80029C02038B1F58091E800877F809334
+:100BE000E800809125028093F1008091E8008E77E3
+:100BF0008093E80093DC17C0211124C09091290252
+:100C0000923088F48091E800877F8093E800909389
+:100C1000250284DC80912502882311F084E001C044
+:100C200083E08EBB83DB8091E80083FF0DC0809161
+:100C3000EB0080628093EB008091E800877F8093D7
+:100C4000E80002C076DBEFCFAA960FB6F894DEBFBD
+:100C50000FBECDBFDF91CF911F9108950895CF931F
+:100C60008EB3882359F0C091E900C7701092E90053
+:100C70008091E80083FDB8DEC093E900CF9108952C
+:100C80000895CF93DF93EC018091E80083FF5FC06C
+:100C9000888190E020912B0230912C02281739078F
+:100CA00009F055C080912802813249F018F4803251
+:100CB000C9F04DC0823261F18332C9F148C08091E0
+:100CC0002702813A09F043C08091E800877F809332
+:100CD000E80067E070E0CE010F966CDC8091E800E0
+:100CE0008B7713C080912702813289F58091E800CB
+:100CF000877F8093E80067E070E0CE010F9609DD02
+:100D0000CE011ADB8091E8008E778093E8001FC047
+:100D1000809127028132D9F48091E800877F809307
+:100D2000E800809129028D87CE0189DB0DC080917A
+:100D30002702813261F48091E800877F8093E80088
+:100D400060912902CE019CDFDF91CF91E7CBDF914B
+:100D5000CF9108950F931F93CF93DF93EC01FC0184
+:100D60003D9689E0DF011D928A95E9F72A813B8152
+:100D70008C81882311F014E001C010E00981C901C1
+:100D800098DB412F482B426061E8802FA0DB88234D
+:100D900041F12E813F818885882311F014E001C044
+:100DA00010E00D81C90185DB412F482B426060E8CE
+:100DB000802F8DDB8823A9F02A853B858C858823AD
+:100DC00011F014E001C010E0C985C90172DB412FA8
+:100DD000482B426061EC8C2FDF91CF911F910F91D6
+:100DE00076CB80E0DF91CF911F910F910895CF9343
+:100DF000C62F2EB32430E9F4FC0147855089618960
+:100E00007289452B462B472BA1F081818093E90005
+:100E10008091E80085FF04C0C093F10080E00AC023
+:100E20008091E8008E778093E80097DB8823A1F318
+:100E300001C082E0CF9108952EB3243019F5FC0152
+:100E40004785508961897289452B462B472BD1F004
+:100E500081818093E9008091F200882389F090914C
+:100E6000E8008091E8008E778093E80095FD08C047
+:100E700074DB811108C08091E8008E778093E800D0
+:100E800080E0089582E008952EB3243051F4FC01EF
+:100E90004785508961897289452B462B472B09F07C
+:100EA000CBCF08952EB3243019F08FEF9FEF089524
+:100EB000FC014785508961897289452B462B472B58
+:100EC000A1F385818093E9008091E80082FFEDCF56
+:100ED0008091F200882321F02091F10030E002C0DF
+:100EE0002FEF3FEF8091F200811105C08091E80063
+:100EF0008B778093E800C9010895A1E21A2EAA1BFE
+:100F0000BB1BFD010DC0AA1FBB1FEE1FFF1FA217B9
+:100F1000B307E407F50720F0A21BB30BE40BF50BB6
+:100F2000661F771F881F991F1A9469F7609570953F
+:100F3000809590959B01AC01BD01CF010895EE0F06
+:0E0F4000FF1F0590F491E02D0994F894FFCF67
+:100F4E000003400000044000000208000000000002
+:060F5E000000000000008D
+:00000001FF
diff --git a/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Uno-R3.hex b/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Uno-R3.hex
new file mode 100644
index 0000000..3abf6ad
--- /dev/null
+++ b/firmwares/atmegaxxu2/arduino-usbserial/Genuino-usbserial-atmega16u2-Uno-R3.hex
@@ -0,0 +1,248 @@
+:1000000098C00000B1C00000AFC00000ADC000004B
+:10001000ABC00000A9C00000A7C00000A5C0000040
+:10002000A3C00000A1C000009FC00000F6C30000F4
+:100030009BC4000099C0000097C0000095C000005C
+:1000400093C0000091C000008FC000008DC0000070
+:100050008BC0000089C0000087C00000C0C1000044
+:1000600083C0000081C000007FC000007DC0000090
+:100070007BC00000100532051C0632051C06740505
+:1000800091051C06E405F6051803470065006E009F
+:10009000750069006E006F00200055006E006F0053
+:1000A00000003A03410072006400750069006E00B0
+:1000B0006F0020004C004C00430020002800770017
+:1000C000770077002E0061007200640075006900FF
+:1000D0006E006F002E00630063002900000004031F
+:1000E000090409023E00020100C0320904000001B7
+:1000F0000202010005240001100424020605240662
+:100100000001070582030800FF09040100020A003C
+:1001100000000705040240000107058302400001BA
+:1001200012011001020000084123430201000102F4
+:10013000DC0111241FBECFEFD2E0DEBFCDBF11E046
+:10014000A0E0B1E0E2E4FFE002C005900D92A6312C
+:10015000B107D9F712E0A6E1B1E001C01D92AF32BC
+:10016000B107E1F764D0EBC64BCFFC01E058FF4F7D
+:10017000A081B1816C93A081B1819D012F5F3F4F20
+:10018000318320832E173F0721F412969C938E9380
+:1001900011972FB7F894FC01EC57FF4F80818F5FC8
+:1001A00080832FBF0895DC01AE57BF4FED91FC91C6
+:1001B000119741911196FC93EE939C0120583F4F6B
+:1001C000E217F30711F48D939C932FB7F894FC0179
+:1001D000EC57FF4F9081915090832FBF842F08954B
+:1001E00084B7877F84BF88E10FB6F894809360005E
+:1001F000109260000FBE87E690E09093CD00809350
+:10020000CC0086E08093CA001092C80088E18093F9
+:10021000C900539A5A9A8AB180638AB98BB18063B4
+:100220008BB9F0D284E085BD5F9A579A0895D8DFE4
+:100230002FB7F8948EE991E090931F0280931E02ED
+:1002400090932102809320022FBF2FB7F89489E169
+:1002500091E090939A018093990190939C018093EF
+:100260009B012FBF7894D3E09FB7F894809122022E
+:100270009FBF803849F080E091E00ED697FD04C022
+:10028000682F8EE991E071DF8FB7F894C0919D01DE
+:100290008FBFA89902C0C13658F1A89A80919D01DC
+:1002A000882319F05D98D0931601CC2349F089E199
+:1002B00091E079DF682F80E091E093D5C150F5CFD0
+:1002C00080911601882341F080911601815080931E
+:1002D0001601811101C05D9A80911701882341F0B8
+:1002E00080911701815080931701811101C05C9AA0
+:1002F0009FB7F894809122029FBF882361F08EE916
+:1003000091E051DF9091C80095FFFCCF8093CE0023
+:100310005C98D093170180E091E0B0D59AD4A4CF37
+:1003200080E091E011C580E091E0A5C41F93CF93D8
+:10033000DF93EC018C89813031F0823011F010E0D4
+:1003400003C010E201C010E38B89823009F4186009
+:100350008D89873031F0883031F0863029F4126091
+:1003600003C0146001C016601092C9001092C8004A
+:100370001092CA002F85388949895A89211581EE42
+:1003800038074105510571F0CA01B9019695879565
+:100390007795679560587B47814E9F4FA8D5215030
+:1003A000310902C020E130E03093CD002093CC0031
+:1003B0001093CA008F859889A989BA898115914EB1
+:1003C000A105B10511F480E001C082E08093C8006E
+:1003D00088E98093C900DF91CF911F9108951F9202
+:1003E0000F920FB60F9211242F933F934F935F9369
+:1003F0006F937F938F939F93AF93BF93EF93FF93ED
+:100400006091CE008EB3843019F489E191E0ADDEC5
+:10041000FF91EF91BF91AF919F918F917F916F91DC
+:100420005F914F913F912F910F900FBE0F901F90B2
+:100430001895FC01858580FF02C05F9808955F9A3A
+:100440000895292F33272230310559F02330310503
+:1004500069F021303105F9F482E190E020E231E0E9
+:100460001EC08EE390E022EE30E019C09927813063
+:10047000910541F08230910541F0892B61F4EEED58
+:10048000F0E005C0E2EAF0E002C0E8E8F0E08491C4
+:1004900090E09F0104C080E090E020E030E0FA01AD
+:1004A00031832083089528E030E040E028173907A1
+:1004B00020F44F5F220F331FF9CF842F8295807F66
+:1004C00008958093E900EBEEF0E080818160808305
+:1004D000EDEEF0E010826093EC0040838091EE003E
+:1004E000881F8827881F08951092F40080E0809369
+:1004F000E9001092F0001092E8001092ED00909147
+:10050000EB009E7F9093EB008F5F853081F708951D
+:100510008091270287FD05C08091E80080FF0DC013
+:1005200010C08091E80082FD04C08EB38111F9CF24
+:1005300008958091E8008B7707C08EB38111ECCFCE
+:1005400008958091E8008E778093E800089585E60D
+:100550009091EC0090FF05C09091E80090FF05C0DD
+:100560001BC09091E80092FD17C09EB39923B1F093
+:100570009EB39530A9F09091EB0095FD13C090913A
+:10058000E10092FFE5CF9091E1009B7F9093E10025
+:100590008150F1F684E0089580E0089582E00895A6
+:1005A00083E0089581E0089520912D0230912E027C
+:1005B0002617370748F06115710539F42091E800D6
+:1005C0002E772093E80001C0B90130E06115710574
+:1005D00091F12091E80023FD38C02091E80022FF2E
+:1005E00006C08091E80082FF29C080E008952EB304
+:1005F000222369F12EB3253061F12091E80020FF1C
+:10060000E5CF2091F200FC01CF016115710549F0A1
+:10061000283038F481918093F100615071092F5F87
+:10062000F3CF31E0283009F030E02091E8002E7758
+:100630002093E800CBCF3111CCCFD3CF8EB388231A
+:1006400031F08EB3853069F604C081E0089582E010
+:10065000089583E0089520912D0230912E022617EF
+:10066000370748F06115710539F42091E8002E77BD
+:100670002093E80001C0B90130E06115710599F1DE
+:100680002091E80023FD39C02091E80022FF06C038
+:100690008091E80082FF2AC080E008952EB32223D3
+:1006A00071F12EB3253069F12091E80020FFE5CFEC
+:1006B0002091F200FC01CF016115710551F0283045
+:1006C00040F484918093F100615071092F5F31965D
+:1006D000F2CF31E0283009F030E02091E8002E77A9
+:1006E0002093E800CACF3111CBCFD2CF8EB388236D
+:1006F00031F08EB3853061F604C081E0089582E068
+:10070000089583E008956115710529F42091E800AA
+:100710002B772093E8006115710549F12091E800DD
+:1007200023FD2AC02EB3222359F12EB3253051F1D7
+:100730002091E80022FFF2CFFC018091F200882393
+:1007400071F09F012F5F3F4FC9014091F10040833D
+:100750006150710961157105C9F2F901EECFCF0140
+:10076000D5CF8EB3882361F08EB3853059F0809158
+:10077000E80080FFF6CF02C081E0089580E0089590
+:1007800082E0089583E0089542D044D01EBA1092CA
+:100790002502109224021092230284E089BD89B5BB
+:1007A000826089BD09B400FEFDCF8091D800982FEA
+:1007B0009F779093D80080688093D80080916300E1
+:1007C0008E7F809363008091D8008F7D8093D800C6
+:1007D0008091E0008E7F8093E0008091E1008E7F29
+:1007E0008093E1008091E20081608093E20080913B
+:1007F000E100877F8093E1008091E2008860809330
+:10080000E2000895C1DF81E08093260208951092EE
+:10081000E20008951092E10008951F920F920FB622
+:100820000F9211242F933F934F935F936F937F9376
+:100830008F939F93AF93BF93EF93FF938091E100CA
+:1008400080FF1BC08091E20080FF17C08091E10013
+:100850008E7F8093E1008091E2008E7F8093E200A2
+:100860008091E20080618093E2008091D8008062F4
+:100870008093D80019BC1EBAEBD18091E10084FFAF
+:1008800029C08091E20084FF25C084E089BD89B53C
+:10089000826089BD09B400FEFDCF8091D8008F7DB4
+:1008A0008093D8008091E1008F7E8093E100809159
+:1008B000E2008F7E8093E2008091E200816080936D
+:1008C000E20080912502882311F084E001C081E0DC
+:1008D0008EBBBED18091E10083FF27C08091E200F2
+:1008E00083FF23C08091E100877F8093E10082E055
+:1008F0008EBB109225028091E1008E7F8093E100F3
+:100900008091E2008E7F8093E2008091E20080611E
+:100910008093E200E9DD42E060E080E0D2DD80919A
+:10092000F00088608093F00093D18091E10082FF15
+:100930000AC08091E20082FF06C08091E1008B7FB7
+:100940008093E10085D1FF91EF91BF91AF919F918D
+:100950008F917F916F915F914F913F912F910F9068
+:100960000FBE0F901F9018951F920F920FB60F9207
+:1009700011242F933F934F935F936F937F938F93A4
+:100980009F93AF93BF93CF93EF93FF93E9EEF0E084
+:10099000C081C7701082E0EFF0E08081877F8083A4
+:1009A00078941CD0F894E9EEF0E01082A0EFB0E06B
+:1009B0008C9188608C93C083FF91EF91CF91BF9110
+:1009C000AF919F918F917F916F915F914F913F91E7
+:1009D0002F910F900FBE0F901F9018951F93CF93DC
+:1009E000DF93CDB7DEB7AA970FB6F894DEBF0FBE80
+:1009F000CDBFE7E2F2E08091F100819322E0EF3297
+:100A0000F207C9F72091270230912802832F90E046
+:100A10008A30910508F010C1FC01E65CFF4F89C2E5
+:100A2000203881F0223809F007C180912B028770AD
+:100A30008093E9008091EB0085FB882780F9109274
+:100A4000E90006C0809123029091240291118260F6
+:100A50009091E800977F9093E8008093F1001092C6
+:100A6000F100BDC0822F8D7F09F0E6C0222319F06E
+:100A7000223061F0D2C080912902813009F0CDC0CE
+:100A8000333009F080E08093240228C0809129024D
+:100A9000811124C020912B02277009F4BEC020933D
+:100AA000E9008091EB0080FFB8C08091EB0033300B
+:100AB00011F4806211C080618093EB0081E090E0CE
+:100AC000022E01C0880F0A94EAF78093EA00109280
+:100AD000EA008091EB0088608093EB001092E900BF
+:100AE0008091E800877F7EC02111A6C01091290265
+:100AF0008091E800877F8093E8000ADD8091E8001C
+:100B000080FD04C08EB38111F9CF87C0812F8F770C
+:100B100011F093E001C092E09EBB80688093E300F7
+:100B20007CC02058223008F087C080912902909123
+:100B30002A028C3D23E0920781F583E08A838AE2D2
+:100B400089834FB7F894DE01139620E03EE051E22E
+:100B5000E32FF0E050935700E49120FF03C0E295AB
+:100B6000EF703F5FEF7090E39E0F9A3310F0E95CF7
+:100B700001C0E92F8E2F90E08D939D932F5F24313C
+:100B800039F74FBF8091E800877F8093E8006AE2E1
+:100B900070E0CE01019608DD11C0AE014F5F5F4FDE
+:100BA00060912B024EDC0097C1F12091E800277F75
+:100BB0002093E800BC0189819A814DDD8091E80095
+:100BC0008B778093E80029C02038B1F58091E80048
+:100BD000877F8093E800809125028093F1008091C7
+:100BE000E8008E778093E80093DC17C0211124C0C1
+:100BF00090912902923088F48091E800877F809359
+:100C0000E8009093250284DC80912502882311F06E
+:100C100084E001C083E08EBB83DB8091E80083FF2A
+:100C20000DC08091EB0080628093EB008091E80022
+:100C3000877F8093E80002C076DBEFCFAA960FB6DD
+:100C4000F894DEBF0FBECDBFDF91CF911F91089505
+:100C50000895CF938EB3882359F0C091E900C770EF
+:100C60001092E9008091E80083FDB8DEC093E900AE
+:100C7000CF9108950895CF93DF93EC018091E80020
+:100C800083FF5FC0888190E020912B0230912C027D
+:100C90002817390709F055C080912802813249F0A0
+:100CA00018F48032C9F04DC0823261F18332C9F14B
+:100CB00048C080912702813A09F043C08091E80042
+:100CC000877F8093E80067E070E0CE010F966CDCD0
+:100CD0008091E8008B7713C080912702813289F5DB
+:100CE0008091E800877F8093E80067E070E0CE01A4
+:100CF0000F9609DDCE011ADB8091E8008E77809394
+:100D0000E8001FC0809127028132D9F48091E80069
+:100D1000877F8093E800809129028D87CE0189DB4F
+:100D20000DC080912702813261F48091E800877FB5
+:100D30008093E80060912902CE019CDFDF91CF9182
+:100D4000E7CBDF91CF9108950F931F93CF93DF935C
+:100D5000EC01FC013D9689E0DF011D928A95E9F7DF
+:100D60002A813B818C81882311F014E001C010E0BE
+:100D70000981C90198DB412F482B426061E8802F2F
+:100D8000A0DB882341F12E813F818885882311F0E3
+:100D900014E001C010E00D81C90185DB412F482B13
+:100DA000426060E8802F8DDB8823A9F02A853B858F
+:100DB0008C85882311F014E001C010E0C985C901B9
+:100DC00072DB412F482B426061EC8C2FDF91CF9179
+:100DD0001F910F9176CB80E0DF91CF911F910F9102
+:100DE0000895CF93C62F2EB32430E9F4FC01478534
+:100DF000508961897289452B462B472BA1F081814F
+:100E00008093E9008091E80085FF04C0C093F10061
+:100E100080E00AC08091E8008E778093E80097DB3D
+:100E20008823A1F301C082E0CF9108952EB324302E
+:100E300019F5FC014785508961897289452B462B3C
+:100E4000472BD1F081818093E9008091F2008823C3
+:100E500089F09091E8008091E8008E778093E80017
+:100E600095FD08C074DB811108C08091E8008E7781
+:100E70008093E80080E0089582E008952EB3243046
+:100E800051F4FC014785508961897289452B462BB5
+:100E9000472B09F0CBCF08952EB3243019F08FEFF4
+:100EA0009FEF0895FC014785508961897289452B20
+:100EB000462B472BA1F385818093E9008091E800C0
+:100EC00082FFEDCF8091F200882321F02091F10084
+:100ED00030E002C02FEF3FEF8091F200811105C09A
+:100EE0008091E8008B778093E800C9010895A1E222
+:100EF0001A2EAA1BBB1BFD010DC0AA1FBB1FEE1F94
+:100F0000FF1FA217B307E407F50720F0A21BB30BDE
+:100F1000E40BF50B661F771F881F991F1A9469F75A
+:100F200060957095809590959B01AC01BD01CF01B6
+:100F30000895EE0FFF1F0590F491E02D0994F894A9
+:020F4000FFCFE1
+:100F4200000340000004400000020800000000000E
+:060F520000000000000099
+:00000001FF
diff --git a/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino b/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino
index 73d64a7..8b5121c 100644
--- a/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino
+++ b/libraries/EEPROM/examples/eeprom_clear/eeprom_clear.ino
@@ -11,7 +11,9 @@
#include <EEPROM.h>
void setup() {
-
+ // initialize the LED pin as an output.
+ pinMode(13, OUTPUT);
+
/***
Iterate through each byte of the EEPROM storage.
diff --git a/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino b/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
index d14b4b3..c6db85c 100644
--- a/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
+++ b/libraries/EEPROM/examples/eeprom_crc/eeprom_crc.ino
@@ -15,7 +15,7 @@ void setup() {
//Start serial
Serial.begin(9600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
//Print length of data to run CRC on.
@@ -49,4 +49,4 @@ unsigned long eeprom_crc(void) {
crc = ~crc;
}
return crc;
-} \ No newline at end of file
+}
diff --git a/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino b/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
index bbebc48..a07cee7 100644
--- a/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
+++ b/libraries/EEPROM/examples/eeprom_get/eeprom_get.ino
@@ -24,7 +24,7 @@ void setup() {
Serial.begin(9600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
Serial.print("Read float from EEPROM: ");
@@ -65,4 +65,4 @@ void secondTest() {
void loop() {
/* Empty loop */
-} \ No newline at end of file
+}
diff --git a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
index fe8a9fb..c1ba0a5 100644
--- a/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
+++ b/libraries/EEPROM/examples/eeprom_put/eeprom_put.ino
@@ -26,7 +26,7 @@ void setup() {
Serial.begin(9600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
float f = 123.456f; //Variable to store in EEPROM.
@@ -55,4 +55,4 @@ void setup() {
void loop() {
/* Empty loop */
-} \ No newline at end of file
+}
diff --git a/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino b/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
index 25bc5d9..a8a3510 100644
--- a/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
+++ b/libraries/EEPROM/examples/eeprom_read/eeprom_read.ino
@@ -16,7 +16,7 @@ void setup() {
// initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
}
diff --git a/libraries/EEPROM/library.properties b/libraries/EEPROM/library.properties
index 21437ff..dfa46cd 100644
--- a/libraries/EEPROM/library.properties
+++ b/libraries/EEPROM/library.properties
@@ -2,8 +2,9 @@ name=EEPROM
version=2.0
author=Arduino, Christopher Andrews
maintainer=Arduino <info@arduino.cc>
-sentence=Enables reading and writing to the permanent board storage. For all Arduino boards BUT Arduino DUE.
+sentence=Enables reading and writing to the permanent board storage. For all Arduino boards BUT Arduino DUE and Arduino ZERO.
paragraph=
+category=Data Storage
url=http://www.arduino.cc/en/Reference/EEPROM
architectures=avr
diff --git a/libraries/HID/HID.cpp b/libraries/HID/HID.cpp
new file mode 100644
index 0000000..21ede26
--- /dev/null
+++ b/libraries/HID/HID.cpp
@@ -0,0 +1,162 @@
+/*
+ Copyright (c) 2015, Arduino LLC
+ Original code (pre-library): Copyright (c) 2011, Peter Barrett
+
+ Permission to use, copy, modify, and/or distribute this software for
+ any purpose with or without fee is hereby granted, provided that the
+ above copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
+ */
+
+#include "HID.h"
+
+#if defined(USBCON)
+
+HID_& HID()
+{
+ static HID_ obj;
+ return obj;
+}
+
+int HID_::getInterface(uint8_t* interfaceCount)
+{
+ *interfaceCount += 1; // uses 1
+ HIDDescriptor hidInterface = {
+ D_INTERFACE(pluggedInterface, 1, USB_DEVICE_CLASS_HUMAN_INTERFACE, HID_SUBCLASS_NONE, HID_PROTOCOL_NONE),
+ D_HIDREPORT(descriptorSize),
+ D_ENDPOINT(USB_ENDPOINT_IN(pluggedEndpoint), USB_ENDPOINT_TYPE_INTERRUPT, USB_EP_SIZE, 0x01)
+ };
+ return USB_SendControl(0, &hidInterface, sizeof(hidInterface));
+}
+
+int HID_::getDescriptor(USBSetup& setup)
+{
+ // Check if this is a HID Class Descriptor request
+ if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; }
+ if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; }
+
+ // In a HID Class Descriptor wIndex cointains the interface number
+ if (setup.wIndex != pluggedInterface) { return 0; }
+
+ int total = 0;
+ HIDSubDescriptor* node;
+ for (node = rootNode; node; node = node->next) {
+ int res = USB_SendControl(TRANSFER_PGM, node->data, node->length);
+ if (res == -1)
+ return -1;
+ total += res;
+ }
+
+ // Reset the protocol on reenumeration. Normally the host should not assume the state of the protocol
+ // due to the USB specs, but Windows and Linux just assumes its in report mode.
+ protocol = HID_REPORT_PROTOCOL;
+
+ return total;
+}
+
+uint8_t HID_::getShortName(char *name)
+{
+ name[0] = 'H';
+ name[1] = 'I';
+ name[2] = 'D';
+ name[3] = 'A' + (descriptorSize & 0x0F);
+ name[4] = 'A' + ((descriptorSize >> 4) & 0x0F);
+ return 5;
+}
+
+void HID_::AppendDescriptor(HIDSubDescriptor *node)
+{
+ if (!rootNode) {
+ rootNode = node;
+ } else {
+ HIDSubDescriptor *current = rootNode;
+ while (current->next) {
+ current = current->next;
+ }
+ current->next = node;
+ }
+ descriptorSize += node->length;
+}
+
+int HID_::SendReport(uint8_t id, const void* data, int len)
+{
+ auto ret = USB_Send(pluggedEndpoint, &id, 1);
+ if (ret < 0) return ret;
+ auto ret2 = USB_Send(pluggedEndpoint | TRANSFER_RELEASE, data, len);
+ if (ret2 < 0) return ret2;
+ return ret + ret2;
+}
+
+bool HID_::setup(USBSetup& setup)
+{
+ if (pluggedInterface != setup.wIndex) {
+ return false;
+ }
+
+ uint8_t request = setup.bRequest;
+ uint8_t requestType = setup.bmRequestType;
+
+ if (requestType == REQUEST_DEVICETOHOST_CLASS_INTERFACE)
+ {
+ if (request == HID_GET_REPORT) {
+ // TODO: HID_GetReport();
+ return true;
+ }
+ if (request == HID_GET_PROTOCOL) {
+ // TODO: Send8(protocol);
+ return true;
+ }
+ if (request == HID_GET_IDLE) {
+ // TODO: Send8(idle);
+ }
+ }
+
+ if (requestType == REQUEST_HOSTTODEVICE_CLASS_INTERFACE)
+ {
+ if (request == HID_SET_PROTOCOL) {
+ // The USB Host tells us if we are in boot or report mode.
+ // This only works with a real boot compatible device.
+ protocol = setup.wValueL;
+ return true;
+ }
+ if (request == HID_SET_IDLE) {
+ idle = setup.wValueL;
+ return true;
+ }
+ if (request == HID_SET_REPORT)
+ {
+ //uint8_t reportID = setup.wValueL;
+ //uint16_t length = setup.wLength;
+ //uint8_t data[length];
+ // Make sure to not read more data than USB_EP_SIZE.
+ // You can read multiple times through a loop.
+ // The first byte (may!) contain the reportID on a multreport.
+ //USB_RecvControl(data, length);
+ }
+ }
+
+ return false;
+}
+
+HID_::HID_(void) : PluggableUSBModule(1, 1, epType),
+ rootNode(NULL), descriptorSize(0),
+ protocol(HID_REPORT_PROTOCOL), idle(1)
+{
+ epType[0] = EP_TYPE_INTERRUPT_IN;
+ PluggableUSB().plug(this);
+}
+
+int HID_::begin(void)
+{
+ return 0;
+}
+
+#endif /* if defined(USBCON) */
diff --git a/libraries/HID/HID.h b/libraries/HID/HID.h
new file mode 100644
index 0000000..93c4bd5
--- /dev/null
+++ b/libraries/HID/HID.h
@@ -0,0 +1,125 @@
+/*
+ Copyright (c) 2015, Arduino LLC
+ Original code (pre-library): Copyright (c) 2011, Peter Barrett
+
+ Permission to use, copy, modify, and/or distribute this software for
+ any purpose with or without fee is hereby granted, provided that the
+ above copyright notice and this permission notice appear in all copies.
+
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+ BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES
+ OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+ WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ SOFTWARE.
+ */
+
+#ifndef HID_h
+#define HID_h
+
+#include <stdint.h>
+#include <Arduino.h>
+#include "PluggableUSB.h"
+
+#if defined(USBCON)
+
+#define _USING_HID
+
+// HID 'Driver'
+// ------------
+#define HID_GET_REPORT 0x01
+#define HID_GET_IDLE 0x02
+#define HID_GET_PROTOCOL 0x03
+#define HID_SET_REPORT 0x09
+#define HID_SET_IDLE 0x0A
+#define HID_SET_PROTOCOL 0x0B
+
+#define HID_HID_DESCRIPTOR_TYPE 0x21
+#define HID_REPORT_DESCRIPTOR_TYPE 0x22
+#define HID_PHYSICAL_DESCRIPTOR_TYPE 0x23
+
+// HID subclass HID1.11 Page 8 4.2 Subclass
+#define HID_SUBCLASS_NONE 0
+#define HID_SUBCLASS_BOOT_INTERFACE 1
+
+// HID Keyboard/Mouse bios compatible protocols HID1.11 Page 9 4.3 Protocols
+#define HID_PROTOCOL_NONE 0
+#define HID_PROTOCOL_KEYBOARD 1
+#define HID_PROTOCOL_MOUSE 2
+
+// Normal or bios protocol (Keyboard/Mouse) HID1.11 Page 54 7.2.5 Get_Protocol Request
+// "protocol" variable is used for this purpose.
+#define HID_BOOT_PROTOCOL 0
+#define HID_REPORT_PROTOCOL 1
+
+// HID Request Type HID1.11 Page 51 7.2.1 Get_Report Request
+#define HID_REPORT_TYPE_INPUT 1
+#define HID_REPORT_TYPE_OUTPUT 2
+#define HID_REPORT_TYPE_FEATURE 3
+
+typedef struct
+{
+ uint8_t len; // 9
+ uint8_t dtype; // 0x21
+ uint8_t addr;
+ uint8_t versionL; // 0x101
+ uint8_t versionH; // 0x101
+ uint8_t country;
+ uint8_t desctype; // 0x22 report
+ uint8_t descLenL;
+ uint8_t descLenH;
+} HIDDescDescriptor;
+
+typedef struct
+{
+ InterfaceDescriptor hid;
+ HIDDescDescriptor desc;
+ EndpointDescriptor in;
+} HIDDescriptor;
+
+class HIDSubDescriptor {
+public:
+ HIDSubDescriptor *next = NULL;
+ HIDSubDescriptor(const void *d, const uint16_t l) : data(d), length(l) { }
+
+ const void* data;
+ const uint16_t length;
+};
+
+class HID_ : public PluggableUSBModule
+{
+public:
+ HID_(void);
+ int begin(void);
+ int SendReport(uint8_t id, const void* data, int len);
+ void AppendDescriptor(HIDSubDescriptor* node);
+
+protected:
+ // Implementation of the PluggableUSBModule
+ int getInterface(uint8_t* interfaceCount);
+ int getDescriptor(USBSetup& setup);
+ bool setup(USBSetup& setup);
+ uint8_t getShortName(char* name);
+
+private:
+ uint8_t epType[1];
+
+ HIDSubDescriptor* rootNode;
+ uint16_t descriptorSize;
+
+ uint8_t protocol;
+ uint8_t idle;
+};
+
+// Replacement for global singleton.
+// This function prevents static-initialization-order-fiasco
+// https://isocpp.org/wiki/faq/ctors#static-init-order-on-first-use
+HID_& HID();
+
+#define D_HIDREPORT(length) { 9, 0x21, 0x01, 0x01, 0, 1, 0x22, lowByte(length), highByte(length) }
+
+#endif // USBCON
+
+#endif // HID_h
diff --git a/libraries/HID/keywords.txt b/libraries/HID/keywords.txt
new file mode 100644
index 0000000..32a9ba5
--- /dev/null
+++ b/libraries/HID/keywords.txt
@@ -0,0 +1,21 @@
+#######################################
+# Syntax Coloring Map HID
+#######################################
+
+#######################################
+# Datatypes (KEYWORD1)
+#######################################
+
+HID KEYWORD1
+
+#######################################
+# Methods and Functions (KEYWORD2)
+#######################################
+begin KEYWORD2
+SendReport KEYWORD2
+AppendDescriptor KEYWORD2
+
+#######################################
+# Constants (LITERAL1)
+#######################################
+HID_TX LITERAL1 \ No newline at end of file
diff --git a/libraries/HID/library.properties b/libraries/HID/library.properties
new file mode 100644
index 0000000..5cbb5d7
--- /dev/null
+++ b/libraries/HID/library.properties
@@ -0,0 +1,9 @@
+name=HID
+version=1.0
+author=Arduino
+maintainer=Arduino <info@arduino.cc>
+sentence=Module for PluggableUSB infrastructure. Exposes an API for devices like Keyboards, Mice and Gamepads
+paragraph=
+category=Communication
+url=http://www.arduino.cc/en/Reference/HID
+architectures=avr
diff --git a/libraries/SPI/library.properties b/libraries/SPI/library.properties
index 2964aec..4428505 100644
--- a/libraries/SPI/library.properties
+++ b/libraries/SPI/library.properties
@@ -4,6 +4,7 @@ author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Enables the communication with devices that use the Serial Peripheral Interface (SPI) Bus. For all Arduino boards, BUT Arduino DUE.
paragraph=
+category=Communication
url=http://www.arduino.cc/en/Reference/SPI
architectures=avr
diff --git a/libraries/SoftwareSerial/SoftwareSerial.cpp b/libraries/SoftwareSerial/SoftwareSerial.cpp
index 527f3f9..0a16ff7 100644
--- a/libraries/SoftwareSerial/SoftwareSerial.cpp
+++ b/libraries/SoftwareSerial/SoftwareSerial.cpp
@@ -57,9 +57,9 @@ volatile uint8_t SoftwareSerial::_receive_buffer_head = 0;
//
// This function generates a brief pulse
// for debugging or measuring on an oscilloscope.
+#if _DEBUG
inline void DebugPulse(uint8_t pin, uint8_t count)
{
-#if _DEBUG
volatile uint8_t *pport = portOutputRegister(digitalPinToPort(pin));
uint8_t val = *pport;
@@ -68,8 +68,10 @@ inline void DebugPulse(uint8_t pin, uint8_t count)
*pport = val | digitalPinToBitMask(pin);
*pport = val;
}
-#endif
}
+#else
+inline void DebugPulse(uint8_t, uint8_t) {}
+#endif
//
// Private methods
@@ -467,13 +469,7 @@ size_t SoftwareSerial::write(uint8_t b)
void SoftwareSerial::flush()
{
- if (!isListening())
- return;
-
- uint8_t oldSREG = SREG;
- cli();
- _receive_buffer_head = _receive_buffer_tail = 0;
- SREG = oldSREG;
+ // There is no tx buffering, simply return
}
int SoftwareSerial::peek()
diff --git a/libraries/SoftwareSerial/SoftwareSerial.h b/libraries/SoftwareSerial/SoftwareSerial.h
index 274f3df..622e2a5 100644
--- a/libraries/SoftwareSerial/SoftwareSerial.h
+++ b/libraries/SoftwareSerial/SoftwareSerial.h
@@ -72,12 +72,11 @@ private:
static SoftwareSerial *active_object;
// private methods
- void recv() __attribute__((__always_inline__));
+ inline void recv() __attribute__((__always_inline__));
uint8_t rx_pin_read();
- void tx_pin_write(uint8_t pin_state) __attribute__((__always_inline__));
void setTX(uint8_t transmitPin);
void setRX(uint8_t receivePin);
- void setRxIntMsk(bool enable) __attribute__((__always_inline__));
+ inline void setRxIntMsk(bool enable) __attribute__((__always_inline__));
// Return num - sub, or 1 if the result would be < 1
static uint16_t subtract_cap(uint16_t num, uint16_t sub);
diff --git a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
index d35303d..aba6ebe 100644
--- a/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
+++ b/libraries/SoftwareSerial/examples/SoftwareSerialExample/SoftwareSerialExample.ino
@@ -33,7 +33,7 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(57600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
diff --git a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
index 2c501e5..26659d6 100644
--- a/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
+++ b/libraries/SoftwareSerial/examples/TwoPortReceive/TwoPortReceive.ino
@@ -46,7 +46,7 @@ void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
- ; // wait for serial port to connect. Needed for Leonardo only
+ ; // wait for serial port to connect. Needed for native USB port only
}
diff --git a/libraries/SoftwareSerial/library.properties b/libraries/SoftwareSerial/library.properties
index 37eb04b..c42cbde 100644
--- a/libraries/SoftwareSerial/library.properties
+++ b/libraries/SoftwareSerial/library.properties
@@ -4,6 +4,7 @@ author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Enables serial communication on digital pins. For all Arduino boards, BUT Arduino DUE.
paragraph=
+category=Communication
url=http://www.arduino.cc/en/Reference/SoftwareSerial
architectures=avr
diff --git a/libraries/Wire/Wire.cpp b/libraries/Wire/Wire.cpp
index 835b794..2bd48ed 100644
--- a/libraries/Wire/Wire.cpp
+++ b/libraries/Wire/Wire.cpp
@@ -75,6 +75,11 @@ void TwoWire::begin(int address)
begin((uint8_t)address);
}
+void TwoWire::end(void)
+{
+ twi_disable();
+}
+
void TwoWire::setClock(uint32_t frequency)
{
TWBR = ((F_CPU / frequency) - 16) / 2;
diff --git a/libraries/Wire/Wire.h b/libraries/Wire/Wire.h
index 7d00959..702f37d 100644
--- a/libraries/Wire/Wire.h
+++ b/libraries/Wire/Wire.h
@@ -27,6 +27,9 @@
#define BUFFER_LENGTH 32
+// WIRE_HAS_END means Wire has end()
+#define WIRE_HAS_END 1
+
class TwoWire : public Stream
{
private:
@@ -49,6 +52,7 @@ class TwoWire : public Stream
void begin();
void begin(uint8_t);
void begin(int);
+ void end();
void setClock(uint32_t);
void beginTransmission(uint8_t);
void beginTransmission(int);
diff --git a/libraries/Wire/keywords.txt b/libraries/Wire/keywords.txt
index ff31475..5e3d2b1 100644
--- a/libraries/Wire/keywords.txt
+++ b/libraries/Wire/keywords.txt
@@ -15,8 +15,6 @@ setClock KEYWORD2
beginTransmission KEYWORD2
endTransmission KEYWORD2
requestFrom KEYWORD2
-send KEYWORD2
-receive KEYWORD2
onReceive KEYWORD2
onRequest KEYWORD2
diff --git a/libraries/Wire/library.properties b/libraries/Wire/library.properties
index 0805847..811527b 100644
--- a/libraries/Wire/library.properties
+++ b/libraries/Wire/library.properties
@@ -4,6 +4,7 @@ author=Arduino
maintainer=Arduino <info@arduino.cc>
sentence=Allows the communication between devices or sensors connected via Two Wire Interface Bus. For all Arduino boards, BUT Arduino DUE.
paragraph=
+category=Communication
url=http://www.arduino.cc/en/Reference/Wire
architectures=avr
diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c
index 201d7d1..2af0597 100644
--- a/libraries/Wire/utility/twi.c
+++ b/libraries/Wire/utility/twi.c
@@ -91,6 +91,22 @@ void twi_init(void)
}
/*
+ * Function twi_disable
+ * Desc disables twi pins
+ * Input none
+ * Output none
+ */
+void twi_disable(void)
+{
+ // disable twi module, acks, and twi interrupt
+ TWCR &= ~(_BV(TWEN) | _BV(TWIE) | _BV(TWEA));
+
+ // deactivate internal pullups for twi.
+ digitalWrite(SDA, 0);
+ digitalWrite(SCL, 0);
+}
+
+/*
* Function twi_slaveInit
* Desc sets slave address and enables interrupt
* Input none
@@ -151,7 +167,9 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen
// up. Also, don't enable the START interrupt. There may be one pending from the
// repeated start that we sent outselves, and that would really confuse things.
twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR
- TWDR = twi_slarw;
+ do {
+ TWDR = twi_slarw;
+ } while(TWCR & _BV(TWWC));
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START
}
else
@@ -231,7 +249,9 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait
// up. Also, don't enable the START interrupt. There may be one pending from the
// repeated start that we sent outselves, and that would really confuse things.
twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR
- TWDR = twi_slarw;
+ do {
+ TWDR = twi_slarw;
+ } while(TWCR & _BV(TWWC));
TWCR = _BV(TWINT) | _BV(TWEA) | _BV(TWEN) | _BV(TWIE); // enable INTs, but not START
}
else
@@ -460,18 +480,16 @@ ISR(TWI_vect)
}
break;
case TW_SR_STOP: // stop or repeated start condition received
+ // ack future responses and leave slave receiver state
+ twi_releaseBus();
// put a null char after data if there's room
if(twi_rxBufferIndex < TWI_BUFFER_LENGTH){
twi_rxBuffer[twi_rxBufferIndex] = '\0';
}
- // sends ack and stops interface for clock stretching
- twi_stop();
// callback to user defined callback
twi_onSlaveReceive(twi_rxBuffer, twi_rxBufferIndex);
// since we submit rx buffer to "wire" library, we can reset it
twi_rxBufferIndex = 0;
- // ack future responses and leave slave receiver state
- twi_releaseBus();
break;
case TW_SR_DATA_NACK: // data received, returned nack
case TW_SR_GCALL_DATA_NACK: // data received generally, returned nack
diff --git a/libraries/Wire/utility/twi.h b/libraries/Wire/utility/twi.h
index 6526593..4c52bc5 100644
--- a/libraries/Wire/utility/twi.h
+++ b/libraries/Wire/utility/twi.h
@@ -39,6 +39,7 @@
#define TWI_STX 4
void twi_init(void);
+ void twi_disable(void);
void twi_setAddress(uint8_t);
uint8_t twi_readFrom(uint8_t, uint8_t*, uint8_t, uint8_t);
uint8_t twi_writeTo(uint8_t, uint8_t*, uint8_t, uint8_t, uint8_t);
diff --git a/platform.keys.rewrite.txt b/platform.keys.rewrite.txt
deleted file mode 100644
index bc6bb5e..0000000
--- a/platform.keys.rewrite.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-old.0.compiler.path={runtime.ide.path}/hardware/tools/avr/bin/
-new.0.compiler.path={runtime.tools.avr-gcc.path}/bin/
-
-added.tools.avrdude.path={runtime.tools.avrdude.path}
-
-old.1.tools.avrdude.cmd.path={runtime.ide.path}/hardware/tools/avr/bin/avrdude
-new.1.tools.avrdude.cmd.path={path}/bin/avrdude
-
-old.2.tools.avrdude.config.path={runtime.ide.path}/hardware/tools/avr/etc/avrdude.conf
-new.2.tools.avrdude.config.path={path}/etc/avrdude.conf
-
-old.3.compiler.path={runtime.ide.path}/hardware/tools/gcc-arm-none-eabi-4.8.3-2014q1/bin/
-new.3.compiler.path={runtime.tools.arm-none-eabi-gcc.path}/bin/
-
-old.4.tools.bossac.path={runtime.ide.path}/hardware/tools
-new.4.tools.bossac.path={runtime.tools.bossac.path}
-
-old.5.recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
-new.5.recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mcpu={build.mcu} "-T{build.variant.path}/{build.ldscript}" "-Wl,-Map,{build.path}/{build.project_name}.map" {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" "-L{build.path}" -mthumb -Wl,--cref -Wl,--check-sections -Wl,--gc-sections -Wl,--entry=Reset_Handler -Wl,--unresolved-symbols=report-all -Wl,--warn-common -Wl,--warn-section-align -Wl,--warn-unresolved-symbols -Wl,--start-group "{build.path}/core/syscalls_sam3.c.o" {object_files} "{build.variant.path}/{build.variant_system_lib}" "{build.path}/{archive_file}" -Wl,--end-group -lm -gcc
-
diff --git a/platform.txt b/platform.txt
index 2908dbe..d7c9b0b 100644
--- a/platform.txt
+++ b/platform.txt
@@ -3,10 +3,10 @@
# ------------------------------
#
# For more info:
-# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5---3rd-party-Hardware-specification
+# https://github.com/arduino/Arduino/wiki/Arduino-IDE-1.5-3rd-party-Hardware-specification
name=Arduino AVR Boards
-version=1.6.7
+version=1.6.9
# AVR compile variables
# ---------------------
@@ -20,14 +20,14 @@ compiler.warning_flags.all=-Wall -Wextra
# Default "compiler.path" is correct, change only if you want to overidde the initial value
compiler.path={runtime.tools.avr-gcc.path}/bin/
compiler.c.cmd=avr-gcc
-compiler.c.flags=-c -g -Os {compiler.warning_flags} -ffunction-sections -fdata-sections -MMD
+compiler.c.flags=-c -g -Os {compiler.warning_flags} -std=gnu11 -ffunction-sections -fdata-sections -MMD
# -w flag added to avoid printing a wrong warning http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59396
# This is fixed in gcc 4.8.3 and will be removed as soon as we update the toolchain
compiler.c.elf.flags={compiler.warning_flags} -Os -Wl,--gc-sections
compiler.c.elf.cmd=avr-gcc
compiler.S.flags=-c -g -x assembler-with-cpp
compiler.cpp.cmd=avr-g++
-compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
+compiler.cpp.flags=-c -g -Os {compiler.warning_flags} -std=gnu++11 -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -MMD
compiler.ar.cmd=avr-ar
compiler.ar.flags=rcs
compiler.objcopy.cmd=avr-objcopy
@@ -62,25 +62,31 @@ recipe.cpp.o.pattern="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} -m
recipe.S.o.pattern="{compiler.path}{compiler.c.cmd}" {compiler.S.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.S.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{object_file}"
## Create archives
-recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{build.path}/{archive_file}" "{object_file}"
+recipe.ar.pattern="{compiler.path}{compiler.ar.cmd}" {compiler.ar.flags} {compiler.ar.extra_flags} "{archive_file_path}" "{object_file}"
## Combine gc-sections, archives, and objects
-recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/sketch/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
+recipe.c.combine.pattern="{compiler.path}{compiler.c.elf.cmd}" {compiler.c.elf.flags} -mmcu={build.mcu} {compiler.c.elf.extra_flags} -o "{build.path}/{build.project_name}.elf" {object_files} "{build.path}/{archive_file}" "-L{build.path}" -lm
## Create output files (.eep and .hex)
-recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/sketch/{build.project_name}.elf" "{build.path}/sketch/{build.project_name}.eep"
-recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/sketch/{build.project_name}.elf" "{build.path}/sketch/{build.project_name}.hex"
+recipe.objcopy.eep.pattern="{compiler.path}{compiler.objcopy.cmd}" {compiler.objcopy.eep.flags} {compiler.objcopy.eep.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.eep"
+recipe.objcopy.hex.pattern="{compiler.path}{compiler.elf2hex.cmd}" {compiler.elf2hex.flags} {compiler.elf2hex.extra_flags} "{build.path}/{build.project_name}.elf" "{build.path}/{build.project_name}.hex"
## Save hex
recipe.output.tmp_file={build.project_name}.hex
recipe.output.save_file={build.project_name}.{build.variant}.hex
## Compute size
-recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/sketch/{build.project_name}.elf"
+recipe.size.pattern="{compiler.path}{compiler.size.cmd}" -A "{build.path}/{build.project_name}.elf"
recipe.size.regex=^(?:\.text|\.data|\.bootloader)\s+([0-9]+).*
recipe.size.regex.data=^(?:\.data|\.bss|\.noinit)\s+([0-9]+).*
recipe.size.regex.eeprom=^(?:\.eeprom)\s+([0-9]+).*
+## Preprocessor
+preproc.includes.flags=-w -x c++ -M -MG -MP
+recipe.preproc.includes="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.includes.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}"
+
+preproc.macros.flags=-w -x c++ -E -CC
+recipe.preproc.macros="{compiler.path}{compiler.cpp.cmd}" {compiler.cpp.flags} {preproc.macros.flags} -mmcu={build.mcu} -DF_CPU={build.f_cpu} -DARDUINO={runtime.ide.version} -DARDUINO_{build.board} -DARDUINO_ARCH_{build.arch} {compiler.cpp.extra_flags} {build.extra_flags} {includes} "{source_file}" -o "{preprocessed_file_path}"
# AVR Uploader/Programmers tools
# ------------------------------
@@ -91,11 +97,11 @@ tools.avrdude.config.path={path}/etc/avrdude.conf
tools.avrdude.upload.params.verbose=-v
tools.avrdude.upload.params.quiet=-q -q
-tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"
+tools.avrdude.upload.pattern="{cmd.path}" "-C{config.path}" {upload.verbose} -p{build.mcu} -c{upload.protocol} -P{serial.port} -b{upload.speed} -D "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.program.params.verbose=-v
tools.avrdude.program.params.quiet=-q -q
-tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/sketch/{build.project_name}.hex:i"
+tools.avrdude.program.pattern="{cmd.path}" "-C{config.path}" {program.verbose} -p{build.mcu} -c{protocol} {program.extra_params} "-Uflash:w:{build.path}/{build.project_name}.hex:i"
tools.avrdude.erase.params.verbose=-v
tools.avrdude.erase.params.quiet=-q -q
diff --git a/variants/ethernet/pins_arduino.h b/variants/ethernet/pins_arduino.h
index f6773a0..a11ecfc 100644
--- a/variants/ethernet/pins_arduino.h
+++ b/variants/ethernet/pins_arduino.h
@@ -58,6 +58,8 @@ static const uint8_t A7 = 21;
#define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
#define digitalPinToPCMSKbit(p) (((p) <= 7) ? (p) : (((p) <= 13) ? ((p) - 8) : ((p) - 14)))
+#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : ((p) == 3 ? 1 : NOT_AN_INTERRUPT))
+
#ifdef ARDUINO_MAIN
// On the Arduino board, digital pins are also used
diff --git a/variants/gemma/pins_arduino.h b/variants/gemma/pins_arduino.h
index 1d367a7..b6aed39 100644
--- a/variants/gemma/pins_arduino.h
+++ b/variants/gemma/pins_arduino.h
@@ -42,6 +42,10 @@
// GND 4| |5 PB0 (D 0) pwm0
// +----+
+#define NUM_DIGITAL_PINS 3
+#define NUM_ANALOG_INPUTS 1
+#define LED_BUILTIN 1
+
static const uint8_t A0 = 6;
static const uint8_t A1 = 7;
static const uint8_t A2 = 8;
@@ -52,6 +56,8 @@ static const uint8_t A3 = 9;
#define digitalPinToPCMSK(p) ( ((p) <= 4) ? (&PCMSK) : ((uint8_t *)0) )
#define digitalPinToPCMSKbit(p) ( (p) )
+#define digitalPinToInterrupt(p) ((p) == 2 ? 0 : NOT_AN_INTERRUPT)
+
#define analogPinToChannel(p) ( (p) < 6 ? (p) : (p) - 6 )
#define TCCR1A GTCCR
diff --git a/variants/leonardo/pins_arduino.h b/variants/leonardo/pins_arduino.h
index 89b8806..6027223 100644
--- a/variants/leonardo/pins_arduino.h
+++ b/variants/leonardo/pins_arduino.h
@@ -88,7 +88,7 @@
#undef OCR2_6
#undef OCR2_7
-#define NUM_DIGITAL_PINS 30
+#define NUM_DIGITAL_PINS 31
#define NUM_ANALOG_INPUTS 12
#define TX_RX_LED_INIT DDRD |= (1<<5), DDRB |= (1<<0)
@@ -100,6 +100,8 @@
static const uint8_t SDA = 2;
static const uint8_t SCL = 3;
#define LED_BUILTIN 13
+#define LED_BUILTIN_RX 17
+#define LED_BUILTIN_TX 30
// Map SPI port to 'new' pins D14..D17
static const uint8_t SS = 17;
@@ -131,6 +133,8 @@ static const uint8_t A11 = 29; // D12
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
#define analogPinToChannel(P) ( pgm_read_byte( analog_pin_to_channel_PGM + (P) ) )
+#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11 || (p) == 13)
+
#define digitalPinToInterrupt(p) ((p) == 0 ? 2 : ((p) == 1 ? 3 : ((p) == 2 ? 1 : ((p) == 3 ? 0 : ((p) == 7 ? 4 : NOT_AN_INTERRUPT)))))
#ifdef ARDUINO_MAIN
@@ -171,8 +175,8 @@ extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];
// MOSI D16 PB2 MOSI,PCINT2
// SS D17 PB0 RXLED,SS/PCINT0
//
-// TXLED PD5
-// RXLED PB0
+// TXLED D30 PD5 XCK1
+// RXLED D17 PB0
// HWB PE2 HWB
// these arrays map port names (e.g. port B) to the
@@ -243,6 +247,7 @@ const uint8_t PROGMEM digital_pin_to_port_PGM[] = {
PB, // D27 / D9 - A9 - PB5
PB, // D28 / D10 - A10 - PB6
PD, // D29 / D12 - A11 - PD6
+ PD, // D30 / TX Led - PD5
};
const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
@@ -280,6 +285,7 @@ const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = {
_BV(5), // D27 / D9 - A9 - PB5
_BV(6), // D28 / D10 - A10 - PB6
_BV(6), // D29 / D12 - A11 - PD6
+ _BV(5), // D30 / TX Led - PD5
};
const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
@@ -317,6 +323,7 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
NOT_ON_TIMER,
NOT_ON_TIMER,
NOT_ON_TIMER,
+ NOT_ON_TIMER,
};
const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
@@ -356,4 +363,7 @@ const uint8_t PROGMEM analog_pin_to_channel_PGM[] = {
#define SERIAL_PORT_HARDWARE Serial1
#define SERIAL_PORT_HARDWARE_OPEN Serial1
+// Alias SerialUSB to Serial
+#define SerialUSB SERIAL_PORT_USBVIRTUAL
+
#endif /* Pins_Arduino_h */