Thu, 07 Jul 2016 12:23:34 +0200
added missing sanguino files
--- a/.gitignore Sat Nov 07 13:24:46 2015 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -*.o -*.~ -applet/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/README Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,19 @@ +This is the RepRapPro version of Marlin. + +http://reprappro.com + +Modifications mainly be Jean-Marc and Adrian + +The core Marlin code in the Marlin directory is stable and is our standard +release firmware for all RepRapPro RepRap machines. + +For instructions see: + +RepRapPro Mendel: http://reprap.org/wiki/RepRapPro_Mendel_maintenance + +RepRapPro Huxley: http://reprap.org/wiki/RepRapPro_Huxley_maintenance + +Code in the Slave directory is under development. This will drive a slave +controller (with the core Marlin code on the master controller) to control +multiple extruders. +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/boards.txt Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,22 @@ +############################################################## + +atmega1284.name=Melzi 1284p 16mhz + +atmega1284.upload.protocol=stk500v1 +atmega1284.upload.maximum_size=129024 +atmega1284.upload.speed=57600 + +atmega1284.bootloader.low_fuses=0xd6 +atmega1284.bootloader.high_fuses=0xdc +atmega1284.bootloader.extended_fuses=0xfd +atmega1284.bootloader.path=atmega +atmega1284.bootloader.file=ATmegaBOOT_1284P.hex +atmega1284.bootloader.unlock_bits=0x3F +atmega1284.bootloader.lock_bits=0x0F + +atmega1284.build.mcu=atmega1284p +atmega1284.build.f_cpu=16000000L +atmega1284.build.core=arduino +atmega1284.build.variant=standard + +#
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/bootloaders/atmega/ATmegaBOOT.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,1091 @@ +/**********************************************************/ +/* Serial Bootloader for Atmel megaAVR Controllers */ +/* */ +/* tested with ATmega8, ATmega128 and ATmega168 */ +/* should work with other mega's, see code for details */ +/* */ +/* ATmegaBOOT.c */ +/* */ +/* */ +/* 20090308: integrated Mega changes into main bootloader */ +/* source by D. Mellis */ +/* 20080930: hacked for Arduino Mega (with the 1280 */ +/* processor, backwards compatible) */ +/* by D. Cuartielles */ +/* 20070626: hacked for Arduino Diecimila (which auto- */ +/* resets when a USB connection is made to it) */ +/* by D. Mellis */ +/* 20060802: hacked for Arduino by D. Cuartielles */ +/* based on a previous hack by D. Mellis */ +/* and D. Cuartielles */ +/* */ +/* Monitor and debug functions were added to the original */ +/* code by Dr. Erik Lins, chip45.com. (See below) */ +/* */ +/* Thanks to Karl Pitrich for fixing a bootloader pin */ +/* problem and more informative LED blinking! */ +/* */ +/* For the latest version see: */ +/* http://www.chip45.com/ */ +/* */ +/* ------------------------------------------------------ */ +/* */ +/* based on stk500boot.c */ +/* Copyright (c) 2003, Jason P. Kyle */ +/* All rights reserved. */ +/* see avr1.org for original file and information */ +/* */ +/* This program is free software; you can redistribute it */ +/* and/or modify it under the terms of the GNU General */ +/* Public License as published by the Free Software */ +/* Foundation; either version 2 of the License, or */ +/* (at your option) any later version. */ +/* */ +/* This program 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 General Public */ +/* License for more details. */ +/* */ +/* You should have received a copy of the GNU General */ +/* Public License along with this program; if not, write */ +/* to the Free Software Foundation, Inc., */ +/* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +/* */ +/* Licence can be viewed at */ +/* http://www.fsf.org/licenses/gpl.txt */ +/* */ +/* Target = Atmel AVR m128,m64,m32,m16,m8,m162,m163,m169, */ +/* m8515,m8535. ATmega161 has a very small boot block so */ +/* isn't supported. */ +/* */ +/* Tested with m168 */ +/**********************************************************/ + +/* $Id$ */ + + +/* some includes */ +#include <inttypes.h> +#include <avr/io.h> +#include <avr/pgmspace.h> +#include <avr/interrupt.h> +#include <avr/wdt.h> +#include <util/delay.h> + +/* 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__) +#include <avr/eeprom.h> +#endif + +/* Use the F_CPU defined in Makefile */ + +/* 20060803: hacked by DojoCorp */ +/* 20070626: hacked by David A. Mellis to decrease waiting time for auto-reset */ +/* set the waiting time for the bootloader */ +/* get this from the Makefile instead */ +/* #define MAX_TIME_COUNT (F_CPU>>4) */ + +/* 20070707: hacked by David A. Mellis - after this many errors give up and launch application */ +#define MAX_ERROR_COUNT 5 +#define NUM_LED_FLASHES 3 +/* set the UART baud rate */ +/* 20060803: hacked by DojoCorp */ +//#define BAUD_RATE 115200 +#ifndef BAUD_RATE +#define BAUD_RATE 19200 +#endif + + +/* SW_MAJOR and MINOR needs to be updated from time to time to avoid warning message from AVR Studio */ +/* never allow AVR Studio to do an update !!!! */ +#define HW_VER 0x02 +#define SW_MAJOR 0x01 +#define SW_MINOR 0x10 + + +/* Adjust to suit whatever pin your hardware uses to enter the bootloader */ +/* ATmega128 has two UARTS so two pins are used to enter bootloader and select UART */ +/* ATmega1280 has four UARTS, but for Arduino Mega, we will only use RXD0 to get code */ +/* BL0... means UART0, BL1... means UART1 */ +#ifdef __AVR_ATmega128__ +#define BL_DDR DDRF +#define BL_PORT PORTF +#define BL_PIN PINF +#define BL0 PINF7 +#define BL1 PINF6 +#elif defined __AVR_ATmega1280__ +/* we just don't do anything for the MEGA and enter bootloader on reset anyway*/ +#elif defined __AVR_ATmega1284P__ + +#else +/* other ATmegas have only one UART, so only one pin is defined to enter bootloader */ +#define BL_DDR DDRD +#define BL_PORT PORTD +#define BL_PIN PIND +#define BL PIND6 +#endif + + +/* onboard LED is used to indicate, that the bootloader was entered (3x flashing) */ +/* if monitor functions are included, LED goes on after monitor was entered */ +#if defined __AVR_ATmega128__ || defined __AVR_ATmega1280__ +/* Onboard LED is connected to pin PB7 (e.g. Crumb128, PROBOmega128, Savvy128, Arduino Mega) */ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB7 +#elif defined __AVR_ATmega1284P__ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB0 +#else +/* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duomilanuove */ +/* other boards like e.g. Crumb8, Crumb168 are using PB2 */ +#define LED_DDR DDRB +#define LED_PORT PORTB +#define LED_PIN PINB +#define LED PINB5 +#endif + + +/* monitor functions will only be compiled when using ATmega128, due to bootblock size constraints */ +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) +#define MONITOR 1 +#endif + + +/* define various device id's */ +/* manufacturer byte is always the same */ +#define SIG1 0x1E // Yep, Atmel is the only manufacturer of AVR micros. Single source :( + +#if defined __AVR_ATmega1280__ +#define SIG2 0x97 +#define SIG3 0x03 +#define PAGE_SIZE 0x80U //128 words + +#elif defined __AVR_ATmega1284P__ +#define SIG2 0x97 +#define SIG3 0x05 +#define PAGE_SIZE 0x080U //128 words + +#elif defined __AVR_ATmega1281__ +#define SIG2 0x97 +#define SIG3 0x04 +#define PAGE_SIZE 0x80U //128 words + +#elif defined __AVR_ATmega128__ +#define SIG2 0x97 +#define SIG3 0x02 +#define PAGE_SIZE 0x80U //128 words + +#elif defined __AVR_ATmega64__ +#define SIG2 0x96 +#define SIG3 0x02 +#define PAGE_SIZE 0x80U //128 words + +#elif defined __AVR_ATmega32__ +#define SIG2 0x95 +#define SIG3 0x02 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega16__ +#define SIG2 0x94 +#define SIG3 0x03 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega8__ +#define SIG2 0x93 +#define SIG3 0x07 +#define PAGE_SIZE 0x20U //32 words + +#elif defined __AVR_ATmega88__ +#define SIG2 0x93 +#define SIG3 0x0a +#define PAGE_SIZE 0x20U //32 words + +#elif defined __AVR_ATmega168__ +#define SIG2 0x94 +#define SIG3 0x06 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega328P__ +#define SIG2 0x95 +#define SIG3 0x0F +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega162__ +#define SIG2 0x94 +#define SIG3 0x04 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega163__ +#define SIG2 0x94 +#define SIG3 0x02 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega169__ +#define SIG2 0x94 +#define SIG3 0x05 +#define PAGE_SIZE 0x40U //64 words + +#elif defined __AVR_ATmega8515__ +#define SIG2 0x93 +#define SIG3 0x06 +#define PAGE_SIZE 0x20U //32 words + +#elif defined __AVR_ATmega8535__ +#define SIG2 0x93 +#define SIG3 0x08 +#define PAGE_SIZE 0x20U //32 words +#endif + + +/* function prototypes */ +void putch(char); +char getch(void); +void getNch(uint8_t); +void byte_response(uint8_t); +void nothing_response(void); +char gethex(void); +void puthex(char); +void flash_led(uint8_t); + +/* some variables */ +union address_union +{ + uint16_t word; + uint8_t byte[2]; +} address; + +union length_union +{ + uint16_t word; + uint8_t byte[2]; +} length; + +struct flags_struct +{ + unsigned eeprom : 1; + unsigned rampz : 1; +} flags; + +uint8_t buff[256]; +uint8_t address_high; + +uint8_t pagesz=0x80; + +uint8_t i; +uint8_t bootuart = 0; + +uint8_t error_count = 0; + +void (*app_start)(void) = 0x0000; + + +/* main program starts here */ +int main(void) +{ + uint8_t ch,ch2; + uint16_t w; +#ifdef WATCHDOG_MODS + ch = MCUSR; + MCUSR = 0; + WDTCSR |= _BV(WDCE) | _BV(WDE); + WDTCSR = 0; + // Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot. + if (! (ch & _BV(EXTRF))) // if its a not an external reset... + app_start(); // skip bootloader +#else + asm volatile("nop\n\t"); +#endif + /* set pin direction for bootloader pin and enable pullup */ + /* for ATmega128, two pins need to be initialized */ +#ifdef __AVR_ATmega128__ + BL_DDR &= ~_BV(BL0); + BL_DDR &= ~_BV(BL1); + BL_PORT |= _BV(BL0); + BL_PORT |= _BV(BL1); +#else + /* We run the bootloader regardless of the state of this pin. Thus, don't + put it in a different state than the other pins. --DAM, 070709 + This also applies to Arduino Mega -- DC, 080930 + BL_DDR &= ~_BV(BL); + BL_PORT |= _BV(BL); + */ +#endif +#ifdef __AVR_ATmega128__ + /* check which UART should be used for booting */ + if(bit_is_clear(BL_PIN, BL0)) + { + bootuart = 1; + } + else if(bit_is_clear(BL_PIN, BL1)) + { + bootuart = 2; + } +#endif +#if defined __AVR_ATmega1280__ || defined __AVR_ATmega1284P__ + /* the mega1280 chip has four serial ports ... we could eventually use any of them, or not? */ + /* however, we don't wanna confuse people, to avoid making a mess, we will stick to RXD0, TXD0 */ + bootuart = 1; +#endif + /* check if flash is programmed already, if not start bootloader anyway */ + if(pgm_read_byte_near(0x0000) != 0xFF) + { +#ifdef __AVR_ATmega128__ + /* no UART was selected, start application */ + if(!bootuart) + { + app_start(); + } +#else + /* check if bootloader pin is set low */ + /* we don't start this part neither for the m8, nor m168 */ + //if(bit_is_set(BL_PIN, BL)) { + // app_start(); + // } +#endif + } +#ifdef __AVR_ATmega128__ + /* no bootuart was selected, default to uart 0 */ + if(!bootuart) + { + bootuart = 1; + } +#endif + /* initialize UART(s) depending on CPU defined */ +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + if(bootuart == 1) + { + UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); + UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8; + UCSR0A = 0x00; + UCSR0C = 0x06; + UCSR0B = _BV(TXEN0)|_BV(RXEN0); + } + if(bootuart == 2) + { + UBRR1L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); + UBRR1H = (F_CPU/(BAUD_RATE*16L)-1) >> 8; + UCSR1A = 0x00; + UCSR1C = 0x06; + UCSR1B = _BV(TXEN1)|_BV(RXEN1); + } +#elif defined __AVR_ATmega163__ + UBRR = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); + UBRRHI = (F_CPU/(BAUD_RATE*16L)-1) >> 8; + UCSRA = 0x00; + UCSRB = _BV(TXEN)|_BV(RXEN); +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) +#ifdef DOUBLE_SPEED + UCSR0A = (1<<U2X0); //Double speed mode USART0 + UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*8L)-1); + UBRR0H = (F_CPU/(BAUD_RATE*8L)-1) >> 8; +#else + UBRR0L = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); + UBRR0H = (F_CPU/(BAUD_RATE*16L)-1) >> 8; +#endif + UCSR0B = (1<<RXEN0) | (1<<TXEN0); + UCSR0C = (1<<UCSZ00) | (1<<UCSZ01); + /* Enable internal pull-up resistor on pin D0 (RX), in order + to supress line noise that prevents the bootloader from + timing out (DAM: 20070509) */ + DDRD &= ~_BV(PIND0); + PORTD |= _BV(PIND0); +#elif defined __AVR_ATmega8__ + /* m8 */ + UBRRH = (((F_CPU/BAUD_RATE)/16)-1)>>8; // set baud rate + UBRRL = (((F_CPU/BAUD_RATE)/16)-1); + UCSRB = (1<<RXEN)|(1<<TXEN); // enable Rx & Tx + UCSRC = (1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0); // config USART; 8N1 +#else + /* m16,m32,m169,m8515,m8535 */ + UBRRL = (uint8_t)(F_CPU/(BAUD_RATE*16L)-1); + UBRRH = (F_CPU/(BAUD_RATE*16L)-1) >> 8; + UCSRA = 0x00; + UCSRC = 0x06; + UCSRB = _BV(TXEN)|_BV(RXEN); +#endif +#if defined __AVR_ATmega1280__ + /* Enable internal pull-up resistor on pin D0 (RX), in order + to supress line noise that prevents the bootloader from + timing out (DAM: 20070509) */ + /* feature added to the Arduino Mega --DC: 080930 */ + DDRE &= ~_BV(PINE0); + PORTE |= _BV(PINE0); +#endif + /* set LED pin as output */ + LED_DDR |= _BV(LED); + /* flash onboard LED to signal entering of bootloader */ +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + // 4x for UART0, 5x for UART1 + flash_led(NUM_LED_FLASHES + bootuart); +#else + flash_led(NUM_LED_FLASHES); +#endif + /* 20050803: by DojoCorp, this is one of the parts provoking the + system to stop listening, cancelled from the original */ + //putch('\0'); + /* forever loop */ + for (;;) + { + /* get character from UART */ + ch = getch(); + /* A bunch of if...else if... gives smaller code than switch...case ! */ + /* Hello is anyone home ? */ + if(ch=='0') + { + nothing_response(); + } + /* Request programmer ID */ + /* Not using PROGMEM string due to boot block in m128 being beyond 64kB boundry */ + /* Would need to selectively manipulate RAMPZ, and it's only 9 characters anyway so who cares. */ + else if(ch=='1') + { + if (getch() == ' ') + { + putch(0x14); + putch('A'); + putch('V'); + putch('R'); + putch(' '); + putch('I'); + putch('S'); + putch('P'); + putch(0x10); + } + else + { + if (++error_count == MAX_ERROR_COUNT) + app_start(); + } + } + /* AVR ISP/STK500 board commands DON'T CARE so default nothing_response */ + else if(ch=='@') + { + ch2 = getch(); + if (ch2>0x85) getch(); + nothing_response(); + } + /* AVR ISP/STK500 board requests */ + else if(ch=='A') + { + ch2 = getch(); + if(ch2==0x80) byte_response(HW_VER); // Hardware version + else if(ch2==0x81) byte_response(SW_MAJOR); // Software major version + else if(ch2==0x82) byte_response(SW_MINOR); // Software minor version + else if(ch2==0x98) byte_response(0x03); // Unknown but seems to be required by avr studio 3.56 + else byte_response(0x00); // Covers various unnecessary responses we don't care about + } + /* Device Parameters DON'T CARE, DEVICE IS FIXED */ + else if(ch=='B') + { + getNch(20); + nothing_response(); + } + /* Parallel programming stuff DON'T CARE */ + else if(ch=='E') + { + getNch(5); + nothing_response(); + } + /* P: Enter programming mode */ + /* R: Erase device, don't care as we will erase one page at a time anyway. */ + else if(ch=='P' || ch=='R') + { + nothing_response(); + } + /* Leave programming mode */ + else if(ch=='Q') + { + nothing_response(); +#ifdef WATCHDOG_MODS + // autoreset via watchdog (sneaky!) + WDTCSR = _BV(WDE); + while (1); // 16 ms +#endif + } + /* Set address, little endian. EEPROM in bytes, FLASH in words */ + /* Perhaps extra address bytes may be added in future to support > 128kB FLASH. */ + /* This might explain why little endian was used here, big endian used everywhere else. */ + else if(ch=='U') + { + address.byte[0] = getch(); + address.byte[1] = getch(); + nothing_response(); + } + /* Universal SPI programming command, disabled. Would be used for fuses and lock bits. */ + else if(ch=='V') + { + if (getch() == 0x30) + { + getch(); + ch = getch(); + getch(); + if (ch == 0) + { + byte_response(SIG1); + } + else if (ch == 1) + { + byte_response(SIG2); + } + else + { + byte_response(SIG3); + } + } + else + { + getNch(3); + byte_response(0x00); + } + } + /* Write memory, length is big endian and is in bytes */ + else if(ch=='d') + { + length.byte[1] = getch(); + length.byte[0] = getch(); + flags.eeprom = 0; + if (getch() == 'E') flags.eeprom = 1; + for (w=0; w<length.word; w++) + { + buff[w] = getch(); // Store data in buffer, can't keep up with serial data stream whilst programming pages + } + if (getch() == ' ') + { + 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__) + while(EECR & (1<<EEPE)); + EEAR = (uint16_t)(void *)address.word; + EEDR = buff[w]; + EECR |= (1<<EEMPE); + EECR |= (1<<EEPE); +#else + eeprom_write_byte((void *)address.word,buff[w]); +#endif + address.word++; + } + } + else //Write to FLASH one page at a time + { + if (address.byte[1]>127) address_high = 0x01; //Only possible with m128, m256 will need 3rd address byte. FIXME + else address_high = 0x00; +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1281__) || defined(__AVR_ATmega1284P__) + RAMPZ = address_high; +#endif + address.word = address.word << 1; //address * 2 -> byte location + /* 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__) || defined(__AVR_ATmega1284P__) + 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 +#endif + asm volatile( + "clr r17 \n\t" //page_word_count + "lds r30,address \n\t" //Address of FLASH location (in bytes) + "lds r31,address+1 \n\t" + "ldi r28,lo8(buff) \n\t" //Start of buffer array in RAM + "ldi r29,hi8(buff) \n\t" + "lds r24,length \n\t" //Length of data to be written (in bytes) + "lds r25,length+1 \n\t" + "length_loop: \n\t" //Main loop, repeat for number of words in block + "cpi r17,0x00 \n\t" //If page_word_count=0 then erase page + "brne no_page_erase \n\t" + "wait_spm1: \n\t" + "lds r16,%0 \n\t" //Wait for previous spm to complete + "andi r16,1 \n\t" + "cpi r16,1 \n\t" + "breq wait_spm1 \n\t" + "ldi r16,0x03 \n\t" //Erase page pointed to by Z + "sts %0,r16 \n\t" + "spm \n\t" +#ifdef __AVR_ATmega163__ + ".word 0xFFFF \n\t" + "nop \n\t" +#endif + "wait_spm2: \n\t" + "lds r16,%0 \n\t" //Wait for previous spm to complete + "andi r16,1 \n\t" + "cpi r16,1 \n\t" + "breq wait_spm2 \n\t" + "ldi r16,0x11 \n\t" //Re-enable RWW section + "sts %0,r16 \n\t" + "spm \n\t" +#ifdef __AVR_ATmega163__ + ".word 0xFFFF \n\t" + "nop \n\t" +#endif + "no_page_erase: \n\t" + "ld r0,Y+ \n\t" //Write 2 bytes into page buffer + "ld r1,Y+ \n\t" + "wait_spm3: \n\t" + "lds r16,%0 \n\t" //Wait for previous spm to complete + "andi r16,1 \n\t" + "cpi r16,1 \n\t" + "breq wait_spm3 \n\t" + "ldi r16,0x01 \n\t" //Load r0,r1 into FLASH page buffer + "sts %0,r16 \n\t" + "spm \n\t" + "inc r17 \n\t" //page_word_count++ + "cpi r17,%1 \n\t" + "brlo same_page \n\t" //Still same page in FLASH + "write_page: \n\t" + "clr r17 \n\t" //New page, write current one first + "wait_spm4: \n\t" + "lds r16,%0 \n\t" //Wait for previous spm to complete + "andi r16,1 \n\t" + "cpi r16,1 \n\t" + "breq wait_spm4 \n\t" +#ifdef __AVR_ATmega163__ + "andi r30,0x80 \n\t" // m163 requires Z6:Z1 to be zero during page write +#endif + "ldi r16,0x05 \n\t" //Write page pointed to by Z + "sts %0,r16 \n\t" + "spm \n\t" +#ifdef __AVR_ATmega163__ + ".word 0xFFFF \n\t" + "nop \n\t" + "ori r30,0x7E \n\t" // recover Z6:Z1 state after page write (had to be zero during write) +#endif + "wait_spm5: \n\t" + "lds r16,%0 \n\t" //Wait for previous spm to complete + "andi r16,1 \n\t" + "cpi r16,1 \n\t" + "breq wait_spm5 \n\t" + "ldi r16,0x11 \n\t" //Re-enable RWW section + "sts %0,r16 \n\t" + "spm \n\t" +#ifdef __AVR_ATmega163__ + ".word 0xFFFF \n\t" + "nop \n\t" +#endif + "same_page: \n\t" + "adiw r30,2 \n\t" //Next word in FLASH + "sbiw r24,2 \n\t" //length-2 + "breq final_write \n\t" //Finished + "rjmp length_loop \n\t" + "final_write: \n\t" + "cpi r17,0 \n\t" + "breq block_done \n\t" + "adiw r24,2 \n\t" //length+2, fool above check on length after short page write + "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__ || __AVR_ATmega1284P__ + : "=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" +#endif + ); + /* Should really add a wait for RWW section to be enabled, don't actually need it since we never */ + /* exit the bootloader without a power cycle anyhow */ + } + putch(0x14); + putch(0x10); + } + else + { + if (++error_count == MAX_ERROR_COUNT) + app_start(); + } + } + /* Read memory block mode, length is big endian. */ + else if(ch=='t') + { + length.byte[1] = getch(); + length.byte[0] = getch(); +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + if (address.word>0x7FFF) flags.rampz = 1; // No go with m256, FIXME + else flags.rampz = 0; +#endif + address.word = address.word << 1; // address * 2 -> byte location + if (getch() == 'E') flags.eeprom = 1; + else flags.eeprom = 0; + if (getch() == ' ') // Command terminator + { + 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__) + while(EECR & (1<<EEPE)); + EEAR = (uint16_t)(void *)address.word; + EECR |= (1<<EERE); + putch(EEDR); +#else + putch(eeprom_read_byte((void *)address.word)); +#endif + address.word++; + } + else + { + if (!flags.rampz) putch(pgm_read_byte_near(address.word)); +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + else putch(pgm_read_byte_far(address.word + 0x10000)); + // Hmmmm, yuck FIXME when m256 arrvies +#endif + address.word++; + } + } + putch(0x10); + } + } + /* Get device signature bytes */ + else if(ch=='u') + { + if (getch() == ' ') + { + putch(0x14); + putch(SIG1); + putch(SIG2); + putch(SIG3); + putch(0x10); + } + else + { + if (++error_count == MAX_ERROR_COUNT) + app_start(); + } + } + /* Read oscillator calibration byte */ + else if(ch=='v') + { + byte_response(0x00); + } +#if defined MONITOR + /* here come the extended monitor commands by Erik Lins */ + /* check for three times exclamation mark pressed */ + else if(ch=='!') + { + ch = getch(); + if(ch=='!') + { + ch = getch(); + if(ch=='!') + { + PGM_P welcome = ""; +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) + uint16_t extaddr; +#endif + uint8_t addrl, addrh; +#ifdef CRUMB128 + welcome = "ATmegaBOOT / Crumb128 - (C) J.P.Kyle, E.Lins - 050815\n\r"; +#elif defined PROBOMEGA128 + welcome = "ATmegaBOOT / PROBOmega128 - (C) J.P.Kyle, E.Lins - 050815\n\r"; +#elif defined SAVVY128 + welcome = "ATmegaBOOT / Savvy128 - (C) J.P.Kyle, E.Lins - 050815\n\r"; +#elif defined __AVR_ATmega1280__ + welcome = "ATmegaBOOT / Arduino Mega - (C) Arduino LLC - 090930\n\r"; +#endif + /* turn on LED */ + LED_DDR |= _BV(LED); + LED_PORT &= ~_BV(LED); + /* print a welcome message and command overview */ + for(i=0; welcome[i] != '\0'; ++i) + { + putch(welcome[i]); + } + /* test for valid commands */ + for(;;) + { + putch('\n'); + putch('\r'); + putch(':'); + putch(' '); + ch = getch(); + putch(ch); + /* toggle LED */ + if(ch == 't') + { + if(bit_is_set(LED_PIN,LED)) + { + LED_PORT &= ~_BV(LED); + putch('1'); + } + else + { + LED_PORT |= _BV(LED); + putch('0'); + } + } + /* read byte from address */ + else if(ch == 'r') + { + ch = getch(); + putch(ch); + addrh = gethex(); + addrl = gethex(); + putch('='); + ch = *(uint8_t *)((addrh << 8) + addrl); + puthex(ch); + } + /* write a byte to address */ + else if(ch == 'w') + { + ch = getch(); + putch(ch); + addrh = gethex(); + addrl = gethex(); + ch = getch(); + putch(ch); + ch = gethex(); + *(uint8_t *)((addrh << 8) + addrl) = ch; + } + /* read from uart and echo back */ + else if(ch == 'u') + { + for(;;) + { + putch(getch()); + } + } +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) + /* external bus loop */ + else if(ch == 'b') + { + putch('b'); + putch('u'); + putch('s'); + MCUCR = 0x80; + XMCRA = 0; + XMCRB = 0; + extaddr = 0x1100; + for(;;) + { + ch = *(volatile uint8_t *)extaddr; + if(++extaddr == 0) + { + extaddr = 0x1100; + } + } + } +#endif + else if(ch == 'j') + { + app_start(); + } + } /* end of monitor functions */ + } + } + } + /* end of monitor */ +#endif + else if (++error_count == MAX_ERROR_COUNT) + { + app_start(); + } + } /* end of forever loop */ +} + + +char gethexnib(void) +{ + char a; + a = getch(); + putch(a); + if(a >= 'a') + { + return (a - 'a' + 0x0a); + } + else if(a >= '0') + { + return(a - '0'); + } + return a; +} + + +char gethex(void) +{ + return (gethexnib() << 4) + gethexnib(); +} + + +void puthex(char ch) +{ + char ah; + ah = ch >> 4; + if(ah >= 0x0a) + { + ah = ah - 0x0a + 'a'; + } + else + { + ah += '0'; + } + ch &= 0x0f; + if(ch >= 0x0a) + { + ch = ch - 0x0a + 'a'; + } + else + { + ch += '0'; + } + putch(ah); + putch(ch); +} + + +void putch(char ch) +{ +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + if(bootuart == 1) + { + while (!(UCSR0A & _BV(UDRE0))); + UDR0 = ch; + } + else if (bootuart == 2) + { + while (!(UCSR1A & _BV(UDRE1))); + UDR1 = ch; + } +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) + while (!(UCSR0A & _BV(UDRE0))); + UDR0 = ch; +#else + /* m8,16,32,169,8515,8535,163 */ + while (!(UCSRA & _BV(UDRE))); + UDR = ch; +#endif +} + + +char getch(void) +{ +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + uint32_t count = 0; + if(bootuart == 1) + { + while(!(UCSR0A & _BV(RXC0))) + { + /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/ + /* HACKME:: here is a good place to count times*/ + count++; + if (count > MAX_TIME_COUNT) + app_start(); + } + return UDR0; + } + else if(bootuart == 2) + { + while(!(UCSR1A & _BV(RXC1))) + { + /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/ + /* HACKME:: here is a good place to count times*/ + count++; + if (count > MAX_TIME_COUNT) + app_start(); + } + return UDR1; + } + return 0; +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) + uint32_t count = 0; + while(!(UCSR0A & _BV(RXC0))) + { + /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/ + /* HACKME:: here is a good place to count times*/ + count++; + if (count > MAX_TIME_COUNT) + app_start(); + } + return UDR0; +#else + /* m8,16,32,169,8515,8535,163 */ + uint32_t count = 0; + while(!(UCSRA & _BV(RXC))) + { + /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/ + /* HACKME:: here is a good place to count times*/ + count++; + if (count > MAX_TIME_COUNT) + app_start(); + } + return UDR; +#endif +} + + +void getNch(uint8_t count) +{ + while(count--) + { +#if defined(__AVR_ATmega128__) || defined(__AVR_ATmega1280__) || defined(__AVR_ATmega1284P__) + if(bootuart == 1) + { + while(!(UCSR0A & _BV(RXC0))); + UDR0; + } + else if(bootuart == 2) + { + while(!(UCSR1A & _BV(RXC1))); + UDR1; + } +#elif defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) + getch(); +#else + /* m8,16,32,169,8515,8535,163 */ + /* 20060803 DojoCorp:: Addon coming from the previous Bootloader*/ + //while(!(UCSRA & _BV(RXC))); + //UDR; + getch(); // need to handle time out +#endif + } +} + + +void byte_response(uint8_t val) +{ + if (getch() == ' ') + { + putch(0x14); + putch(val); + putch(0x10); + } + else + { + if (++error_count == MAX_ERROR_COUNT) + app_start(); + } +} + + +void nothing_response(void) +{ + if (getch() == ' ') + { + putch(0x14); + putch(0x10); + } + else + { + if (++error_count == MAX_ERROR_COUNT) + app_start(); + } +} + +void flash_led(uint8_t count) +{ + while (count--) + { + LED_PORT |= _BV(LED); + _delay_ms(100); + LED_PORT &= ~_BV(LED); + _delay_ms(100); + } +} + + +/* end of file ATmegaBOOT.c */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/bootloaders/atmega/ATmegaBOOT_1284P.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,117 @@ +:020000021000EC +:10F800000C9446FC0C9465FC0C9465FC0C9465FC13 +:10F810000C9465FC0C9465FC0C9465FC0C9465FCE4 +:10F820000C9465FC0C9465FC0C9465FC0C9465FCD4 +:10F830000C9465FC0C9465FC0C9465FC0C9465FCC4 +:10F840000C9465FC0C9465FC0C9465FC0C9465FCB4 +:10F850000C9465FC0C9465FC0C9465FC0C9465FCA4 +:10F860000C9465FC0C9465FC0C9465FC0C9465FC94 +:10F870000C9465FC0C9465FC0C9465FC0C9465FC84 +:10F880000C9465FC0C9465FC0C9465FC11241FBE63 +:10F89000CFEFD0E4DEBFCDBF11E0A0E0B1E0E6E005 +:10F8A000FFEF01E00BBF02C007900D92A230B1073D +:10F8B000D9F712E0A2E0B1E001C01D92AD30B1076E +:10F8C000E1F70E945FFD0C9481FF0C9400FC909185 +:10F8D0000201913039F49091C00095FFFCCF8093E4 +:10F8E000C6000895923031F49091C80095FFFCCF86 +:10F8F0008093CE0008951F93982F95959595959593 +:10F900009595905D182F1F701A3014F0195A01C088 +:10F91000105D892F0E9467FC812F0E9467FC1F9158 +:10F920000895EF92FF920F931F938091020181300F +:10F93000F1F4EE24FF24870113C00894E11CF11CAC +:10F94000011D111D81E0E81682E1F8068AE708072B +:10F9500080E0180728F0E0910401F0910501099575 +:10F960008091C00087FFE9CF8091C60021C082301E +:10F97000F1F4EE24FF24870113C00894E11CF11C6C +:10F98000011D111D81E0E81682E1F8068AE70807EB +:10F9900080E0180728F0E0910401F0910501099535 +:10F9A0008091C80087FFE9CF8091CE0001C080E040 +:10F9B0001F910F91FF90EF9008951F930E9491FC6B +:10F9C000182F0E9467FC113614F0175503C010332E +:10F9D0000CF01053812F1F9108951F930E94DDFC9E +:10F9E000182F0E94DDFC1295107F810F1F91089542 +:10F9F0009091020112C0913039F42091C00027FF8C +:10FA0000FCCF2091C60008C0923031F42091C8008C +:10FA100027FFFCCF2091CE008150882361F7089505 +:10FA20001F93182F0E9491FC803251F484E10E94B0 +:10FA300067FC812F0E9467FC80E10E9467FC0CC07C +:10FA4000809103018F5F80930301853029F4E09159 +:10FA50000401F091050109951F9108950E9491FC00 +:10FA6000803239F484E10E9467FC80E10E9467FCE7 +:10FA70000895809103018F5F80930301853029F4FD +:10FA8000E0910401F09105010995089515C0289AA7 +:10FA90002FEF31EE44E0215030404040E1F700C00C +:10FAA000000028982FEF31EE44E0215030404040D4 +:10FAB000E1F700C000008150882349F70895BF9204 +:10FAC000CF92DF92EF92FF920F931F93CF93DF932A +:10FAD00094B714BE8091600088618093600010929A +:10FAE000600091FD05C0E0910401F09105010995C8 +:10FAF00081E08093020180E18093C4001092C500F0 +:10FB00001092C00086E08093C20088E18093C1001B +:10FB1000209A84E00E9446FDBB24B3940E9491FC8D +:10FB2000803309F441C08133E1F40E9491FC8032BA +:10FB300009F0C3C184E10E9467FC81E40E9467FC74 +:10FB400086E50E9467FC82E50E9467FC80E20E94D5 +:10FB500067FC89E40E9467FC83E50E9467FC80E5FE +:10FB600029C1803439F40E9491FC8638E8F00E9463 +:10FB700091FC1AC0813499F40E9491FC803811F4F0 +:10FB800082E098C1813811F481E094C1823811F487 +:10FB900080E190C1883909F08CC183E08BC1823447 +:10FBA00031F484E10E94F8FC0E942EFDB7CF853429 +:10FBB00011F485E0F7CF8035B9F38235A9F38135AB +:10FBC00031F40E942EFD88E080936000FFCF8535E0 +:10FBD00049F40E9491FC809306010E9491FC80935D +:10FBE0000701E2CF8635C9F40E9491FC803389F485 +:10FBF0000E9491FC0E9491FC082F0E9491FC00231E +:10FC000011F48EE157C1013011F487E953C185E049 +:10FC100051C183E00E94F8FC4CC1843609F0D0C089 +:10FC20000E9491FC809309020E9491FC809308023B +:10FC300080910C028E7F80930C020E9491FC85348F +:10FC400029F480910C02816080930C0258E0C52E4B +:10FC500051E0D52E760100E010E007C00E9491FC33 +:10FC6000F70181937F010F5F1F4F809108029091F0 +:10FC700009020817190790F30E9491FC803209F0DD +:10FC80001CC180910C0280FF29C0809106019091D7 +:10FC90000701880F991F909307018093060100E0E8 +:10FCA00010E014C0F60161916F01809106019091FE +:10FCB00007010E9473FF8091060190910701019650 +:10FCC00090930701809306010F5F1F4F80910802F8 +:10FCD000909109020817190728F36BC0809107015A +:10FCE000880F880B8B2180930B028BBF80910601BC +:10FCF00090910701880F991F909307018093060147 +:10FD00008091080280FF09C0809108029091090249 +:10FD100001969093090280930802F894F999FECF16 +:10FD20001127E0910601F0910701C8E0D1E0809130 +:10FD3000080290910902103091F40091570001706F +:10FD40000130D9F303E000935700E8950091570084 +:10FD500001700130D9F301E100935700E895099053 +:10FD600019900091570001700130D9F301E0009320 +:10FD70005700E8951395103898F011270091570017 +:10FD800001700130D9F305E000935700E895009128 +:10FD9000570001700130D9F301E100935700E89555 +:10FDA0003296029709F0C7CF103011F00296E5CFD6 +:10FDB000112484E10E9467FC80E10E9467FCAECEC2 +:10FDC000843709F063C00E9491FC809309020E946D +:10FDD00091FC809308028091060190910701209187 +:10FDE0000C0297FF02C0226001C02D7F20930C02FD +:10FDF000880F991F90930701809306010E9491FC40 +:10FE000020910C02853411F4216001C02E7F2093D3 +:10FE10000C020E9491FC803209F080CE84E10E94A5 +:10FE200067FC00E010E02AC080910C0280FF07C050 +:10FE300080910601909107010E946BFF12C0E09132 +:10FE40000601F091070181FD02C084910AC0CF0133 +:10FE5000A0E0B0E080509040AF4FBF4FABBFFC017F +:10FE600087910E9467FC809106019091070101969D +:10FE700090930701809306010F5F1F4F8091080246 +:10FE8000909109020817190778F296CF853779F40F +:10FE90000E9491FC803289F484E10E9467FC8EE12B +:10FEA0000E9467FC87E90E9467FC85E083CF863764 +:10FEB00021F480E00E9410FD31CE809103018F5F1C +:10FEC00080930301853009F029CEE0910401F0917F +:10FED0000501099523CEF999FECF92BD81BDF89A0F +:10FEE000992780B50895262FF999FECF1FBA92BDA4 +:10FEF00081BD20BD0FB6F894FA9AF99A0FBE01960B +:06FF00000895F894FFCF04 +:02FF0600800079 +:040000031000F800F1 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/bootloaders/atmega/ATmegaBOOT_1284P_8MHz.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,117 @@ +:020000021000EC +:10F800000C9446FC0C9465FC0C9465FC0C9465FC13 +:10F810000C9465FC0C9465FC0C9465FC0C9465FCE4 +:10F820000C9465FC0C9465FC0C9465FC0C9465FCD4 +:10F830000C9465FC0C9465FC0C9465FC0C9465FCC4 +:10F840000C9465FC0C9465FC0C9465FC0C9465FCB4 +:10F850000C9465FC0C9465FC0C9465FC0C9465FCA4 +:10F860000C9465FC0C9465FC0C9465FC0C9465FC94 +:10F870000C9465FC0C9465FC0C9465FC0C9465FC84 +:10F880000C9465FC0C9465FC0C9465FC11241FBE63 +:10F89000CFEFD0E4DEBFCDBF11E0A0E0B1E0E6E005 +:10F8A000FFEF01E00BBF02C007900D92A230B1073D +:10F8B000D9F712E0A2E0B1E001C01D92AD30B1076E +:10F8C000E1F70E945FFD0C9481FF0C9400FC909185 +:10F8D0000201913039F49091C00095FFFCCF8093E4 +:10F8E000C6000895923031F49091C80095FFFCCF86 +:10F8F0008093CE0008951F93982F95959595959593 +:10F900009595905D182F1F701A3014F0195A01C088 +:10F91000105D892F0E9467FC812F0E9467FC1F9158 +:10F920000895EF92FF920F931F938091020181300F +:10F93000F1F4EE24FF24870113C00894E11CF11CAC +:10F94000011D111D81E0E81689E0F8068DE3080726 +:10F9500080E0180728F0E0910401F0910501099575 +:10F960008091C00087FFE9CF8091C60021C082301E +:10F97000F1F4EE24FF24870113C00894E11CF11C6C +:10F98000011D111D81E0E81689E0F8068DE30807E6 +:10F9900080E0180728F0E0910401F0910501099535 +:10F9A0008091C80087FFE9CF8091CE0001C080E040 +:10F9B0001F910F91FF90EF9008951F930E9491FC6B +:10F9C000182F0E9467FC113614F0175503C010332E +:10F9D0000CF01053812F1F9108951F930E94DDFC9E +:10F9E000182F0E94DDFC1295107F810F1F91089542 +:10F9F0009091020112C0913039F42091C00027FF8C +:10FA0000FCCF2091C60008C0923031F42091C8008C +:10FA100027FFFCCF2091CE008150882361F7089505 +:10FA20001F93182F0E9491FC803251F484E10E94B0 +:10FA300067FC812F0E9467FC80E10E9467FC0CC07C +:10FA4000809103018F5F80930301853029F4E09159 +:10FA50000401F091050109951F9108950E9491FC00 +:10FA6000803239F484E10E9467FC80E10E9467FCE7 +:10FA70000895809103018F5F80930301853029F4FD +:10FA8000E0910401F09105010995089515C0289AA7 +:10FA90002FEF30E742E0215030404040E1F700C016 +:10FAA000000028982FEF30E742E0215030404040DE +:10FAB000E1F700C000008150882349F70895BF9204 +:10FAC000CF92DF92EF92FF920F931F93CF93DF932A +:10FAD00094B714BE8091600088618093600010929A +:10FAE000600091FD05C0E0910401F09105010995C8 +:10FAF00081E08093020180E18093C4001092C500F0 +:10FB00001092C00086E08093C20088E18093C1001B +:10FB1000209A84E00E9446FDBB24B3940E9491FC8D +:10FB2000803309F441C08133E1F40E9491FC8032BA +:10FB300009F0C3C184E10E9467FC81E40E9467FC74 +:10FB400086E50E9467FC82E50E9467FC80E20E94D5 +:10FB500067FC89E40E9467FC83E50E9467FC80E5FE +:10FB600029C1803439F40E9491FC8638E8F00E9463 +:10FB700091FC1AC0813499F40E9491FC803811F4F0 +:10FB800082E098C1813811F481E094C1823811F487 +:10FB900080E190C1883909F08CC183E08BC1823447 +:10FBA00031F484E10E94F8FC0E942EFDB7CF853429 +:10FBB00011F485E0F7CF8035B9F38235A9F38135AB +:10FBC00031F40E942EFD88E080936000FFCF8535E0 +:10FBD00049F40E9491FC809306010E9491FC80935D +:10FBE0000701E2CF8635C9F40E9491FC803389F485 +:10FBF0000E9491FC0E9491FC082F0E9491FC00231E +:10FC000011F48EE157C1013011F487E953C185E049 +:10FC100051C183E00E94F8FC4CC1843609F0D0C089 +:10FC20000E9491FC809309020E9491FC809308023B +:10FC300080910C028E7F80930C020E9491FC85348F +:10FC400029F480910C02816080930C0258E0C52E4B +:10FC500051E0D52E760100E010E007C00E9491FC33 +:10FC6000F70181937F010F5F1F4F809108029091F0 +:10FC700009020817190790F30E9491FC803209F0DD +:10FC80001CC180910C0280FF29C0809106019091D7 +:10FC90000701880F991F909307018093060100E0E8 +:10FCA00010E014C0F60161916F01809106019091FE +:10FCB00007010E9473FF8091060190910701019650 +:10FCC00090930701809306010F5F1F4F80910802F8 +:10FCD000909109020817190728F36BC0809107015A +:10FCE000880F880B8B2180930B028BBF80910601BC +:10FCF00090910701880F991F909307018093060147 +:10FD00008091080280FF09C0809108029091090249 +:10FD100001969093090280930802F894F999FECF16 +:10FD20001127E0910601F0910701C8E0D1E0809130 +:10FD3000080290910902103091F40091570001706F +:10FD40000130D9F303E000935700E8950091570084 +:10FD500001700130D9F301E100935700E895099053 +:10FD600019900091570001700130D9F301E0009320 +:10FD70005700E8951395103898F011270091570017 +:10FD800001700130D9F305E000935700E895009128 +:10FD9000570001700130D9F301E100935700E89555 +:10FDA0003296029709F0C7CF103011F00296E5CFD6 +:10FDB000112484E10E9467FC80E10E9467FCAECEC2 +:10FDC000843709F063C00E9491FC809309020E946D +:10FDD00091FC809308028091060190910701209187 +:10FDE0000C0297FF02C0226001C02D7F20930C02FD +:10FDF000880F991F90930701809306010E9491FC40 +:10FE000020910C02853411F4216001C02E7F2093D3 +:10FE10000C020E9491FC803209F080CE84E10E94A5 +:10FE200067FC00E010E02AC080910C0280FF07C050 +:10FE300080910601909107010E946BFF12C0E09132 +:10FE40000601F091070181FD02C084910AC0CF0133 +:10FE5000A0E0B0E080509040AF4FBF4FABBFFC017F +:10FE600087910E9467FC809106019091070101969D +:10FE700090930701809306010F5F1F4F8091080246 +:10FE8000909109020817190778F296CF853779F40F +:10FE90000E9491FC803289F484E10E9467FC8EE12B +:10FEA0000E9467FC87E90E9467FC85E083CF863764 +:10FEB00021F480E00E9410FD31CE809103018F5F1C +:10FEC00080930301853009F029CEE0910401F0917F +:10FED0000501099523CEF999FECF92BD81BDF89A0F +:10FEE000992780B50895262FF999FECF1FBA92BDA4 +:10FEF00081BD20BD0FB6F894FA9AF99A0FBE01960B +:06FF00000895F894FFCF04 +:02FF0600800079 +:040000031000F800F1 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/bootloaders/atmega/Makefile Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,56 @@ +# Makefile for ATmegaBOOT +# E.Lins, 18.7.2005 +# $Id$ + + +# program name should not be changed... +PROGRAM = ATmegaBOOT_1284P + +# enter the target CPU frequency +AVR_FREQ = 16000000L + +MCU_TARGET = atmega1284p +LDSECTION = --section-start=.text=0x1F800 + +OBJ = $(PROGRAM).o +OPTIMIZE = -Os + +DEFS = -DWATCHDOG_MODS -DBAUD_RATE=57600 +LIBS = + +CC = avr-gcc + + +# Override is only needed by avr-lib build system. + +override CFLAGS = -Wall $(OPTIMIZE) -mmcu=$(MCU_TARGET) -DF_CPU=$(AVR_FREQ) $(DEFS) +override LDFLAGS = -Wl,$(LDSECTION) +#override LDFLAGS = -Wl,-Map,$(PROGRAM).map,$(LDSECTION) + +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump + +all: CFLAGS += '-DMAX_TIME_COUNT=16000000L>>1' -DADABOOT +all: $(PROGRAM).hex + +$(PROGRAM).hex: $(PROGRAM).elf + $(OBJCOPY) -j .text -j .data -O ihex $< $@ + +$(PROGRAM).elf: $(OBJ) + $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + +$(OBJ): ATmegaBOOT.c + avr-gcc $(CFLAGS) $(LDFLAGS) -c -Wall -mmcu=$(MCU_TARGET) ATmegaBOOT.c -o $(PROGRAM).o + +%.lst: %.elf + $(OBJDUMP) -h -S $< > $@ + +%.srec: %.elf + $(OBJCOPY) -j .text -j .data -O srec $< $@ + +%.bin: %.elf + $(OBJCOPY) -j .text -j .data -O binary $< $@ + +clean: + rm -rf *.o *.elf *.lst *.map *.sym *.lss *.eep *.srec *.bin *.hex +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Arduino.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,215 @@ +#ifndef Arduino_h +#define Arduino_h + +#include <stdlib.h> +#include <string.h> +#include <math.h> + +#include <avr/pgmspace.h> +#include <avr/io.h> +#include <avr/interrupt.h> + +#include "binary.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#define HIGH 0x1 +#define LOW 0x0 + +#define INPUT 0x0 +#define OUTPUT 0x1 +#define INPUT_PULLUP 0x2 + +#define true 0x1 +#define false 0x0 + +#define PI 3.1415926535897932384626433832795 +#define HALF_PI 1.5707963267948966192313216916398 +#define TWO_PI 6.283185307179586476925286766559 +#define DEG_TO_RAD 0.017453292519943295769236907684886 +#define RAD_TO_DEG 57.295779513082320876798154814105 + +#define SERIAL 0x0 +#define DISPLAY 0x1 + +#define LSBFIRST 0 +#define MSBFIRST 1 + +#define CHANGE 1 +#define FALLING 2 +#define RISING 3 + +#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) || defined(__AVR_ATtiny25__) || defined(__AVR_ATtiny45__) || defined(__AVR_ATtiny85__) +#define DEFAULT 0 +#define EXTERNAL 1 +#define INTERNAL 2 +#else +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega644P__) +#define INTERNAL1V1 2 +#define INTERNAL2V56 3 +#else +#define INTERNAL 3 +#endif +#define DEFAULT 1 +#define EXTERNAL 0 +#endif + +// undefine stdlib's abs if encountered +#ifdef abs +#undef abs +#endif + +#define min(a,b) ((a)<(b)?(a):(b)) +#define max(a,b) ((a)>(b)?(a):(b)) +#define abs(x) ((x)>0?(x):-(x)) +#define constrain(amt,low,high) ((amt)<(low)?(low):((amt)>(high)?(high):(amt))) +#define round(x) ((x)>=0?(long)((x)+0.5):(long)((x)-0.5)) +#define radians(deg) ((deg)*DEG_TO_RAD) +#define degrees(rad) ((rad)*RAD_TO_DEG) +#define sq(x) ((x)*(x)) + +#define interrupts() sei() +#define noInterrupts() cli() + +#define clockCyclesPerMicrosecond() ( F_CPU / 1000000L ) +#define clockCyclesToMicroseconds(a) ( (a) / clockCyclesPerMicrosecond() ) +#define microsecondsToClockCycles(a) ( (a) * clockCyclesPerMicrosecond() ) + +#define lowByte(w) ((uint8_t) ((w) & 0xff)) +#define highByte(w) ((uint8_t) ((w) >> 8)) + +#define bitRead(value, bit) (((value) >> (bit)) & 0x01) +#define bitSet(value, bit) ((value) |= (1UL << (bit))) +#define bitClear(value, bit) ((value) &= ~(1UL << (bit))) +#define bitWrite(value, bit, bitvalue) (bitvalue ? bitSet(value, bit) : bitClear(value, bit)) + + +typedef unsigned int word; + +#define bit(b) (1UL << (b)) + +typedef uint8_t boolean; +typedef uint8_t byte; + +void init(void); + +void pinMode(uint8_t, uint8_t); +void digitalWrite(uint8_t, uint8_t); +int digitalRead(uint8_t); +int analogRead(uint8_t); +void analogReference(uint8_t mode); +void analogWrite(uint8_t, int); + +unsigned long millis(void); +unsigned long micros(void); +void delay(unsigned long); +void delayMicroseconds(unsigned int us); +unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout); + +void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val); +uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder); + +void attachInterrupt(uint8_t, void (*)(void), int mode); +void detachInterrupt(uint8_t); + +void setup(void); +void loop(void); + +// Get the bit location within the hardware port of the given virtual pin. +// This comes from the pins_*.c file for the active board configuration. + +#define analogInPinToBit(P) (P) + +// On the ATmega1280, the addresses of some of the port registers are +// greater than 255, so we can't store them in uint8_t's. +extern const uint16_t PROGMEM port_to_mode_PGM[]; +extern const uint16_t PROGMEM port_to_input_PGM[]; +extern const uint16_t PROGMEM port_to_output_PGM[]; + +extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; +// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; +extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; +extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; + +// Get the bit location within the hardware port of the given virtual pin. +// This comes from the pins_*.c file for the active board configuration. +// +// These perform slightly better as macros compared to inline functions +// +#define digitalPinToPort(P) ( pgm_read_byte( digital_pin_to_port_PGM + (P) ) ) +#define digitalPinToBitMask(P) ( pgm_read_byte( digital_pin_to_bit_mask_PGM + (P) ) ) +#define digitalPinToTimer(P) ( pgm_read_byte( digital_pin_to_timer_PGM + (P) ) ) +#define analogInPinToBit(P) (P) +#define portOutputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_output_PGM + (P))) ) +#define portInputRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) ) +#define portModeRegister(P) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) ) + +#define NOT_A_PIN 0 +#define NOT_A_PORT 0 + +#ifdef ARDUINO_MAIN +#define PA 1 +#define PB 2 +#define PC 3 +#define PD 4 +#define PE 5 +#define PF 6 +#define PG 7 +#define PH 8 +#define PJ 10 +#define PK 11 +#define PL 12 +#endif + +#define NOT_ON_TIMER 0 +#define TIMER0A 1 +#define TIMER0B 2 +#define TIMER1A 3 +#define TIMER1B 4 +#define TIMER2 5 +#define TIMER2A 6 +#define TIMER2B 7 + +#define TIMER3A 8 +#define TIMER3B 9 +#define TIMER3C 10 +#define TIMER4A 11 +#define TIMER4B 12 +#define TIMER4C 13 +#define TIMER4D 14 +#define TIMER5A 15 +#define TIMER5B 16 +#define TIMER5C 17 + +#ifdef __cplusplus +} // extern "C" +#endif + +#ifdef __cplusplus +#include "WCharacter.h" +#include "WString.h" +#include "HardwareSerial.h" + +uint16_t makeWord(uint16_t w); +uint16_t makeWord(byte h, byte l); + +#define word(...) makeWord(__VA_ARGS__) + +unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout = 1000000L); + +void tone(uint8_t _pin, unsigned int frequency, unsigned long duration = 0); +void noTone(uint8_t _pin); + +// WMath prototypes +long random(long); +long random(long, long); +void randomSeed(unsigned int); +long map(long, long, long, long, long); + +#endif + +#include "pins_arduino.h" + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/CDC.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,233 @@ + + +/* 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 "Platform.h" +#include "USBAPI.h" +#include <avr/wdt.h> + +#if defined(USBCON) +#ifdef CDC_ENABLED + +#if (RAMEND < 1000) +#define SERIAL_BUFFER_SIZE 16 +#else +#define SERIAL_BUFFER_SIZE 64 +#endif + +struct ring_buffer +{ + unsigned char buffer[SERIAL_BUFFER_SIZE]; + volatile int head; + volatile int tail; +}; + +ring_buffer cdc_rx_buffer = { { 0 }, 0, 0}; + +typedef struct +{ + u32 dwDTERate; + u8 bCharFormat; + u8 bParityType; + u8 bDataBits; + u8 lineState; +} LineInfo; + +static volatile LineInfo _usbLineInfo = { 57600, 0x00, 0x00, 0x00, 0x00 }; + +#define WEAK __attribute__ ((weak)) + +extern const CDCDescriptor _cdcInterface PROGMEM; +const CDCDescriptor _cdcInterface = +{ + D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1), + + // CDC communication interface + D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), + D_CDCCS(CDC_HEADER,0x10,0x01), // Header (1.10 bcd) + D_CDCCS(CDC_CALL_MANAGEMENT,1,1), // Device handles call management (not) + D_CDCCS4(CDC_ABSTRACT_CONTROL_MANAGEMENT,6), // SET_LINE_CODING, GET_LINE_CODING, SET_CONTROL_LINE_STATE supported + D_CDCCS(CDC_UNION,CDC_ACM_INTERFACE,CDC_DATA_INTERFACE), // Communication interface is master, data interface is slave 0 + D_ENDPOINT(USB_ENDPOINT_IN (CDC_ENDPOINT_ACM),USB_ENDPOINT_TYPE_INTERRUPT,0x10,0x40), + + // 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) +}; + +int WEAK CDC_GetInterface(u8* interfaceNum) +{ + interfaceNum[0] += 2; // uses 2 + return USB_SendControl(TRANSFER_PGM,&_cdcInterface,sizeof(_cdcInterface)); +} + +bool WEAK CDC_Setup(Setup& setup) +{ + u8 r = setup.bRequest; + u8 requestType = setup.bmRequestType; + + if (REQUEST_DEVICETOHOST_CLASS_INTERFACE == requestType) + { + if (CDC_GET_LINE_CODING == r) + { + USB_SendControl(0,(void*)&_usbLineInfo,7); + return true; + } + } + + if (REQUEST_HOSTTODEVICE_CLASS_INTERFACE == requestType) + { + if (CDC_SET_LINE_CODING == r) + { + USB_RecvControl((void*)&_usbLineInfo,7); + return true; + } + + if (CDC_SET_CONTROL_LINE_STATE == r) + { + _usbLineInfo.lineState = setup.wValueL; + + // auto-reset into the bootloader is triggered when the port, already + // open at 1200 bps, is closed. this is the signal to start the watchdog + // with a relatively long period so it can finish housekeeping tasks + // like servicing endpoints before the sketch ends + if (1200 == _usbLineInfo.dwDTERate) { + // We check DTR state to determine if host port is open (bit 0 of lineState). + if ((_usbLineInfo.lineState & 0x01) == 0) { + *(uint16_t *)0x0800 = 0x7777; + wdt_enable(WDTO_120MS); + } else { + // Most OSs do some intermediate steps when configuring ports and DTR can + // twiggle more than once before stabilizing. + // To avoid spurious resets we set the watchdog to 250ms and eventually + // cancel if DTR goes back high. + + wdt_disable(); + wdt_reset(); + *(uint16_t *)0x0800 = 0x0; + } + } + return true; + } + } + return false; +} + + +int _serialPeek = -1; +void Serial_::begin(uint16_t baud_count) +{ +} + +void Serial_::end(void) +{ +} + +void Serial_::accept(void) +{ + ring_buffer *buffer = &cdc_rx_buffer; + int c = USB_Recv(CDC_RX); + int i = (unsigned int)(buffer->head+1) % SERIAL_BUFFER_SIZE; + + // if we should be storing the received character into the location + // just before the tail (meaning that the head would advance to the + // current location of the tail), we're about to overflow the buffer + // and so we don't write the character or advance the head. + if (i != buffer->tail) { + buffer->buffer[buffer->head] = c; + buffer->head = i; + } +} + +int Serial_::available(void) +{ + ring_buffer *buffer = &cdc_rx_buffer; + return (unsigned int)(SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % SERIAL_BUFFER_SIZE; +} + +int Serial_::peek(void) +{ + ring_buffer *buffer = &cdc_rx_buffer; + if (buffer->head == buffer->tail) { + return -1; + } else { + return buffer->buffer[buffer->tail]; + } +} + +int Serial_::read(void) +{ + ring_buffer *buffer = &cdc_rx_buffer; + // if the head isn't ahead of the tail, we don't have any characters + if (buffer->head == buffer->tail) { + return -1; + } else { + unsigned char c = buffer->buffer[buffer->tail]; + buffer->tail = (unsigned int)(buffer->tail + 1) % SERIAL_BUFFER_SIZE; + return c; + } +} + +void Serial_::flush(void) +{ + USB_Flush(CDC_TX); +} + +size_t Serial_::write(uint8_t c) +{ + /* only try to send bytes if the high-level CDC connection itself + is open (not just the pipe) - the OS should set lineState when the port + is opened and clear lineState when the port is closed. + bytes sent before the user opens the connection or after + the connection is closed are lost - just like with a UART. */ + + // TODO - ZE - check behavior on different OSes and test what happens if an + // open connection isn't broken cleanly (cable is yanked out, host dies + // or locks up, or host virtual serial port hangs) + if (_usbLineInfo.lineState > 0) { + int r = USB_Send(CDC_TX,&c,1); + if (r > 0) { + return r; + } else { + setWriteError(); + return 0; + } + } + setWriteError(); + return 0; +} + +// This operator is a convenient way for a sketch to check whether the +// port has actually been configured and opened by the host (as opposed +// to just being connected to the host). It can be used, for example, in +// setup() before printing to ensure that an application on the host is +// actually ready to receive and display the data. +// We add a short delay before returning to fix a bug observed by Federico +// where the port is configured (lineState != 0) but not quite opened. +Serial_::operator bool() { + bool result = false; + if (_usbLineInfo.lineState > 0) + result = true; + delay(10); + return result; +} + +Serial_ Serial; + +#endif +#endif /* if defined(USBCON) */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Client.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,26 @@ +#ifndef client_h +#define client_h +#include "Print.h" +#include "Stream.h" +#include "IPAddress.h" + +class Client : public Stream { + +public: + virtual int connect(IPAddress ip, uint16_t port) =0; + virtual int connect(const char *host, uint16_t port) =0; + virtual size_t write(uint8_t) =0; + virtual size_t write(const uint8_t *buf, size_t size) =0; + virtual int available() = 0; + virtual int read() = 0; + virtual int read(uint8_t *buf, size_t size) = 0; + virtual int peek() = 0; + virtual void flush() = 0; + virtual void stop() = 0; + virtual uint8_t connected() = 0; + virtual operator bool() = 0; +protected: + uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/HID.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,520 @@ + + +/* 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 "Platform.h" +#include "USBAPI.h" +#include "USBDesc.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 + +#if 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 + uint8_t r = release(c); // Keyup + return (p); // just return the result of press() since release() almost always returns 1 +} + +#endif + +#endif /* if defined(USBCON) */ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/HardwareSerial.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,428 @@ +/* + HardwareSerial.cpp - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + 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 + + Modified 23 November 2006 by David A. Mellis + Modified 28 September 2010 by Mark Sproul +*/ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <inttypes.h> +#include "Arduino.h" +#include "wiring_private.h" + +// this next line disables the entire HardwareSerial.cpp, +// this is so I can support Attiny series and any other chip without a uart +#if defined(UBRRH) || defined(UBRR0H) || defined(UBRR1H) || defined(UBRR2H) || defined(UBRR3H) + +#include "HardwareSerial.h" + +// Define constants and variables for buffering incoming serial data. We're +// using a ring buffer (I think), in which head is the index of the location +// to which to write the next incoming character and tail is the index of the +// location from which to read. +#if (RAMEND < 1000) + #define SERIAL_BUFFER_SIZE 16 +#else + #define SERIAL_BUFFER_SIZE 64 +#endif + +struct ring_buffer +{ + unsigned char buffer[SERIAL_BUFFER_SIZE]; + volatile unsigned int head; + volatile unsigned int tail; +}; + +#if defined(USBCON) + ring_buffer rx_buffer = { { 0 }, 0, 0}; + ring_buffer tx_buffer = { { 0 }, 0, 0}; +#endif +#if defined(UBRRH) || defined(UBRR0H) + ring_buffer rx_buffer = { { 0 }, 0, 0 }; + ring_buffer tx_buffer = { { 0 }, 0, 0 }; +#endif +#if defined(UBRR1H) + ring_buffer rx_buffer1 = { { 0 }, 0, 0 }; + ring_buffer tx_buffer1 = { { 0 }, 0, 0 }; +#endif +#if defined(UBRR2H) + ring_buffer rx_buffer2 = { { 0 }, 0, 0 }; + ring_buffer tx_buffer2 = { { 0 }, 0, 0 }; +#endif +#if defined(UBRR3H) + ring_buffer rx_buffer3 = { { 0 }, 0, 0 }; + ring_buffer tx_buffer3 = { { 0 }, 0, 0 }; +#endif + +inline void store_char(unsigned char c, ring_buffer *buffer) +{ + int i = (unsigned int)(buffer->head + 1) % SERIAL_BUFFER_SIZE; + + // if we should be storing the received character into the location + // just before the tail (meaning that the head would advance to the + // current location of the tail), we're about to overflow the buffer + // and so we don't write the character or advance the head. + if (i != buffer->tail) { + buffer->buffer[buffer->head] = c; + buffer->head = i; + } +} + +#if !defined(USART0_RX_vect) && defined(USART1_RX_vect) +// do nothing - on the 32u4 the first USART is USART1 +#else +#if !defined(USART_RX_vect) && !defined(SIG_USART0_RECV) && \ + !defined(SIG_UART0_RECV) && !defined(USART0_RX_vect) && \ + !defined(SIG_UART_RECV) + #error "Don't know what the Data Received vector is called for the first UART" +#else + void serialEvent() __attribute__((weak)); + void serialEvent() {} + #define serialEvent_implemented +#if defined(USART_RX_vect) + SIGNAL(USART_RX_vect) +#elif defined(SIG_USART0_RECV) + SIGNAL(SIG_USART0_RECV) +#elif defined(SIG_UART0_RECV) + SIGNAL(SIG_UART0_RECV) +#elif defined(USART0_RX_vect) + SIGNAL(USART0_RX_vect) +#elif defined(SIG_UART_RECV) + SIGNAL(SIG_UART_RECV) +#endif + { + #if defined(UDR0) + unsigned char c = UDR0; + #elif defined(UDR) + unsigned char c = UDR; + #else + #error UDR not defined + #endif + store_char(c, &rx_buffer); + } +#endif +#endif + +#if defined(USART1_RX_vect) + void serialEvent1() __attribute__((weak)); + void serialEvent1() {} + #define serialEvent1_implemented + SIGNAL(USART1_RX_vect) + { + unsigned char c = UDR1; + store_char(c, &rx_buffer1); + } +#elif defined(SIG_USART1_RECV) + #error SIG_USART1_RECV +#endif + +#if defined(USART2_RX_vect) && defined(UDR2) + void serialEvent2() __attribute__((weak)); + void serialEvent2() {} + #define serialEvent2_implemented + SIGNAL(USART2_RX_vect) + { + unsigned char c = UDR2; + store_char(c, &rx_buffer2); + } +#elif defined(SIG_USART2_RECV) + #error SIG_USART2_RECV +#endif + +#if defined(USART3_RX_vect) && defined(UDR3) + void serialEvent3() __attribute__((weak)); + void serialEvent3() {} + #define serialEvent3_implemented + SIGNAL(USART3_RX_vect) + { + unsigned char c = UDR3; + store_char(c, &rx_buffer3); + } +#elif defined(SIG_USART3_RECV) + #error SIG_USART3_RECV +#endif + +void serialEventRun(void) +{ +#ifdef serialEvent_implemented + if (Serial.available()) serialEvent(); +#endif +#ifdef serialEvent1_implemented + if (Serial1.available()) serialEvent1(); +#endif +#ifdef serialEvent2_implemented + if (Serial2.available()) serialEvent2(); +#endif +#ifdef serialEvent3_implemented + if (Serial3.available()) serialEvent3(); +#endif +} + + +#if !defined(USART0_UDRE_vect) && defined(USART1_UDRE_vect) +// do nothing - on the 32u4 the first USART is USART1 +#else +#if !defined(UART0_UDRE_vect) && !defined(UART_UDRE_vect) && !defined(USART0_UDRE_vect) && !defined(USART_UDRE_vect) + #error "Don't know what the Data Register Empty vector is called for the first UART" +#else +#if defined(UART0_UDRE_vect) +ISR(UART0_UDRE_vect) +#elif defined(UART_UDRE_vect) +ISR(UART_UDRE_vect) +#elif defined(USART0_UDRE_vect) +ISR(USART0_UDRE_vect) +#elif defined(USART_UDRE_vect) +ISR(USART_UDRE_vect) +#endif +{ + if (tx_buffer.head == tx_buffer.tail) { + // Buffer empty, so disable interrupts +#if defined(UCSR0B) + cbi(UCSR0B, UDRIE0); +#else + cbi(UCSRB, UDRIE); +#endif + } + else { + // There is more data in the output buffer. Send the next byte + unsigned char c = tx_buffer.buffer[tx_buffer.tail]; + tx_buffer.tail = (tx_buffer.tail + 1) % SERIAL_BUFFER_SIZE; + + #if defined(UDR0) + UDR0 = c; + #elif defined(UDR) + UDR = c; + #else + #error UDR not defined + #endif + } +} +#endif +#endif + +#ifdef USART1_UDRE_vect +ISR(USART1_UDRE_vect) +{ + if (tx_buffer1.head == tx_buffer1.tail) { + // Buffer empty, so disable interrupts + cbi(UCSR1B, UDRIE1); + } + else { + // There is more data in the output buffer. Send the next byte + unsigned char c = tx_buffer1.buffer[tx_buffer1.tail]; + tx_buffer1.tail = (tx_buffer1.tail + 1) % SERIAL_BUFFER_SIZE; + + UDR1 = c; + } +} +#endif + +#ifdef USART2_UDRE_vect +ISR(USART2_UDRE_vect) +{ + if (tx_buffer2.head == tx_buffer2.tail) { + // Buffer empty, so disable interrupts + cbi(UCSR2B, UDRIE2); + } + else { + // There is more data in the output buffer. Send the next byte + unsigned char c = tx_buffer2.buffer[tx_buffer2.tail]; + tx_buffer2.tail = (tx_buffer2.tail + 1) % SERIAL_BUFFER_SIZE; + + UDR2 = c; + } +} +#endif + +#ifdef USART3_UDRE_vect +ISR(USART3_UDRE_vect) +{ + if (tx_buffer3.head == tx_buffer3.tail) { + // Buffer empty, so disable interrupts + cbi(UCSR3B, UDRIE3); + } + else { + // There is more data in the output buffer. Send the next byte + unsigned char c = tx_buffer3.buffer[tx_buffer3.tail]; + tx_buffer3.tail = (tx_buffer3.tail + 1) % SERIAL_BUFFER_SIZE; + + UDR3 = c; + } +} +#endif + + +// Constructors //////////////////////////////////////////////////////////////// + +HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer, + volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, + volatile uint8_t *ucsra, volatile uint8_t *ucsrb, + volatile uint8_t *udr, + uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x) +{ + _rx_buffer = rx_buffer; + _tx_buffer = tx_buffer; + _ubrrh = ubrrh; + _ubrrl = ubrrl; + _ucsra = ucsra; + _ucsrb = ucsrb; + _udr = udr; + _rxen = rxen; + _txen = txen; + _rxcie = rxcie; + _udrie = udrie; + _u2x = u2x; +} + +// Public Methods ////////////////////////////////////////////////////////////// + +void HardwareSerial::begin(unsigned long baud) +{ + uint16_t baud_setting; + bool use_u2x = true; + +#if F_CPU == 16000000UL + // hardcoded exception for compatibility with the bootloader shipped + // with the Duemilanove and previous boards and the firmware on the 8U2 + // on the Uno and Mega 2560. + if (baud == 57600) { + use_u2x = false; + } +#endif + +try_again: + + if (use_u2x) { + *_ucsra = 1 << _u2x; + baud_setting = (F_CPU / 4 / baud - 1) / 2; + } else { + *_ucsra = 0; + baud_setting = (F_CPU / 8 / baud - 1) / 2; + } + + if ((baud_setting > 4095) && use_u2x) + { + use_u2x = false; + goto try_again; + } + + // assign the baud_setting, a.k.a. ubbr (USART Baud Rate Register) + *_ubrrh = baud_setting >> 8; + *_ubrrl = baud_setting; + + sbi(*_ucsrb, _rxen); + sbi(*_ucsrb, _txen); + sbi(*_ucsrb, _rxcie); + cbi(*_ucsrb, _udrie); +} + +void HardwareSerial::end() +{ + // wait for transmission of outgoing data + while (_tx_buffer->head != _tx_buffer->tail) + ; + + cbi(*_ucsrb, _rxen); + cbi(*_ucsrb, _txen); + cbi(*_ucsrb, _rxcie); + cbi(*_ucsrb, _udrie); + + // clear any received data + _rx_buffer->head = _rx_buffer->tail; +} + +int HardwareSerial::available(void) +{ + return (unsigned int)(SERIAL_BUFFER_SIZE + _rx_buffer->head - _rx_buffer->tail) % SERIAL_BUFFER_SIZE; +} + +int HardwareSerial::peek(void) +{ + if (_rx_buffer->head == _rx_buffer->tail) { + return -1; + } else { + return _rx_buffer->buffer[_rx_buffer->tail]; + } +} + +int HardwareSerial::read(void) +{ + // if the head isn't ahead of the tail, we don't have any characters + if (_rx_buffer->head == _rx_buffer->tail) { + return -1; + } else { + unsigned char c = _rx_buffer->buffer[_rx_buffer->tail]; + _rx_buffer->tail = (unsigned int)(_rx_buffer->tail + 1) % SERIAL_BUFFER_SIZE; + return c; + } +} + +void HardwareSerial::flush() +{ + while (_tx_buffer->head != _tx_buffer->tail) + ; +} + +size_t HardwareSerial::write(uint8_t c) +{ + int i = (_tx_buffer->head + 1) % SERIAL_BUFFER_SIZE; + + // If the output buffer is full, there's nothing for it other than to + // wait for the interrupt handler to empty it a bit + // ???: return 0 here instead? + while (i == _tx_buffer->tail) + ; + + _tx_buffer->buffer[_tx_buffer->head] = c; + _tx_buffer->head = i; + + sbi(*_ucsrb, _udrie); + + return 1; +} + +HardwareSerial::operator bool() { + return true; +} + +// Preinstantiate Objects ////////////////////////////////////////////////////// + +#if defined(UBRRH) && defined(UBRRL) + HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRRH, &UBRRL, &UCSRA, &UCSRB, &UDR, RXEN, TXEN, RXCIE, UDRIE, U2X); +#elif defined(UBRR0H) && defined(UBRR0L) + HardwareSerial Serial(&rx_buffer, &tx_buffer, &UBRR0H, &UBRR0L, &UCSR0A, &UCSR0B, &UDR0, RXEN0, TXEN0, RXCIE0, UDRIE0, U2X0); +#elif defined(USBCON) + // do nothing - Serial object and buffers are initialized in CDC code +#else + #error no serial port defined (port 0) +#endif + +#if defined(UBRR1H) + HardwareSerial Serial1(&rx_buffer1, &tx_buffer1, &UBRR1H, &UBRR1L, &UCSR1A, &UCSR1B, &UDR1, RXEN1, TXEN1, RXCIE1, UDRIE1, U2X1); +#endif +#if defined(UBRR2H) + HardwareSerial Serial2(&rx_buffer2, &tx_buffer2, &UBRR2H, &UBRR2L, &UCSR2A, &UCSR2B, &UDR2, RXEN2, TXEN2, RXCIE2, UDRIE2, U2X2); +#endif +#if defined(UBRR3H) + HardwareSerial Serial3(&rx_buffer3, &tx_buffer3, &UBRR3H, &UBRR3L, &UCSR3A, &UCSR3B, &UDR3, RXEN3, TXEN3, RXCIE3, UDRIE3, U2X3); +#endif + +#endif // whole file +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/HardwareSerial.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,81 @@ +/* + HardwareSerial.h - Hardware serial library for Wiring + Copyright (c) 2006 Nicholas Zambetti. All right reserved. + + 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 + + Modified 28 September 2010 by Mark Sproul +*/ + +#ifndef HardwareSerial_h +#define HardwareSerial_h + +#include <inttypes.h> + +#include "Stream.h" + +struct ring_buffer; + +class HardwareSerial : public Stream +{ + private: + ring_buffer *_rx_buffer; + ring_buffer *_tx_buffer; + volatile uint8_t *_ubrrh; + volatile uint8_t *_ubrrl; + volatile uint8_t *_ucsra; + volatile uint8_t *_ucsrb; + volatile uint8_t *_udr; + uint8_t _rxen; + uint8_t _txen; + uint8_t _rxcie; + uint8_t _udrie; + uint8_t _u2x; + public: + HardwareSerial(ring_buffer *rx_buffer, ring_buffer *tx_buffer, + volatile uint8_t *ubrrh, volatile uint8_t *ubrrl, + volatile uint8_t *ucsra, volatile uint8_t *ucsrb, + volatile uint8_t *udr, + uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udrie, uint8_t u2x); + void begin(unsigned long); + void end(); + virtual int available(void); + virtual int peek(void); + virtual int read(void); + virtual void flush(void); + virtual size_t write(uint8_t); + using Print::write; // pull in write(str) and write(buf, size) from Print + operator bool(); +}; + +#if defined(UBRRH) || defined(UBRR0H) + extern HardwareSerial Serial; +#elif defined(USBCON) + #include "USBAPI.h" +// extern HardwareSerial Serial_; +#endif +#if defined(UBRR1H) + extern HardwareSerial Serial1; +#endif +#if defined(UBRR2H) + extern HardwareSerial Serial2; +#endif +#if defined(UBRR3H) + extern HardwareSerial Serial3; +#endif + +extern void serialEventRun(void) __attribute__((weak)); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/IPAddress.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,56 @@ + +#include <Arduino.h> +#include <IPAddress.h> + +IPAddress::IPAddress() +{ + memset(_address, 0, sizeof(_address)); +} + +IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet) +{ + _address[0] = first_octet; + _address[1] = second_octet; + _address[2] = third_octet; + _address[3] = fourth_octet; +} + +IPAddress::IPAddress(uint32_t address) +{ + memcpy(_address, &address, sizeof(_address)); +} + +IPAddress::IPAddress(const uint8_t *address) +{ + memcpy(_address, address, sizeof(_address)); +} + +IPAddress& IPAddress::operator=(const uint8_t *address) +{ + memcpy(_address, address, sizeof(_address)); + return *this; +} + +IPAddress& IPAddress::operator=(uint32_t address) +{ + memcpy(_address, (const uint8_t *)&address, sizeof(_address)); + return *this; +} + +bool IPAddress::operator==(const uint8_t* addr) +{ + return memcmp(addr, _address, sizeof(_address)) == 0; +} + +size_t IPAddress::printTo(Print& p) const +{ + size_t n = 0; + for (int i =0; i < 3; i++) + { + n += p.print(_address[i], DEC); + n += p.print('.'); + } + n += p.print(_address[3], DEC); + return n; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/IPAddress.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,76 @@ +/* + * + * MIT License: + * Copyright (c) 2011 Adrian McEwen + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * adrianm@mcqn.com 1/1/2011 + */ + +#ifndef IPAddress_h +#define IPAddress_h + +#include <Printable.h> + +// A class to make it easier to handle and pass around IP addresses + +class IPAddress : public Printable { +private: + uint8_t _address[4]; // IPv4 address + // Access the raw byte array containing the address. Because this returns a pointer + // to the internal structure rather than a copy of the address this function should only + // be used when you know that the usage of the returned uint8_t* will be transient and not + // stored. + uint8_t* raw_address() { return _address; }; + +public: + // Constructors + IPAddress(); + IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet); + IPAddress(uint32_t address); + IPAddress(const uint8_t *address); + + // 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() { return *((uint32_t*)_address); }; + bool operator==(const IPAddress& addr) { return (*((uint32_t*)_address)) == (*((uint32_t*)addr._address)); }; + bool operator==(const uint8_t* addr); + + // Overloaded index operator to allow getting and setting individual octets of the address + uint8_t operator[](int index) const { return _address[index]; }; + uint8_t& operator[](int index) { return _address[index]; }; + + // Overloaded copy operators to allow initialisation of IPAddress objects from other types + IPAddress& operator=(const uint8_t *address); + IPAddress& operator=(uint32_t address); + + virtual size_t printTo(Print& p) const; + + friend class EthernetClass; + friend class UDP; + friend class Client; + friend class Server; + friend class DhcpClass; + friend class DNSClient; +}; + +const IPAddress INADDR_NONE(0,0,0,0); + + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Platform.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,23 @@ + +#ifndef __PLATFORM_H__ +#define __PLATFORM_H__ + +#include <inttypes.h> +#include <avr/pgmspace.h> +#include <avr/eeprom.h> +#include <avr/interrupt.h> +#include <util/delay.h> + +typedef unsigned char u8; +typedef unsigned short u16; +typedef unsigned long u32; + +#include "Arduino.h" + +#if defined(USBCON) + #include "USBDesc.h" + #include "USBCore.h" + #include "USBAPI.h" +#endif /* if defined(USBCON) */ + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Print.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,263 @@ +/* + Print.cpp - Base class that provides print() and println() + Copyright (c) 2008 David A. Mellis. All right reserved. + + 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 + + Modified 23 November 2006 by David A. Mellis + */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <math.h> +#include "Arduino.h" + +#include "Print.h" + +// Public Methods ////////////////////////////////////////////////////////////// + +/* default implementation: may be overridden */ +size_t Print::write(const uint8_t *buffer, size_t size) +{ + size_t n = 0; + while (size--) { + n += write(*buffer++); + } + return n; +} + +size_t Print::print(const __FlashStringHelper *ifsh) +{ + const char PROGMEM *p = (const char PROGMEM *)ifsh; + size_t n = 0; + while (1) { + unsigned char c = pgm_read_byte(p++); + if (c == 0) break; + n += write(c); + } + return n; +} + +size_t Print::print(const String &s) +{ + size_t n = 0; + for (uint16_t i = 0; i < s.length(); i++) { + n += write(s[i]); + } + return n; +} + +size_t Print::print(const char str[]) +{ + return write(str); +} + +size_t Print::print(char c) +{ + return write(c); +} + +size_t Print::print(unsigned char b, int base) +{ + return print((unsigned long) b, base); +} + +size_t Print::print(int n, int base) +{ + return print((long) n, base); +} + +size_t Print::print(unsigned int n, int base) +{ + return print((unsigned long) n, base); +} + +size_t Print::print(long n, int base) +{ + if (base == 0) { + return write(n); + } else if (base == 10) { + if (n < 0) { + int t = print('-'); + n = -n; + return printNumber(n, 10) + t; + } + return printNumber(n, 10); + } else { + return printNumber(n, base); + } +} + +size_t Print::print(unsigned long n, int base) +{ + if (base == 0) return write(n); + else return printNumber(n, base); +} + +size_t Print::print(double n, int digits) +{ + return printFloat(n, digits); +} + +size_t Print::println(const __FlashStringHelper *ifsh) +{ + size_t n = print(ifsh); + n += println(); + return n; +} + +size_t Print::print(const Printable& x) +{ + return x.printTo(*this); +} + +size_t Print::println(void) +{ + size_t n = print('\r'); + n += print('\n'); + return n; +} + +size_t Print::println(const String &s) +{ + size_t n = print(s); + n += println(); + return n; +} + +size_t Print::println(const char c[]) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(char c) +{ + size_t n = print(c); + n += println(); + return n; +} + +size_t Print::println(unsigned char b, int base) +{ + size_t n = print(b, base); + n += println(); + return n; +} + +size_t Print::println(int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned int num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(unsigned long num, int base) +{ + size_t n = print(num, base); + n += println(); + return n; +} + +size_t Print::println(double num, int digits) +{ + size_t n = print(num, digits); + n += println(); + return n; +} + +size_t Print::println(const Printable& x) +{ + size_t n = print(x); + n += println(); + return n; +} + +// Private Methods ///////////////////////////////////////////////////////////// + +size_t Print::printNumber(unsigned long n, uint8_t base) { + char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte. + char *str = &buf[sizeof(buf) - 1]; + + *str = '\0'; + + // prevent crash if called with base == 1 + if (base < 2) base = 10; + + do { + unsigned long m = n; + n /= base; + char c = m - base * n; + *--str = c < 10 ? c + '0' : c + 'A' - 10; + } while(n); + + return write(str); +} + +size_t Print::printFloat(double number, uint8_t digits) +{ + size_t n = 0; + + // Handle negative numbers + if (number < 0.0) + { + n += print('-'); + number = -number; + } + + // Round correctly so that print(1.999, 2) prints as "2.00" + double rounding = 0.5; + for (uint8_t i=0; i<digits; ++i) + rounding /= 10.0; + + number += rounding; + + // Extract the integer part of the number and print it + unsigned long int_part = (unsigned long)number; + double remainder = number - (double)int_part; + n += print(int_part); + + // Print the decimal point, but only if there are digits beyond + if (digits > 0) { + n += print("."); + } + + // Extract digits from the remainder one at a time + while (digits-- > 0) + { + remainder *= 10.0; + int toPrint = int(remainder); + n += print(toPrint); + remainder -= toPrint; + } + + return n; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Print.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,78 @@ +/* + Print.h - Base class that provides print() and println() + Copyright (c) 2008 David A. Mellis. All right reserved. + + 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 Print_h +#define Print_h + +#include <inttypes.h> +#include <stdio.h> // for size_t + +#include "WString.h" +#include "Printable.h" + +#define DEC 10 +#define HEX 16 +#define OCT 8 +#define BIN 2 + +class Print +{ + private: + int write_error; + size_t printNumber(unsigned long, uint8_t); + size_t printFloat(double, uint8_t); + protected: + void setWriteError(int err = 1) { write_error = err; } + public: + Print() : write_error(0) {} + + int getWriteError() { return write_error; } + void clearWriteError() { setWriteError(0); } + + virtual size_t write(uint8_t) = 0; + size_t write(const char *str) { return write((const uint8_t *)str, strlen(str)); } + virtual size_t write(const uint8_t *buffer, size_t size); + + size_t print(const __FlashStringHelper *); + size_t print(const String &); + size_t print(const char[]); + size_t print(char); + size_t print(unsigned char, int = DEC); + size_t print(int, int = DEC); + size_t print(unsigned int, int = DEC); + size_t print(long, int = DEC); + size_t print(unsigned long, int = DEC); + size_t print(double, int = 2); + size_t print(const Printable&); + + size_t println(const __FlashStringHelper *); + size_t println(const String &s); + size_t println(const char[]); + size_t println(char); + size_t println(unsigned char, int = DEC); + size_t println(int, int = DEC); + size_t println(unsigned int, int = DEC); + size_t println(long, int = DEC); + size_t println(unsigned long, int = DEC); + size_t println(double, int = 2); + size_t println(const Printable&); + size_t println(void); +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Printable.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,40 @@ +/* + Printable.h - Interface class that allows printing of complex types + Copyright (c) 2011 Adrian McEwen. All right reserved. + + 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 Printable_h +#define Printable_h + +#include <new.h> + +class Print; + +/** The Printable class provides a way for new classes to allow themselves to be printed. + By deriving from Printable and implementing the printTo method, it will then be possible + for users to print out instances of this class by passing them into the usual + Print::print and Print::println methods. +*/ + +class Printable +{ + public: + virtual size_t printTo(Print& p) const = 0; +}; + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Server.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,9 @@ +#ifndef server_h +#define server_h + +class Server : public Print { +public: + virtual void begin() =0; +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Stream.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,270 @@ +/* + Stream.cpp - adds parsing methods to Stream class + Copyright (c) 2008 David A. Mellis. All right reserved. + + 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 + + Created July 2011 + parsing functions based on TextFinder library by Michael Margolis + */ + +#include "Arduino.h" +#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() +{ + int c; + _startMillis = millis(); + do { + c = read(); + if (c >= 0) return c; + } while(millis() - _startMillis < _timeout); + return -1; // -1 indicates timeout +} + +// private method to peek stream with timeout +int Stream::timedPeek() +{ + int c; + _startMillis = millis(); + do { + c = peek(); + if (c >= 0) return c; + } while(millis() - _startMillis < _timeout); + return -1; // -1 indicates timeout +} + +// returns peek of the next digit in the stream or -1 if timeout +// discards non-numeric characters +int Stream::peekNextDigit() +{ + int c; + while (1) { + c = timedPeek(); + if (c < 0) return c; // timeout + if (c == '-') return c; + if (c >= '0' && c <= '9') return c; + read(); // discard non-numeric + } +} + +// Public Methods +////////////////////////////////////////////////////////////// + +void Stream::setTimeout(unsigned long timeout) // sets the maximum number of milliseconds to wait +{ + _timeout = timeout; +} + + // find returns true if the target string is found +bool Stream::find(char *target) +{ + return findUntil(target, NULL); +} + +// reads data from the stream until the target string of given length is found +// returns true if target string is found, false if timed out +bool Stream::find(char *target, size_t length) +{ + return findUntil(target, length, NULL, 0); +} + +// as find but search ends if the terminator string is found +bool Stream::findUntil(char *target, char *terminator) +{ + return findUntil(target, strlen(target), terminator, strlen(terminator)); +} + +// reads data from the stream until the target string of the given length is found +// search terminated if the terminator string is found +// returns true if target string is found, false if terminated or timed out +bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t termLen) +{ + size_t index = 0; // maximum target string length is 64k bytes! + size_t termIndex = 0; + int c; + + if( *target == 0) + return true; // return true if target is a null string + while( (c = timedRead()) > 0){ + + if(c != target[index]) + index = 0; // reset index if any char does not match + + if( c == target[index]){ + //////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1); + if(++index >= targetLen){ // return true if all chars in the target match + return true; + } + } + + if(termLen > 0 && c == terminator[termIndex]){ + if(++termIndex >= termLen) + return false; // return false if terminate string found before target string + } + else + termIndex = 0; + } + return false; +} + + +// 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) +{ + boolean isNegative = false; + long value = 0; + int c; + + c = peekNextDigit(); + // ignore non numeric leading characters + if(c < 0) + return 0; // zero returned if timeout + + do{ + if(c == skipChar) + ; // ignore this charactor + else if(c == '-') + isNegative = true; + else if(c >= '0' && c <= '9') // is c a digit? + value = value * 10 + c - '0'; + read(); // consume the character we got with peek + c = timedPeek(); + } + while( (c >= '0' && c <= '9') || c == skipChar ); + + if(isNegative) + value = -value; + return value; +} + + +// as parseInt but returns a floating point value +float Stream::parseFloat() +{ + 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){ + boolean isNegative = false; + boolean isFraction = false; + long value = 0; + char c; + float fraction = 1.0; + + c = peekNextDigit(); + // ignore non numeric leading characters + if(c < 0) + return 0; // zero returned if timeout + + do{ + if(c == skipChar) + ; // ignore + else if(c == '-') + isNegative = true; + else if (c == '.') + isFraction = true; + else if(c >= '0' && c <= '9') { // is c a digit? + value = value * 10 + c - '0'; + if(isFraction) + fraction *= 0.1; + } + read(); // consume the character we got with peek + c = timedPeek(); + } + while( (c >= '0' && c <= '9') || c == '.' || c == skipChar ); + + if(isNegative) + value = -value; + if(isFraction) + return value * fraction; + else + return value; +} + +// read characters from stream into buffer +// terminates if length characters have been read, or timeout (see setTimeout) +// returns the number of characters placed in the buffer +// the buffer is NOT null terminated. +// +size_t Stream::readBytes(char *buffer, size_t length) +{ + size_t count = 0; + while (count < length) { + int c = timedRead(); + if (c < 0) break; + *buffer++ = (char)c; + count++; + } + return count; +} + + +// as readBytes with terminator character +// terminates if length characters have been read, timeout, or if the terminator character detected +// returns the number of characters placed in the buffer (0 means no valid data found) + +size_t Stream::readBytesUntil(char terminator, char *buffer, size_t length) +{ + if (length < 1) return 0; + size_t index = 0; + while (index < length) { + int c = timedRead(); + if (c < 0 || c == terminator) break; + *buffer++ = (char)c; + index++; + } + return index; // return number of characters, not including null terminator +} + +String Stream::readString() +{ + String ret; + int c = timedRead(); + while (c >= 0) + { + ret += (char)c; + c = timedRead(); + } + return ret; +} + +String Stream::readStringUntil(char terminator) +{ + String ret; + int c = timedRead(); + while (c >= 0 && c != terminator) + { + ret += (char)c; + c = timedRead(); + } + return ret; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Stream.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,96 @@ +/* + Stream.h - base class for character-based streams. + Copyright (c) 2010 David A. Mellis. All right reserved. + + 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 + + parsing functions based on TextFinder library by Michael Margolis +*/ + +#ifndef Stream_h +#define Stream_h + +#include <inttypes.h> +#include "Print.h" + +// compatability macros for testing +/* +#define getInt() parseInt() +#define getInt(skipChar) parseInt(skipchar) +#define getFloat() parseFloat() +#define getFloat(skipChar) parseFloat(skipChar) +#define getString( pre_string, post_string, buffer, length) +readBytesBetween( pre_string, terminator, buffer, length) +*/ + +class Stream : public Print +{ + private: + unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read + 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 + + public: + virtual int available() = 0; + virtual int read() = 0; + virtual int peek() = 0; + virtual void flush() = 0; + + Stream() {_timeout=1000;} + +// parsing methods + + void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second + + bool find(char *target); // reads data from the stream until the target string is found + // returns true if target string is found, false if timed out (see setTimeout) + + bool find(char *target, size_t length); // reads data from the stream until the target string of given length is found + // returns true if target string is found, false if timed out + + bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found + + bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found + + + 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 + + size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer + // terminates if length characters have been read or timeout (see setTimeout) + // returns the number of characters placed in the buffer (0 means no valid data found) + + size_t readBytesUntil( char terminator, char *buffer, size_t length); // as readBytes with terminator character + // terminates if length characters have been read, timeout, or if the terminator character detected + // returns the number of characters placed in the buffer (0 means no valid data found) + + // Arduino String functions to be added here + String readString(); + 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 +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Tone.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,601 @@ +/* Tone.cpp + + A Tone Generator Library + + Written by Brett Hagman + + 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 + +Version Modified By Date Comments +------- ----------- -------- -------- +0001 B Hagman 09/08/02 Initial coding +0002 B Hagman 09/08/18 Multiple pins +0003 B Hagman 09/08/18 Moved initialization from constructor to begin() +0004 B Hagman 09/09/26 Fixed problems with ATmega8 +0005 B Hagman 09/11/23 Scanned prescalars for best fit on 8 bit timers + 09/11/25 Changed pin toggle method to XOR + 09/11/25 Fixed timer0 from being excluded +0006 D Mellis 09/12/29 Replaced objects with functions +0007 M Sproul 10/08/29 Changed #ifdefs from cpu to register +*************************************************/ + +#include <avr/interrupt.h> +#include <avr/pgmspace.h> +#include "Arduino.h" +#include "pins_arduino.h" + +#if defined(__AVR_ATmega8__) || defined(__AVR_ATmega128__) +#define TCCR2A TCCR2 +#define TCCR2B TCCR2 +#define COM2A1 COM21 +#define COM2A0 COM20 +#define OCR2A OCR2 +#define TIMSK2 TIMSK +#define OCIE2A OCIE2 +#define TIMER2_COMPA_vect TIMER2_COMP_vect +#define TIMSK1 TIMSK +#endif + +// timerx_toggle_count: +// > 0 - duration specified +// = 0 - stopped +// < 0 - infinitely (until stop() method called, or new play() called) + +#if !defined(__AVR_ATmega8__) +volatile long timer0_toggle_count; +volatile uint8_t *timer0_pin_port; +volatile uint8_t timer0_pin_mask; +#endif + +volatile long timer1_toggle_count; +volatile uint8_t *timer1_pin_port; +volatile uint8_t timer1_pin_mask; +volatile long timer2_toggle_count; +volatile uint8_t *timer2_pin_port; +volatile uint8_t timer2_pin_mask; + +#if defined(TIMSK3) +volatile long timer3_toggle_count; +volatile uint8_t *timer3_pin_port; +volatile uint8_t timer3_pin_mask; +#endif + +#if defined(TIMSK4) +volatile long timer4_toggle_count; +volatile uint8_t *timer4_pin_port; +volatile uint8_t timer4_pin_mask; +#endif + +#if defined(TIMSK5) +volatile long timer5_toggle_count; +volatile uint8_t *timer5_pin_port; +volatile uint8_t timer5_pin_mask; +#endif + + +// MLS: This does not make sense, the 3 options are the same +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + +#define AVAILABLE_TONE_PINS 1 + +const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 3, 4, 5, 1, 0 */ }; +static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255, 255, 255, 255 */ }; + +#elif defined(__AVR_ATmega8__) + +#define AVAILABLE_TONE_PINS 1 + +const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1 */ }; +static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255 */ }; + +#else + +#define AVAILABLE_TONE_PINS 1 + +// Leave timer 0 to last. +const uint8_t PROGMEM tone_pin_to_timer_PGM[] = { 2 /*, 1, 0 */ }; +static uint8_t tone_pins[AVAILABLE_TONE_PINS] = { 255 /*, 255, 255 */ }; + +#endif + + + +static int8_t toneBegin(uint8_t _pin) +{ + int8_t _timer = -1; + + // if we're already using the pin, the timer should be configured. + for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { + if (tone_pins[i] == _pin) { + return pgm_read_byte(tone_pin_to_timer_PGM + i); + } + } + + // search for an unused timer. + for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { + if (tone_pins[i] == 255) { + tone_pins[i] = _pin; + _timer = pgm_read_byte(tone_pin_to_timer_PGM + i); + break; + } + } + + if (_timer != -1) + { + // Set timer specific stuff + // All timers in CTC mode + // 8 bit timers will require changing prescalar values, + // whereas 16 bit timers are set to either ck/1 or ck/64 prescalar + switch (_timer) + { + #if defined(TCCR0A) && defined(TCCR0B) + case 0: + // 8 bit timer + TCCR0A = 0; + TCCR0B = 0; + bitWrite(TCCR0A, WGM01, 1); + bitWrite(TCCR0B, CS00, 1); + timer0_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer0_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + + #if defined(TCCR1A) && defined(TCCR1B) && defined(WGM12) + case 1: + // 16 bit timer + TCCR1A = 0; + TCCR1B = 0; + bitWrite(TCCR1B, WGM12, 1); + bitWrite(TCCR1B, CS10, 1); + timer1_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer1_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + + #if defined(TCCR2A) && defined(TCCR2B) + case 2: + // 8 bit timer + TCCR2A = 0; + TCCR2B = 0; + bitWrite(TCCR2A, WGM21, 1); + bitWrite(TCCR2B, CS20, 1); + timer2_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer2_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + + #if defined(TCCR3A) && defined(TCCR3B) && defined(TIMSK3) + case 3: + // 16 bit timer + TCCR3A = 0; + TCCR3B = 0; + bitWrite(TCCR3B, WGM32, 1); + bitWrite(TCCR3B, CS30, 1); + timer3_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer3_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + + #if defined(TCCR4A) && defined(TCCR4B) && defined(TIMSK4) + case 4: + // 16 bit timer + TCCR4A = 0; + TCCR4B = 0; + #if defined(WGM42) + bitWrite(TCCR4B, WGM42, 1); + #elif defined(CS43) + #warning this may not be correct + // atmega32u4 + bitWrite(TCCR4B, CS43, 1); + #endif + bitWrite(TCCR4B, CS40, 1); + timer4_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer4_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + + #if defined(TCCR5A) && defined(TCCR5B) && defined(TIMSK5) + case 5: + // 16 bit timer + TCCR5A = 0; + TCCR5B = 0; + bitWrite(TCCR5B, WGM52, 1); + bitWrite(TCCR5B, CS50, 1); + timer5_pin_port = portOutputRegister(digitalPinToPort(_pin)); + timer5_pin_mask = digitalPinToBitMask(_pin); + break; + #endif + } + } + + return _timer; +} + + + +// frequency (in hertz) and duration (in milliseconds). + +void tone(uint8_t _pin, unsigned int frequency, unsigned long duration) +{ + uint8_t prescalarbits = 0b001; + long toggle_count = 0; + uint32_t ocr = 0; + int8_t _timer; + + _timer = toneBegin(_pin); + + if (_timer >= 0) + { + // Set the pinMode as OUTPUT + pinMode(_pin, OUTPUT); + + // if we are using an 8 bit timer, scan through prescalars to find the best fit + if (_timer == 0 || _timer == 2) + { + ocr = F_CPU / frequency / 2 - 1; + prescalarbits = 0b001; // ck/1: same for both timers + if (ocr > 255) + { + ocr = F_CPU / frequency / 2 / 8 - 1; + prescalarbits = 0b010; // ck/8: same for both timers + + if (_timer == 2 && ocr > 255) + { + ocr = F_CPU / frequency / 2 / 32 - 1; + prescalarbits = 0b011; + } + + if (ocr > 255) + { + ocr = F_CPU / frequency / 2 / 64 - 1; + prescalarbits = _timer == 0 ? 0b011 : 0b100; + + if (_timer == 2 && ocr > 255) + { + ocr = F_CPU / frequency / 2 / 128 - 1; + prescalarbits = 0b101; + } + + if (ocr > 255) + { + ocr = F_CPU / frequency / 2 / 256 - 1; + prescalarbits = _timer == 0 ? 0b100 : 0b110; + if (ocr > 255) + { + // can't do any better than /1024 + ocr = F_CPU / frequency / 2 / 1024 - 1; + prescalarbits = _timer == 0 ? 0b101 : 0b111; + } + } + } + } + +#if defined(TCCR0B) + if (_timer == 0) + { + TCCR0B = prescalarbits; + } + else +#endif +#if defined(TCCR2B) + { + TCCR2B = prescalarbits; + } +#else + { + // dummy place holder to make the above ifdefs work + } +#endif + } + else + { + // two choices for the 16 bit timers: ck/1 or ck/64 + ocr = F_CPU / frequency / 2 - 1; + + prescalarbits = 0b001; + if (ocr > 0xffff) + { + ocr = F_CPU / frequency / 2 / 64 - 1; + prescalarbits = 0b011; + } + + if (_timer == 1) + { +#if defined(TCCR1B) + TCCR1B = (TCCR1B & 0b11111000) | prescalarbits; +#endif + } +#if defined(TCCR3B) + else if (_timer == 3) + TCCR3B = (TCCR3B & 0b11111000) | prescalarbits; +#endif +#if defined(TCCR4B) + else if (_timer == 4) + TCCR4B = (TCCR4B & 0b11111000) | prescalarbits; +#endif +#if defined(TCCR5B) + else if (_timer == 5) + TCCR5B = (TCCR5B & 0b11111000) | prescalarbits; +#endif + + } + + + // Calculate the toggle count + if (duration > 0) + { + toggle_count = 2 * frequency * duration / 1000; + } + else + { + toggle_count = -1; + } + + // Set the OCR for the given timer, + // set the toggle count, + // then turn on the interrupts + switch (_timer) + { + +#if defined(OCR0A) && defined(TIMSK0) && defined(OCIE0A) + case 0: + OCR0A = ocr; + timer0_toggle_count = toggle_count; + bitWrite(TIMSK0, OCIE0A, 1); + break; +#endif + + case 1: +#if defined(OCR1A) && defined(TIMSK1) && defined(OCIE1A) + OCR1A = ocr; + timer1_toggle_count = toggle_count; + bitWrite(TIMSK1, OCIE1A, 1); +#elif defined(OCR1A) && defined(TIMSK) && defined(OCIE1A) + // this combination is for at least the ATmega32 + OCR1A = ocr; + timer1_toggle_count = toggle_count; + bitWrite(TIMSK, OCIE1A, 1); +#endif + break; + +#if defined(OCR2A) && defined(TIMSK2) && defined(OCIE2A) + case 2: + OCR2A = ocr; + timer2_toggle_count = toggle_count; + bitWrite(TIMSK2, OCIE2A, 1); + break; +#endif + +#if defined(TIMSK3) + case 3: + OCR3A = ocr; + timer3_toggle_count = toggle_count; + bitWrite(TIMSK3, OCIE3A, 1); + break; +#endif + +#if defined(TIMSK4) + case 4: + OCR4A = ocr; + timer4_toggle_count = toggle_count; + bitWrite(TIMSK4, OCIE4A, 1); + break; +#endif + +#if defined(OCR5A) && defined(TIMSK5) && defined(OCIE5A) + case 5: + OCR5A = ocr; + timer5_toggle_count = toggle_count; + bitWrite(TIMSK5, OCIE5A, 1); + break; +#endif + + } + } +} + + +// XXX: this function only works properly for timer 2 (the only one we use +// currently). for the others, it should end the tone, but won't restore +// proper PWM functionality for the timer. +void disableTimer(uint8_t _timer) +{ + switch (_timer) + { + case 0: + #if defined(TIMSK0) + TIMSK0 = 0; + #elif defined(TIMSK) + TIMSK = 0; // atmega32 + #endif + break; + +#if defined(TIMSK1) && defined(OCIE1A) + case 1: + bitWrite(TIMSK1, OCIE1A, 0); + break; +#endif + + case 2: + #if defined(TIMSK2) && defined(OCIE2A) + bitWrite(TIMSK2, OCIE2A, 0); // disable interrupt + #endif + #if defined(TCCR2A) && defined(WGM20) + TCCR2A = (1 << WGM20); + #endif + #if defined(TCCR2B) && defined(CS22) + TCCR2B = (TCCR2B & 0b11111000) | (1 << CS22); + #endif + #if defined(OCR2A) + OCR2A = 0; + #endif + break; + +#if defined(TIMSK3) + case 3: + TIMSK3 = 0; + break; +#endif + +#if defined(TIMSK4) + case 4: + TIMSK4 = 0; + break; +#endif + +#if defined(TIMSK5) + case 5: + TIMSK5 = 0; + break; +#endif + } +} + + +void noTone(uint8_t _pin) +{ + int8_t _timer = -1; + + for (int i = 0; i < AVAILABLE_TONE_PINS; i++) { + if (tone_pins[i] == _pin) { + _timer = pgm_read_byte(tone_pin_to_timer_PGM + i); + tone_pins[i] = 255; + } + } + + disableTimer(_timer); + + digitalWrite(_pin, 0); +} + +#if 0 +#if !defined(__AVR_ATmega8__) +ISR(TIMER0_COMPA_vect) +{ + if (timer0_toggle_count != 0) + { + // toggle the pin + *timer0_pin_port ^= timer0_pin_mask; + + if (timer0_toggle_count > 0) + timer0_toggle_count--; + } + else + { + disableTimer(0); + *timer0_pin_port &= ~(timer0_pin_mask); // keep pin low after stop + } +} +#endif + + +ISR(TIMER1_COMPA_vect) +{ + if (timer1_toggle_count != 0) + { + // toggle the pin + *timer1_pin_port ^= timer1_pin_mask; + + if (timer1_toggle_count > 0) + timer1_toggle_count--; + } + else + { + disableTimer(1); + *timer1_pin_port &= ~(timer1_pin_mask); // keep pin low after stop + } +} +#endif + + +ISR(TIMER2_COMPA_vect) +{ + + if (timer2_toggle_count != 0) + { + // toggle the pin + *timer2_pin_port ^= timer2_pin_mask; + + if (timer2_toggle_count > 0) + timer2_toggle_count--; + } + else + { + // need to call noTone() so that the tone_pins[] entry is reset, so the + // timer gets initialized next time we call tone(). + // XXX: this assumes timer 2 is always the first one used. + noTone(tone_pins[0]); +// disableTimer(2); +// *timer2_pin_port &= ~(timer2_pin_mask); // keep pin low after stop + } +} + + + +//#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#if 0 + +ISR(TIMER3_COMPA_vect) +{ + if (timer3_toggle_count != 0) + { + // toggle the pin + *timer3_pin_port ^= timer3_pin_mask; + + if (timer3_toggle_count > 0) + timer3_toggle_count--; + } + else + { + disableTimer(3); + *timer3_pin_port &= ~(timer3_pin_mask); // keep pin low after stop + } +} + +ISR(TIMER4_COMPA_vect) +{ + if (timer4_toggle_count != 0) + { + // toggle the pin + *timer4_pin_port ^= timer4_pin_mask; + + if (timer4_toggle_count > 0) + timer4_toggle_count--; + } + else + { + disableTimer(4); + *timer4_pin_port &= ~(timer4_pin_mask); // keep pin low after stop + } +} + +ISR(TIMER5_COMPA_vect) +{ + if (timer5_toggle_count != 0) + { + // toggle the pin + *timer5_pin_port ^= timer5_pin_mask; + + if (timer5_toggle_count > 0) + timer5_toggle_count--; + } + else + { + disableTimer(5); + *timer5_pin_port &= ~(timer5_pin_mask); // keep pin low after stop + } +} + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/USBAPI.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,195 @@ + + +#ifndef __USBAPI__ +#define __USBAPI__ + +#if defined(USBCON) + +//================================================================================ +//================================================================================ +// USB + +class USBDevice_ +{ +public: + USBDevice_(); + bool configured(); + + void attach(); + void detach(); // Serial port goes down too... + void poll(); +}; +extern USBDevice_ USBDevice; + +//================================================================================ +//================================================================================ +// Serial over CDC (Serial1 is the physical port) + +class Serial_ : public Stream +{ +private: + ring_buffer *_cdc_rx_buffer; +public: + void begin(uint16_t baud_count); + void end(void); + + virtual int available(void); + virtual void accept(void); + virtual int peek(void); + virtual int read(void); + virtual void flush(void); + virtual size_t write(uint8_t); + operator bool(); +}; +extern Serial_ Serial; + +//================================================================================ +//================================================================================ +// 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; + +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; + +//================================================================================ +//================================================================================ +// Low level API + +typedef struct +{ + uint8_t bmRequestType; + uint8_t bRequest; + uint8_t wValueL; + 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); + +//================================================================================ +//================================================================================ +// MSC 'Driver' + +int MSC_GetInterface(uint8_t* interfaceNum); +int MSC_GetDescriptor(int i); +bool MSC_Setup(Setup& setup); +bool MSC_Data(uint8_t rx,uint8_t tx); + +//================================================================================ +//================================================================================ +// CSC 'Driver' + +int CDC_GetInterface(uint8_t* interfaceNum); +int CDC_GetDescriptor(int i); +bool CDC_Setup(Setup& setup); + +//================================================================================ +//================================================================================ + +#define TRANSFER_PGM 0x80 +#define TRANSFER_RELEASE 0x40 +#define TRANSFER_ZERO 0x20 + +int USB_SendControl(uint8_t flags, const void* d, int len); +int USB_RecvControl(void* d, int len); + +uint8_t USB_Available(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 +void USB_Flush(uint8_t ep); + +#endif + +#endif /* if defined(USBCON) */ \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/USBCore.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,672 @@ + + +/* Copyright (c) 2010, 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 "Platform.h" +#include "USBAPI.h" +#include "USBDesc.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 */ +volatile u8 RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ + +//================================================================== +//================================================================== + +extern const u16 STRING_LANGUAGE[] PROGMEM; +extern const u16 STRING_IPRODUCT[] PROGMEM; +extern const u16 STRING_IMANUFACTURER[] PROGMEM; +extern const DeviceDescriptor USB_DeviceDescriptor PROGMEM; +extern const DeviceDescriptor USB_DeviceDescriptorA PROGMEM; + +const u16 STRING_LANGUAGE[2] = { + (3<<8) | (2+2), + 0x0409 // English +}; + +const u16 STRING_IPRODUCT[17] = { + (3<<8) | (2+2*16), +#if USB_PID == 0x8036 + 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' +#else + 'U','S','B',' ','I','O',' ','B','o','a','r','d',' ',' ',' ',' ' +#endif +}; + +const u16 STRING_IMANUFACTURER[12] = { + (3<<8) | (2+2*11), +#if USB_VID == 0x2341 + 'A','r','d','u','i','n','o',' ','L','L','C' +#else + 'U','n','k','n','o','w','n',' ',' ',' ',' ' +#endif +}; + +#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); + +const DeviceDescriptor USB_DeviceDescriptorA = + D_DEVICE(DEVICE_CLASS,0x00,0x00,64,USB_VID,USB_PID,0x100,IMANUFACTURER,IPRODUCT,0,1); + +//================================================================== +//================================================================== + +volatile u8 _usbConfiguration = 0; + +static inline void WaitIN(void) +{ + while (!(UEINTX & (1<<TXINI))); +} + +static inline void ClearIN(void) +{ + UEINTX = ~(1<<TXINI); +} + +static inline void WaitOUT(void) +{ + while (!(UEINTX & (1<<RXOUTI))) + ; +} + +static inline u8 WaitForINOrOUT() +{ + while (!(UEINTX & ((1<<TXINI)|(1<<RXOUTI)))) + ; + return (UEINTX & (1<<RXOUTI)) == 0; +} + +static inline void ClearOUT(void) +{ + UEINTX = ~(1<<RXOUTI); +} + +void Recv(volatile u8* data, u8 count) +{ + while (count--) + *data++ = UEDATX; + + RXLED1; // light the RX LED + RxLEDPulse = TX_RX_LED_PULSE_MS; +} + +static inline u8 Recv8() +{ + RXLED1; // light the RX LED + RxLEDPulse = TX_RX_LED_PULSE_MS; + + return UEDATX; +} + +static inline void Send8(u8 d) +{ + UEDATX = d; +} + +static inline void SetEP(u8 ep) +{ + UENUM = ep; +} + +static inline u8 FifoByteCount() +{ + return UEBCLX; +} + +static inline u8 ReceivedSetupInt() +{ + return UEINTX & (1<<RXSTPI); +} + +static inline void ClearSetupInt() +{ + UEINTX = ~((1<<RXSTPI) | (1<<RXOUTI) | (1<<TXINI)); +} + +static inline void Stall() +{ + UECONX = (1<<STALLRQ) | (1<<EPEN); +} + +static inline u8 ReadWriteAllowed() +{ + return UEINTX & (1<<RWAL); +} + +static inline u8 Stalled() +{ + return UEINTX & (1<<STALLEDI); +} + +static inline u8 FifoFree() +{ + return UEINTX & (1<<FIFOCON); +} + +static inline void ReleaseRX() +{ + UEINTX = 0x6B; // FIFOCON=0 NAKINI=1 RWAL=1 NAKOUTI=0 RXSTPI=1 RXOUTI=0 STALLEDI=1 TXINI=1 +} + +static inline void ReleaseTX() +{ + UEINTX = 0x3A; // FIFOCON=0 NAKINI=0 RWAL=1 NAKOUTI=1 RXSTPI=1 RXOUTI=0 STALLEDI=1 TXINI=0 +} + +static inline u8 FrameNumber() +{ + return UDFNUML; +} + +//================================================================== +//================================================================== + +u8 USBGetConfiguration(void) +{ + return _usbConfiguration; +} + +#define USB_RECV_TIMEOUT +class LockEP +{ + u8 _sreg; +public: + LockEP(u8 ep) : _sreg(SREG) + { + cli(); + SetEP(ep & 7); + } + ~LockEP() + { + SREG = _sreg; + } +}; + +// Number of bytes, assumes a rx endpoint +u8 USB_Available(u8 ep) +{ + LockEP lock(ep); + return FifoByteCount(); +} + +// Non Blocking receive +// Return number of bytes read +int USB_Recv(u8 ep, void* d, int len) +{ + if (!_usbConfiguration || len < 0) + return -1; + + LockEP lock(ep); + u8 n = FifoByteCount(); + len = min(n,len); + n = len; + u8* dst = (u8*)d; + while (n--) + *dst++ = Recv8(); + if (len && !FifoByteCount()) // release empty buffer + ReleaseRX(); + + return len; +} + +// Recv 1 byte if ready +int USB_Recv(u8 ep) +{ + u8 c; + if (USB_Recv(ep,&c,1) != 1) + return -1; + return c; +} + +// Space in send EP +u8 USB_SendSpace(u8 ep) +{ + LockEP lock(ep); + if (!ReadWriteAllowed()) + return 0; + return 64 - FifoByteCount(); +} + +// Blocking Send of data to an endpoint +int USB_Send(u8 ep, const void* d, int len) +{ + if (!_usbConfiguration) + return -1; + + int r = len; + const u8* data = (const u8*)d; + u8 zero = ep & TRANSFER_ZERO; + u8 timeout = 250; // 250ms timeout on send? TODO + while (len) + { + u8 n = USB_SendSpace(ep); + if (n == 0) + { + if (!(--timeout)) + return -1; + delay(1); + continue; + } + + if (n > len) + n = len; + len -= n; + { + LockEP lock(ep); + if (ep & TRANSFER_ZERO) + { + while (n--) + Send8(0); + } + else if (ep & TRANSFER_PGM) + { + while (n--) + Send8(pgm_read_byte(data++)); + } + else + { + while (n--) + Send8(*data++); + } + if (!ReadWriteAllowed() || ((len == 0) && (ep & TRANSFER_RELEASE))) // Release full buffer + ReleaseTX(); + } + } + TXLED1; // light the TX LED + TxLEDPulse = TX_RX_LED_PULSE_MS; + return r; +} + +extern const u8 _initEndpoints[] PROGMEM; +const u8 _initEndpoints[] = +{ + 0, + +#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 + +#ifdef HID_ENABLED + EP_TYPE_INTERRUPT_IN // HID_ENDPOINT_INT +#endif +}; + +#define EP_SINGLE_64 0x32 // EP0 +#define EP_DOUBLE_64 0x36 // Other endpoints + +static +void InitEP(u8 index, u8 type, u8 size) +{ + UENUM = index; + UECONX = 1; + UECFG0X = type; + UECFG1X = size; +} + +static +void InitEndpoints() +{ + for (u8 i = 1; i < sizeof(_initEndpoints); i++) + { + UENUM = i; + UECONX = 1; + UECFG0X = pgm_read_byte(_initEndpoints+i); + UECFG1X = EP_DOUBLE_64; + } + UERST = 0x7E; // And reset them + UERST = 0; +} + +// Handle CLASS_INTERFACE requests +static +bool ClassInterfaceRequest(Setup& 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); +#endif + return false; +} + +int _cmark; +int _cend; +void InitControl(int end) +{ + SetEP(0); + _cmark = 0; + _cend = end; +} + +static +bool SendControl(u8 d) +{ + if (_cmark < _cend) + { + if (!WaitForINOrOUT()) + return false; + Send8(d); + if (!((_cmark + 1) & 0x3F)) + ClearIN(); // Fifo is full, release this packet + } + _cmark++; + return true; +}; + +// Clipped by _cmark/_cend +int USB_SendControl(u8 flags, const void* d, int len) +{ + int sent = len; + const u8* data = (const u8*)d; + bool pgm = flags & TRANSFER_PGM; + while (len--) + { + u8 c = pgm ? pgm_read_byte(data++) : *data++; + if (!SendControl(c)) + return -1; + } + return sent; +} + +// 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(); + return len; +} + +int SendInterfaces() +{ + int total = 0; + u8 interfaces = 0; + +#ifdef CDC_ENABLED + total = CDC_GetInterface(&interfaces); +#endif + +#ifdef HID_ENABLED + total += HID_GetInterface(&interfaces); +#endif + + return interfaces; +} + +// Construct a dynamic configuration descriptor +// This really needs dynamic endpoint allocation etc +// TODO +static +bool SendConfiguration(int maxlen) +{ + // Count and measure interfaces + InitControl(0); + int interfaces = SendInterfaces(); + ConfigDescriptor config = D_CONFIG(_cmark + sizeof(ConfigDescriptor),interfaces); + + // Now send them + InitControl(maxlen); + USB_SendControl(0,&config,sizeof(ConfigDescriptor)); + SendInterfaces(); + return true; +} + +u8 _cdcComposite = 0; + +static +bool SendDescriptor(Setup& setup) +{ + 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); +#endif + + u8 desc_length = 0; + const u8* desc_addr = 0; + if (USB_DEVICE_DESCRIPTOR_TYPE == t) + { + if (setup.wLength == 8) + _cdcComposite = 1; + desc_addr = _cdcComposite ? (const u8*)&USB_DeviceDescriptorA : (const u8*)&USB_DeviceDescriptor; + } + else if (USB_STRING_DESCRIPTOR_TYPE == t) + { + if (setup.wValueL == 0) + desc_addr = (const u8*)&STRING_LANGUAGE; + else if (setup.wValueL == IPRODUCT) + desc_addr = (const u8*)&STRING_IPRODUCT; + else if (setup.wValueL == IMANUFACTURER) + desc_addr = (const u8*)&STRING_IMANUFACTURER; + else + return false; + } + + if (desc_addr == 0) + return false; + if (desc_length == 0) + desc_length = pgm_read_byte(desc_addr); + + USB_SendControl(TRANSFER_PGM,desc_addr,desc_length); + return true; +} + +// Endpoint 0 interrupt +ISR(USB_COM_vect) +{ + SetEP(0); + if (!ReceivedSetupInt()) + return; + + Setup setup; + Recv((u8*)&setup,8); + ClearSetupInt(); + + u8 requestType = setup.bmRequestType; + if (requestType & REQUEST_DEVICETOHOST) + WaitIN(); + else + ClearIN(); + + bool ok = true; + if (REQUEST_STANDARD == (requestType & REQUEST_TYPE)) + { + // Standard Requests + u8 r = setup.bRequest; + if (GET_STATUS == r) + { + Send8(0); // TODO + Send8(0); + } + else if (CLEAR_FEATURE == r) + { + } + else if (SET_FEATURE == r) + { + } + else if (SET_ADDRESS == r) + { + WaitIN(); + UDADDR = setup.wValueL | (1<<ADDEN); + } + else if (GET_DESCRIPTOR == r) + { + ok = SendDescriptor(setup); + } + else if (SET_DESCRIPTOR == r) + { + ok = false; + } + else if (GET_CONFIGURATION == r) + { + Send8(1); + } + else if (SET_CONFIGURATION == r) + { + if (REQUEST_DEVICE == (requestType & REQUEST_RECIPIENT)) + { + InitEndpoints(); + _usbConfiguration = setup.wValueL; + } else + ok = false; + } + else if (GET_INTERFACE == r) + { + } + else if (SET_INTERFACE == r) + { + } + } + else + { + InitControl(setup.wLength); // Max length of transfer + ok = ClassInterfaceRequest(setup); + } + + if (ok) + ClearIN(); + else + { + Stall(); + } +} + +void USB_Flush(u8 ep) +{ + SetEP(ep); + if (FifoByteCount()) + ReleaseTX(); +} + +// General interrupt +ISR(USB_GEN_vect) +{ + u8 udint = UDINT; + UDINT = 0; + + // End of Reset + if (udint & (1<<EORSTI)) + { + InitEP(0,EP_TYPE_CONTROL,EP_SINGLE_64); // init ep0 + _usbConfiguration = 0; // not configured yet + UEIENX = 1 << RXSTPE; // Enable interrupts for ep0 + } + + // 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 + while (USB_Available(CDC_RX)) // Handle received bytes (if any) + Serial.accept(); +#endif + + // check whether the one-shot period has elapsed. if so, turn off the LED + if (TxLEDPulse && !(--TxLEDPulse)) + TXLED0; + if (RxLEDPulse && !(--RxLEDPulse)) + RXLED0; + } +} + +// VBUS or counting frames +// Any frame counting? +u8 USBConnected() +{ + u8 f = UDFNUML; + delay(3); + return f != UDFNUML; +} + +//======================================================================= +//======================================================================= + +USBDevice_ USBDevice; + +USBDevice_::USBDevice_() +{ +} + +void USBDevice_::attach() +{ + _usbConfiguration = 0; + UHWCON = 0x01; // power internal reg + USBCON = (1<<USBE)|(1<<FRZCLK); // clock frozen, usb enabled + PLLCSR = 0x12; // Need 16 MHz xtal + while (!(PLLCSR & (1<<PLOCK))) // wait for lock pll + ; + + // 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 + + TX_RX_LED_INIT; +} + +void USBDevice_::detach() +{ +} + +// Check for interrupts +// TODO: VBUS detection +bool USBDevice_::configured() +{ + return _usbConfiguration; +} + +void USBDevice_::poll() +{ +} + +#endif /* if defined(USBCON) */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/USBCore.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,303 @@ + +// Copyright (c) 2010, 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 __USBCORE_H__ +#define __USBCORE_H__ + +// Standard requests +#define GET_STATUS 0 +#define CLEAR_FEATURE 1 +#define SET_FEATURE 3 +#define SET_ADDRESS 5 +#define GET_DESCRIPTOR 6 +#define SET_DESCRIPTOR 7 +#define GET_CONFIGURATION 8 +#define SET_CONFIGURATION 9 +#define GET_INTERFACE 10 +#define SET_INTERFACE 11 + + +// bmRequestType +#define REQUEST_HOSTTODEVICE 0x00 +#define REQUEST_DEVICETOHOST 0x80 +#define REQUEST_DIRECTION 0x80 + +#define REQUEST_STANDARD 0x00 +#define REQUEST_CLASS 0x20 +#define REQUEST_VENDOR 0x40 +#define REQUEST_TYPE 0x60 + +#define REQUEST_DEVICE 0x00 +#define REQUEST_INTERFACE 0x01 +#define REQUEST_ENDPOINT 0x02 +#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) + +// Class requests + +#define CDC_SET_LINE_CODING 0x20 +#define CDC_GET_LINE_CODING 0x21 +#define CDC_SET_CONTROL_LINE_STATE 0x22 + +#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 +#define USB_CONFIGUARTION_DESC_SIZE 9 +#define USB_INTERFACE_DESC_SIZE 9 +#define USB_ENDPOINT_DESC_SIZE 7 + +#define USB_DEVICE_DESCRIPTOR_TYPE 1 +#define USB_CONFIGURATION_DESCRIPTOR_TYPE 2 +#define USB_STRING_DESCRIPTOR_TYPE 3 +#define USB_INTERFACE_DESCRIPTOR_TYPE 4 +#define USB_ENDPOINT_DESCRIPTOR_TYPE 5 + +#define USB_DEVICE_CLASS_COMMUNICATIONS 0x02 +#define USB_DEVICE_CLASS_HUMAN_INTERFACE 0x03 +#define USB_DEVICE_CLASS_STORAGE 0x08 +#define USB_DEVICE_CLASS_VENDOR_SPECIFIC 0xFF + +#define USB_CONFIG_POWERED_MASK 0x40 +#define USB_CONFIG_BUS_POWERED 0x80 +#define USB_CONFIG_SELF_POWERED 0xC0 +#define USB_CONFIG_REMOTE_WAKEUP 0x20 + +// bMaxPower in Configuration Descriptor +#define USB_CONFIG_POWER_MA(mA) ((mA)/2) + +// 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_TYPE_MASK 0x03 +#define USB_ENDPOINT_TYPE_CONTROL 0x00 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01 +#define USB_ENDPOINT_TYPE_BULK 0x02 +#define USB_ENDPOINT_TYPE_INTERRUPT 0x03 + +#define TOBYTES(x) ((x) & 0xFF),(((x) >> 8) & 0xFF) + +#define CDC_V1_10 0x0110 +#define CDC_COMMUNICATION_INTERFACE_CLASS 0x02 + +#define CDC_CALL_MANAGEMENT 0x01 +#define CDC_ABSTRACT_CONTROL_MODEL 0x02 +#define CDC_HEADER 0x00 +#define CDC_ABSTRACT_CONTROL_MANAGEMENT 0x02 +#define CDC_UNION 0x06 +#define CDC_CS_INTERFACE 0x24 +#define CDC_CS_ENDPOINT 0x25 +#define CDC_DATA_INTERFACE_CLASS 0x0A + +#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 + u8 dtype; // 1 USB_DEVICE_DESCRIPTOR_TYPE + u16 usbVersion; // 0x200 + u8 deviceClass; + u8 deviceSubClass; + u8 deviceProtocol; + u8 packetSize0; // Packet 0 + u16 idVendor; + u16 idProduct; + u16 deviceVersion; // 0x100 + u8 iManufacturer; + u8 iProduct; + u8 iSerialNumber; + u8 bNumConfigurations; +} DeviceDescriptor; + +// Config +typedef struct { + u8 len; // 9 + u8 dtype; // 2 + u16 clen; // total length + u8 numInterfaces; + u8 config; + u8 iconfig; + u8 attributes; + u8 maxPower; +} ConfigDescriptor; + +// String + +// Interface +typedef struct +{ + u8 len; // 9 + u8 dtype; // 4 + u8 number; + u8 alternate; + u8 numEndpoints; + u8 interfaceClass; + u8 interfaceSubClass; + u8 protocol; + u8 iInterface; +} InterfaceDescriptor; + +// Endpoint +typedef struct +{ + u8 len; // 7 + u8 dtype; // 5 + u8 addr; + u8 attr; + u16 packetSize; + u8 interval; +} EndpointDescriptor; + +// Interface Association Descriptor +// Used to bind 2 interfaces together in CDC compostite device +typedef struct +{ + u8 len; // 8 + u8 dtype; // 11 + u8 firstInterface; + u8 interfaceCount; + u8 functionClass; + u8 funtionSubClass; + u8 functionProtocol; + u8 iInterface; +} IADDescriptor; + +// CDC CS interface descriptor +typedef struct +{ + u8 len; // 5 + u8 dtype; // 0x24 + u8 subtype; + u8 d0; + u8 d1; +} CDCCSInterfaceDescriptor; + +typedef struct +{ + u8 len; // 4 + u8 dtype; // 0x24 + u8 subtype; + u8 d0; +} CDCCSInterfaceDescriptor4; + +typedef struct +{ + u8 len; + u8 dtype; // 0x24 + u8 subtype; // 1 + u8 bmCapabilities; + u8 bDataInterface; +} CMFunctionalDescriptor; + +typedef struct +{ + u8 len; + u8 dtype; // 0x24 + u8 subtype; // 1 + u8 bmCapabilities; +} ACMFunctionalDescriptor; + +typedef struct +{ + // IAD + IADDescriptor iad; // Only needed on compound device + + // Control + InterfaceDescriptor cif; // + CDCCSInterfaceDescriptor header; + CMFunctionalDescriptor callManagement; // Call Management + ACMFunctionalDescriptor controlManagement; // ACM + CDCCSInterfaceDescriptor functionalDescriptor; // CDC_UNION + EndpointDescriptor cifin; + + // Data + InterfaceDescriptor dif; + EndpointDescriptor in; + EndpointDescriptor out; +} CDCDescriptor; + +typedef struct +{ + InterfaceDescriptor msc; + EndpointDescriptor in; + 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) } + +#define D_INTERFACE(_n,_numEndpoints,_class,_subClass,_protocol) \ + { 9, 4, _n, 0, _numEndpoints, _class,_subClass, _protocol, 0 } + +#define D_ENDPOINT(_addr,_attr,_packetSize, _interval) \ + { 7, 5, _addr,_attr,_packetSize, _interval } + +#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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/USBDesc.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,63 @@ + + +/* 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 +#define CDC_FIRST_ENDPOINT 1 +#define CDC_ENDPOINT_ACM (CDC_FIRST_ENDPOINT) // CDC First +#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 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/Udp.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,88 @@ +/* + * Udp.cpp: Library to send/receive UDP packets. + * + * NOTE: UDP is fast, but has some important limitations (thanks to Warren Gray for mentioning these) + * 1) UDP does not guarantee the order in which assembled UDP packets are received. This + * might not happen often in practice, but in larger network topologies, a UDP + * packet can be received out of sequence. + * 2) UDP does not guard against lost packets - so packets *can* disappear without the sender being + * aware of it. Again, this may not be a concern in practice on small local networks. + * For more information, see http://www.cafeaulait.org/course/week12/35.html + * + * MIT License: + * Copyright (c) 2008 Bjoern Hartmann + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + * + * bjoern@cs.stanford.edu 12/30/2008 + */ + +#ifndef udp_h +#define udp_h + +#include <Stream.h> +#include <IPAddress.h> + +class UDP : public Stream { + +public: + virtual uint8_t begin(uint16_t) =0; // initialize, start listening on specified port. Returns 1 if successful, 0 if there are no sockets available to use + virtual void stop() =0; // Finish with the UDP socket + + // Sending UDP packets + + // Start building up a packet to send to the remote host specific in ip and port + // Returns 1 if successful, 0 if there was a problem with the supplied IP address or port + virtual int beginPacket(IPAddress ip, uint16_t port) =0; + // Start building up a packet to send to the remote host specific in host and port + // Returns 1 if successful, 0 if there was a problem resolving the hostname or port + virtual int beginPacket(const char *host, uint16_t port) =0; + // Finish off this packet and send it + // Returns 1 if the packet was sent successfully, 0 if there was an error + virtual int endPacket() =0; + // Write a single byte into the packet + virtual size_t write(uint8_t) =0; + // Write size bytes from buffer into the packet + virtual size_t write(const uint8_t *buffer, size_t size) =0; + + // Start processing the next available incoming packet + // Returns the size of the packet in bytes, or 0 if no packets are available + virtual int parsePacket() =0; + // Number of bytes remaining in the current packet + virtual int available() =0; + // Read a single byte from the current packet + virtual int read() =0; + // Read up to len bytes from the current packet and place them into buffer + // Returns the number of bytes read, or 0 if none are available + virtual int read(unsigned char* buffer, size_t len) =0; + // Read up to len characters from the current packet and place them into buffer + // Returns the number of characters read, or 0 if none are available + virtual int read(char* buffer, size_t len) =0; + // Return the next byte from the current packet without moving on to the next byte + virtual int peek() =0; + virtual void flush() =0; // Finish reading the current packet + + // Return the IP address of the host who sent the current incoming packet + virtual IPAddress remoteIP() =0; + // Return the port of the host who sent the current incoming packet + virtual uint16_t remotePort() =0; +protected: + uint8_t* rawIPAddress(IPAddress& addr) { return addr.raw_address(); }; +}; + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/WCharacter.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,168 @@ +/* + WCharacter.h - Character utility functions for Wiring & Arduino + Copyright (c) 2010 Hernando Barragan. All right reserved. + + 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 Character_h +#define Character_h + +#include <ctype.h> + +// WCharacter.h prototypes +inline boolean isAlphaNumeric(int c) __attribute__((always_inline)); +inline boolean isAlpha(int c) __attribute__((always_inline)); +inline boolean isAscii(int c) __attribute__((always_inline)); +inline boolean isWhitespace(int c) __attribute__((always_inline)); +inline boolean isControl(int c) __attribute__((always_inline)); +inline boolean isDigit(int c) __attribute__((always_inline)); +inline boolean isGraph(int c) __attribute__((always_inline)); +inline boolean isLowerCase(int c) __attribute__((always_inline)); +inline boolean isPrintable(int c) __attribute__((always_inline)); +inline boolean isPunct(int c) __attribute__((always_inline)); +inline boolean isSpace(int c) __attribute__((always_inline)); +inline boolean isUpperCase(int c) __attribute__((always_inline)); +inline boolean isHexadecimalDigit(int c) __attribute__((always_inline)); +inline int toAscii(int c) __attribute__((always_inline)); +inline int toLowerCase(int c) __attribute__((always_inline)); +inline int toUpperCase(int c)__attribute__((always_inline)); + + +// Checks for an alphanumeric character. +// It is equivalent to (isalpha(c) || isdigit(c)). +inline boolean isAlphaNumeric(int c) +{ + return ( isalnum(c) == 0 ? false : true); +} + + +// Checks for an alphabetic character. +// It is equivalent to (isupper(c) || islower(c)). +inline boolean isAlpha(int c) +{ + return ( isalpha(c) == 0 ? false : true); +} + + +// Checks whether c is a 7-bit unsigned char value +// that fits into the ASCII character set. +inline boolean isAscii(int c) +{ + return ( isascii (c) == 0 ? false : true); +} + + +// Checks for a blank character, that is, a space or a tab. +inline boolean isWhitespace(int c) +{ + return ( isblank (c) == 0 ? false : true); +} + + +// Checks for a control character. +inline boolean isControl(int c) +{ + return ( iscntrl (c) == 0 ? false : true); +} + + +// Checks for a digit (0 through 9). +inline boolean isDigit(int c) +{ + return ( isdigit (c) == 0 ? false : true); +} + + +// Checks for any printable character except space. +inline boolean isGraph(int c) +{ + return ( isgraph (c) == 0 ? false : true); +} + + +// Checks for a lower-case character. +inline boolean isLowerCase(int c) +{ + return (islower (c) == 0 ? false : true); +} + + +// Checks for any printable character including space. +inline boolean isPrintable(int c) +{ + return ( isprint (c) == 0 ? false : true); +} + + +// Checks for any printable character which is not a space +// or an alphanumeric character. +inline boolean isPunct(int c) +{ + return ( ispunct (c) == 0 ? false : true); +} + + +// Checks for white-space characters. For the avr-libc library, +// these are: space, formfeed ('\f'), newline ('\n'), carriage +// return ('\r'), horizontal tab ('\t'), and vertical tab ('\v'). +inline boolean isSpace(int c) +{ + return ( isspace (c) == 0 ? false : true); +} + + +// Checks for an uppercase letter. +inline boolean isUpperCase(int c) +{ + return ( isupper (c) == 0 ? false : true); +} + + +// Checks for a hexadecimal digits, i.e. one of 0 1 2 3 4 5 6 7 +// 8 9 a b c d e f A B C D E F. +inline boolean isHexadecimalDigit(int c) +{ + return ( isxdigit (c) == 0 ? false : true); +} + + +// Converts c to a 7-bit unsigned char value that fits into the +// ASCII character set, by clearing the high-order bits. +inline int toAscii(int c) +{ + return toascii (c); +} + + +// Warning: +// Many people will be unhappy if you use this function. +// This function will convert accented letters into random +// characters. + +// Converts the letter c to lower case, if possible. +inline int toLowerCase(int c) +{ + return tolower (c); +} + + +// Converts the letter c to upper case, if possible. +inline int toUpperCase(int c) +{ + return toupper (c); +} + +#endif \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/WInterrupts.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,298 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Wiring project - http://wiring.uniandes.edu.co + + Copyright (c) 2004-05 Hernando Barragan + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + Modified 24 November 2006 by David A. Mellis + Modified 1 August 2010 by Mark Sproul +*/ + +#include <inttypes.h> +#include <avr/io.h> +#include <avr/interrupt.h> +#include <avr/pgmspace.h> +#include <stdio.h> + +#include "wiring_private.h" + +static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS]; +// volatile static voidFuncPtr twiIntFunc; + +void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) { + if(interruptNum < EXTERNAL_NUM_INTERRUPTS) { + intFunc[interruptNum] = userFunc; + + // Configure the interrupt mode (trigger on low input, any change, rising + // edge, or falling edge). The mode constants were chosen to correspond + // to the configuration bits in the hardware register, so we simply shift + // the mode into place. + + // Enable the interrupt. + + switch (interruptNum) { +#if defined(__AVR_ATmega32U4__) + // I hate doing this, but the register assignment differs between the 1280/2560 + // and the 32U4. Since avrlib defines registers PCMSK1 and PCMSK2 that aren't + // even present on the 32U4 this is the only way to distinguish between them. + case 0: + EICRA = (EICRA & ~((1<<ISC00) | (1<<ISC01))) | (mode << ISC00); + EIMSK |= (1<<INT0); + break; + case 1: + EICRA = (EICRA & ~((1<<ISC10) | (1<<ISC11))) | (mode << ISC10); + EIMSK |= (1<<INT1); + break; +#elif defined(EICRA) && defined(EICRB) && defined(EIMSK) + case 2: + EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); + EIMSK |= (1 << INT0); + break; + case 3: + EICRA = (EICRA & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); + EIMSK |= (1 << INT1); + break; + case 4: + EICRA = (EICRA & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20); + EIMSK |= (1 << INT2); + break; + case 5: + EICRA = (EICRA & ~((1 << ISC30) | (1 << ISC31))) | (mode << ISC30); + EIMSK |= (1 << INT3); + break; + case 0: + EICRB = (EICRB & ~((1 << ISC40) | (1 << ISC41))) | (mode << ISC40); + EIMSK |= (1 << INT4); + break; + case 1: + EICRB = (EICRB & ~((1 << ISC50) | (1 << ISC51))) | (mode << ISC50); + EIMSK |= (1 << INT5); + break; + case 6: + EICRB = (EICRB & ~((1 << ISC60) | (1 << ISC61))) | (mode << ISC60); + EIMSK |= (1 << INT6); + break; + case 7: + EICRB = (EICRB & ~((1 << ISC70) | (1 << ISC71))) | (mode << ISC70); + EIMSK |= (1 << INT7); + break; +#else + case 0: + #if defined(EICRA) && defined(ISC00) && defined(EIMSK) + EICRA = (EICRA & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); + EIMSK |= (1 << INT0); + #elif defined(MCUCR) && defined(ISC00) && defined(GICR) + MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); + GICR |= (1 << INT0); + #elif defined(MCUCR) && defined(ISC00) && defined(GIMSK) + MCUCR = (MCUCR & ~((1 << ISC00) | (1 << ISC01))) | (mode << ISC00); + GIMSK |= (1 << INT0); + #else + #error attachInterrupt not finished for this CPU (case 0) + #endif + break; + + case 1: + #if defined(EICRA) && defined(ISC10) && defined(ISC11) && defined(EIMSK) + EICRA = (EICRA & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); + EIMSK |= (1 << INT1); + #elif defined(MCUCR) && defined(ISC10) && defined(ISC11) && defined(GICR) + MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); + GICR |= (1 << INT1); + #elif defined(MCUCR) && defined(ISC10) && defined(GIMSK) && defined(GIMSK) + MCUCR = (MCUCR & ~((1 << ISC10) | (1 << ISC11))) | (mode << ISC10); + GIMSK |= (1 << INT1); + #else + #warning attachInterrupt may need some more work for this cpu (case 1) + #endif + break; + + case 2: + #if defined(EICRA) && defined(ISC20) && defined(ISC21) && defined(EIMSK) + EICRA = (EICRA & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20); + EIMSK |= (1 << INT2); + #elif defined(MCUCR) && defined(ISC20) && defined(ISC21) && defined(GICR) + MCUCR = (MCUCR & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20); + GICR |= (1 << INT2); + #elif defined(MCUCR) && defined(ISC20) && defined(GIMSK) && defined(GIMSK) + MCUCR = (MCUCR & ~((1 << ISC20) | (1 << ISC21))) | (mode << ISC20); + GIMSK |= (1 << INT2); + #endif + break; +#endif + } + } +} + +void detachInterrupt(uint8_t interruptNum) { + if(interruptNum < EXTERNAL_NUM_INTERRUPTS) { + // Disable the interrupt. (We can't assume that interruptNum is equal + // to the number of the EIMSK bit to clear, as this isn't true on the + // ATmega8. There, INT0 is 6 and INT1 is 7.) + switch (interruptNum) { +#if defined(__AVR_ATmega32U4__) + case 0: + EIMSK &= ~(1<<INT0); + break; + case 1: + EIMSK &= ~(1<<INT1); + break; +#elif defined(EICRA) && defined(EICRB) && defined(EIMSK) + case 2: + EIMSK &= ~(1 << INT0); + break; + case 3: + EIMSK &= ~(1 << INT1); + break; + case 4: + EIMSK &= ~(1 << INT2); + break; + case 5: + EIMSK &= ~(1 << INT3); + break; + case 0: + EIMSK &= ~(1 << INT4); + break; + case 1: + EIMSK &= ~(1 << INT5); + break; + case 6: + EIMSK &= ~(1 << INT6); + break; + case 7: + EIMSK &= ~(1 << INT7); + break; +#else + case 0: + #if defined(EIMSK) && defined(INT0) + EIMSK &= ~(1 << INT0); + #elif defined(GICR) && defined(ISC00) + GICR &= ~(1 << INT0); // atmega32 + #elif defined(GIMSK) && defined(INT0) + GIMSK &= ~(1 << INT0); + #else + #error detachInterrupt not finished for this cpu + #endif + break; + + case 1: + #if defined(EIMSK) && defined(INT1) + EIMSK &= ~(1 << INT1); + #elif defined(GICR) && defined(INT1) + GICR &= ~(1 << INT1); // atmega32 + #elif defined(GIMSK) && defined(INT1) + GIMSK &= ~(1 << INT1); + #else + #warning detachInterrupt may need some more work for this cpu (case 1) + #endif + break; +#endif + } + + intFunc[interruptNum] = 0; + } +} + +/* +void attachInterruptTwi(void (*userFunc)(void) ) { + twiIntFunc = userFunc; +} +*/ + +#if defined(__AVR_ATmega32U4__) +SIGNAL(INT0_vect) { + if(intFunc[EXTERNAL_INT_0]) + intFunc[EXTERNAL_INT_0](); +} + +SIGNAL(INT1_vect) { + if(intFunc[EXTERNAL_INT_1]) + intFunc[EXTERNAL_INT_1](); +} + +#elif defined(EICRA) && defined(EICRB) + +SIGNAL(INT0_vect) { + if(intFunc[EXTERNAL_INT_2]) + intFunc[EXTERNAL_INT_2](); +} + +SIGNAL(INT1_vect) { + if(intFunc[EXTERNAL_INT_3]) + intFunc[EXTERNAL_INT_3](); +} + +SIGNAL(INT2_vect) { + if(intFunc[EXTERNAL_INT_4]) + intFunc[EXTERNAL_INT_4](); +} + +SIGNAL(INT3_vect) { + if(intFunc[EXTERNAL_INT_5]) + intFunc[EXTERNAL_INT_5](); +} + +SIGNAL(INT4_vect) { + if(intFunc[EXTERNAL_INT_0]) + intFunc[EXTERNAL_INT_0](); +} + +SIGNAL(INT5_vect) { + if(intFunc[EXTERNAL_INT_1]) + intFunc[EXTERNAL_INT_1](); +} + +SIGNAL(INT6_vect) { + if(intFunc[EXTERNAL_INT_6]) + intFunc[EXTERNAL_INT_6](); +} + +SIGNAL(INT7_vect) { + if(intFunc[EXTERNAL_INT_7]) + intFunc[EXTERNAL_INT_7](); +} + +#else + +SIGNAL(INT0_vect) { + if(intFunc[EXTERNAL_INT_0]) + intFunc[EXTERNAL_INT_0](); +} + +SIGNAL(INT1_vect) { + if(intFunc[EXTERNAL_INT_1]) + intFunc[EXTERNAL_INT_1](); +} + +#if defined(EICRA) && defined(ISC20) +SIGNAL(INT2_vect) { + if(intFunc[EXTERNAL_INT_2]) + intFunc[EXTERNAL_INT_2](); +} +#endif + +#endif + +/* +SIGNAL(SIG_2WIRE_SERIAL) { + if(twiIntFunc) + twiIntFunc(); +} +*/ +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/WMath.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,60 @@ +/* -*- mode: jde; c-basic-offset: 2; indent-tabs-mode: nil -*- */ + +/* + Part of the Wiring project - http://wiring.org.co + Copyright (c) 2004-06 Hernando Barragan + Modified 13 August 2006, David A. Mellis for Arduino - http://www.arduino.cc/ + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id$ +*/ + +extern "C" { + #include "stdlib.h" +} + +void randomSeed(unsigned int seed) +{ + if (seed != 0) { + srandom(seed); + } +} + +long random(long howbig) +{ + if (howbig == 0) { + return 0; + } + return random() % howbig; +} + +long random(long howsmall, long howbig) +{ + if (howsmall >= howbig) { + return howsmall; + } + long diff = howbig - howsmall; + return random(diff) + howsmall; +} + +long map(long x, long in_min, long in_max, long out_min, long out_max) +{ + return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; +} + +unsigned int makeWord(unsigned int w) { return w; } +unsigned int makeWord(unsigned char h, unsigned char l) { return (h << 8) | l; } \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/WString.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,645 @@ +/* + WString.cpp - String library for Wiring & Arduino + ...mostly rewritten by Paul Stoffregen... + Copyright (c) 2009-10 Hernando Barragan. All rights reserved. + Copyright 2011, Paul Stoffregen, paul@pjrc.com + + 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 "WString.h" + + +/*********************************************/ +/* Constructors */ +/*********************************************/ + +String::String(const char *cstr) +{ + init(); + if (cstr) copy(cstr, strlen(cstr)); +} + +String::String(const String &value) +{ + init(); + *this = value; +} + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +String::String(String &&rval) +{ + init(); + move(rval); +} +String::String(StringSumHelper &&rval) +{ + init(); + move(rval); +} +#endif + +String::String(char c) +{ + init(); + char buf[2]; + buf[0] = c; + buf[1] = 0; + *this = buf; +} + +String::String(unsigned char value, unsigned char base) +{ + init(); + char buf[9]; + utoa(value, buf, base); + *this = buf; +} + +String::String(int value, unsigned char base) +{ + init(); + char buf[18]; + itoa(value, buf, base); + *this = buf; +} + +String::String(unsigned int value, unsigned char base) +{ + init(); + char buf[17]; + utoa(value, buf, base); + *this = buf; +} + +String::String(long value, unsigned char base) +{ + init(); + char buf[34]; + ltoa(value, buf, base); + *this = buf; +} + +String::String(unsigned long value, unsigned char base) +{ + init(); + char buf[33]; + ultoa(value, buf, base); + *this = buf; +} + +String::~String() +{ + free(buffer); +} + +/*********************************************/ +/* Memory Management */ +/*********************************************/ + +inline void String::init(void) +{ + buffer = NULL; + capacity = 0; + len = 0; + flags = 0; +} + +void String::invalidate(void) +{ + if (buffer) free(buffer); + buffer = NULL; + capacity = len = 0; +} + +unsigned char String::reserve(unsigned int size) +{ + if (buffer && capacity >= size) return 1; + if (changeBuffer(size)) { + if (len == 0) buffer[0] = 0; + return 1; + } + return 0; +} + +unsigned char String::changeBuffer(unsigned int maxStrLen) +{ + char *newbuffer = (char *)realloc(buffer, maxStrLen + 1); + if (newbuffer) { + buffer = newbuffer; + capacity = maxStrLen; + return 1; + } + return 0; +} + +/*********************************************/ +/* Copy and Move */ +/*********************************************/ + +String & String::copy(const char *cstr, unsigned int length) +{ + if (!reserve(length)) { + invalidate(); + return *this; + } + len = length; + strcpy(buffer, cstr); + return *this; +} + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +void String::move(String &rhs) +{ + if (buffer) { + if (capacity >= rhs.len) { + strcpy(buffer, rhs.buffer); + len = rhs.len; + rhs.len = 0; + return; + } else { + free(buffer); + } + } + buffer = rhs.buffer; + capacity = rhs.capacity; + len = rhs.len; + rhs.buffer = NULL; + rhs.capacity = 0; + rhs.len = 0; +} +#endif + +String & String::operator = (const String &rhs) +{ + if (this == &rhs) return *this; + + if (rhs.buffer) copy(rhs.buffer, rhs.len); + else invalidate(); + + return *this; +} + +#ifdef __GXX_EXPERIMENTAL_CXX0X__ +String & String::operator = (String &&rval) +{ + if (this != &rval) move(rval); + return *this; +} + +String & String::operator = (StringSumHelper &&rval) +{ + if (this != &rval) move(rval); + return *this; +} +#endif + +String & String::operator = (const char *cstr) +{ + if (cstr) copy(cstr, strlen(cstr)); + else invalidate(); + + return *this; +} + +/*********************************************/ +/* concat */ +/*********************************************/ + +unsigned char String::concat(const String &s) +{ + return concat(s.buffer, s.len); +} + +unsigned char String::concat(const char *cstr, unsigned int length) +{ + unsigned int newlen = len + length; + if (!cstr) return 0; + if (length == 0) return 1; + if (!reserve(newlen)) return 0; + strcpy(buffer + len, cstr); + len = newlen; + return 1; +} + +unsigned char String::concat(const char *cstr) +{ + if (!cstr) return 0; + return concat(cstr, strlen(cstr)); +} + +unsigned char String::concat(char c) +{ + char buf[2]; + buf[0] = c; + buf[1] = 0; + return concat(buf, 1); +} + +unsigned char String::concat(unsigned char num) +{ + char buf[4]; + itoa(num, buf, 10); + return concat(buf, strlen(buf)); +} + +unsigned char String::concat(int num) +{ + char buf[7]; + itoa(num, buf, 10); + return concat(buf, strlen(buf)); +} + +unsigned char String::concat(unsigned int num) +{ + char buf[6]; + utoa(num, buf, 10); + return concat(buf, strlen(buf)); +} + +unsigned char String::concat(long num) +{ + char buf[12]; + ltoa(num, buf, 10); + return concat(buf, strlen(buf)); +} + +unsigned char String::concat(unsigned long num) +{ + char buf[11]; + ultoa(num, buf, 10); + return concat(buf, strlen(buf)); +} + +/*********************************************/ +/* Concatenate */ +/*********************************************/ + +StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(rhs.buffer, rhs.len)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!cstr || !a.concat(cstr, strlen(cstr))) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, char c) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(c)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(num)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, int num) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(num)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(num)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, long num) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(num)) a.invalidate(); + return a; +} + +StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num) +{ + StringSumHelper &a = const_cast<StringSumHelper&>(lhs); + if (!a.concat(num)) a.invalidate(); + return a; +} + +/*********************************************/ +/* Comparison */ +/*********************************************/ + +int String::compareTo(const String &s) const +{ + if (!buffer || !s.buffer) { + if (s.buffer && s.len > 0) return 0 - *(unsigned char *)s.buffer; + if (buffer && len > 0) return *(unsigned char *)buffer; + return 0; + } + return strcmp(buffer, s.buffer); +} + +unsigned char String::equals(const String &s2) const +{ + return (len == s2.len && compareTo(s2) == 0); +} + +unsigned char String::equals(const char *cstr) const +{ + if (len == 0) return (cstr == NULL || *cstr == 0); + if (cstr == NULL) return buffer[0] == 0; + return strcmp(buffer, cstr) == 0; +} + +unsigned char String::operator<(const String &rhs) const +{ + return compareTo(rhs) < 0; +} + +unsigned char String::operator>(const String &rhs) const +{ + return compareTo(rhs) > 0; +} + +unsigned char String::operator<=(const String &rhs) const +{ + return compareTo(rhs) <= 0; +} + +unsigned char String::operator>=(const String &rhs) const +{ + return compareTo(rhs) >= 0; +} + +unsigned char String::equalsIgnoreCase( const String &s2 ) const +{ + if (this == &s2) return 1; + if (len != s2.len) return 0; + if (len == 0) return 1; + const char *p1 = buffer; + const char *p2 = s2.buffer; + while (*p1) { + if (tolower(*p1++) != tolower(*p2++)) return 0; + } + return 1; +} + +unsigned char String::startsWith( const String &s2 ) const +{ + if (len < s2.len) return 0; + return startsWith(s2, 0); +} + +unsigned char String::startsWith( const String &s2, unsigned int offset ) const +{ + if (offset > len - s2.len || !buffer || !s2.buffer) return 0; + return strncmp( &buffer[offset], s2.buffer, s2.len ) == 0; +} + +unsigned char String::endsWith( const String &s2 ) const +{ + if ( len < s2.len || !buffer || !s2.buffer) return 0; + return strcmp(&buffer[len - s2.len], s2.buffer) == 0; +} + +/*********************************************/ +/* Character Access */ +/*********************************************/ + +char String::charAt(unsigned int loc) const +{ + return operator[](loc); +} + +void String::setCharAt(unsigned int loc, char c) +{ + if (loc < len) buffer[loc] = c; +} + +char & String::operator[](unsigned int index) +{ + static char dummy_writable_char; + if (index >= len || !buffer) { + dummy_writable_char = 0; + return dummy_writable_char; + } + return buffer[index]; +} + +char String::operator[]( unsigned int index ) const +{ + if (index >= len || !buffer) return 0; + return buffer[index]; +} + +void String::getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index) const +{ + if (!bufsize || !buf) return; + if (index >= len) { + buf[0] = 0; + return; + } + unsigned int n = bufsize - 1; + if (n > len - index) n = len - index; + strncpy((char *)buf, buffer + index, n); + buf[n] = 0; +} + +/*********************************************/ +/* Search */ +/*********************************************/ + +int String::indexOf(char c) const +{ + return indexOf(c, 0); +} + +int String::indexOf( char ch, unsigned int fromIndex ) const +{ + if (fromIndex >= len) return -1; + const char* temp = strchr(buffer + fromIndex, ch); + if (temp == NULL) return -1; + return temp - buffer; +} + +int String::indexOf(const String &s2) const +{ + return indexOf(s2, 0); +} + +int String::indexOf(const String &s2, unsigned int fromIndex) const +{ + if (fromIndex >= len) return -1; + const char *found = strstr(buffer + fromIndex, s2.buffer); + if (found == NULL) return -1; + return found - buffer; +} + +int String::lastIndexOf( char theChar ) const +{ + return lastIndexOf(theChar, len - 1); +} + +int String::lastIndexOf(char ch, unsigned int fromIndex) const +{ + if (fromIndex >= len) return -1; + char tempchar = buffer[fromIndex + 1]; + buffer[fromIndex + 1] = '\0'; + char* temp = strrchr( buffer, ch ); + buffer[fromIndex + 1] = tempchar; + if (temp == NULL) return -1; + return temp - buffer; +} + +int String::lastIndexOf(const String &s2) const +{ + return lastIndexOf(s2, len - s2.len); +} + +int String::lastIndexOf(const String &s2, unsigned int fromIndex) const +{ + if (s2.len == 0 || len == 0 || s2.len > len) return -1; + if (fromIndex >= len) fromIndex = len - 1; + int found = -1; + for (char *p = buffer; p <= buffer + fromIndex; p++) { + p = strstr(p, s2.buffer); + if (!p) break; + if ((unsigned int)(p - buffer) <= fromIndex) found = p - buffer; + } + return found; +} + +String String::substring( unsigned int left ) const +{ + return substring(left, len); +} + +String String::substring(unsigned int left, unsigned int right) const +{ + if (left > right) { + unsigned int temp = right; + right = left; + left = temp; + } + String out; + if (left > len) return out; + if (right > len) right = len; + char temp = buffer[right]; // save the replaced character + buffer[right] = '\0'; + out = buffer + left; // pointer arithmetic + buffer[right] = temp; //restore character + return out; +} + +/*********************************************/ +/* Modification */ +/*********************************************/ + +void String::replace(char find, char replace) +{ + if (!buffer) return; + for (char *p = buffer; *p; p++) { + if (*p == find) *p = replace; + } +} + +void String::replace(const String& find, const String& replace) +{ + if (len == 0 || find.len == 0) return; + int diff = replace.len - find.len; + char *readFrom = buffer; + char *foundAt; + if (diff == 0) { + while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { + memcpy(foundAt, replace.buffer, replace.len); + readFrom = foundAt + replace.len; + } + } else if (diff < 0) { + char *writeTo = buffer; + while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { + unsigned int n = foundAt - readFrom; + memcpy(writeTo, readFrom, n); + writeTo += n; + memcpy(writeTo, replace.buffer, replace.len); + writeTo += replace.len; + readFrom = foundAt + find.len; + len += diff; + } + strcpy(writeTo, readFrom); + } else { + unsigned int size = len; // compute size needed for result + while ((foundAt = strstr(readFrom, find.buffer)) != NULL) { + readFrom = foundAt + find.len; + size += diff; + } + if (size == len) return; + if (size > capacity && !changeBuffer(size)) return; // XXX: tell user! + int index = len - 1; + while (index >= 0 && (index = lastIndexOf(find, index)) >= 0) { + readFrom = buffer + index + find.len; + memmove(readFrom + diff, readFrom, len - (readFrom - buffer)); + len += diff; + buffer[len] = 0; + memcpy(buffer + index, replace.buffer, replace.len); + index--; + } + } +} + +void String::toLowerCase(void) +{ + if (!buffer) return; + for (char *p = buffer; *p; p++) { + *p = tolower(*p); + } +} + +void String::toUpperCase(void) +{ + if (!buffer) return; + for (char *p = buffer; *p; p++) { + *p = toupper(*p); + } +} + +void String::trim(void) +{ + if (!buffer || len == 0) return; + char *begin = buffer; + while (isspace(*begin)) begin++; + char *end = buffer + len - 1; + while (isspace(*end) && end >= begin) end--; + len = end + 1 - begin; + if (begin > buffer) memcpy(buffer, begin, len); + buffer[len] = 0; +} + +/*********************************************/ +/* Parsing / Conversion */ +/*********************************************/ + +long String::toInt(void) const +{ + if (buffer) return atol(buffer); + return 0; +} + +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/WString.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,205 @@ +/* + WString.h - String library for Wiring & Arduino + ...mostly rewritten by Paul Stoffregen... + Copyright (c) 2009-10 Hernando Barragan. All right reserved. + Copyright 2011, Paul Stoffregen, paul@pjrc.com + + 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 String_class_h +#define String_class_h +#ifdef __cplusplus + +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <avr/pgmspace.h> + +// When compiling programs with this class, the following gcc parameters +// dramatically increase performance and memory (RAM) efficiency, typically +// with little or no increase in code size. +// -felide-constructors +// -std=c++0x + +class __FlashStringHelper; +#define F(string_literal) (reinterpret_cast<__FlashStringHelper *>(PSTR(string_literal))) + +// An inherited class for holding the result of a concatenation. These +// result objects are assumed to be writable by subsequent concatenations. +class StringSumHelper; + +// The string class +class String +{ + // use a function pointer to allow for "if (s)" without the + // complications of an operator bool(). for more information, see: + // http://www.artima.com/cppsource/safebool.html + typedef void (String::*StringIfHelperType)() const; + void StringIfHelper() const {} + +public: + // constructors + // creates a copy of the initial value. + // if the initial value is null or invalid, or if memory allocation + // fails, the string will be marked as invalid (i.e. "if (s)" will + // be false). + String(const char *cstr = ""); + String(const String &str); + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + String(String &&rval); + String(StringSumHelper &&rval); + #endif + explicit String(char c); + explicit String(unsigned char, unsigned char base=10); + explicit String(int, unsigned char base=10); + explicit String(unsigned int, unsigned char base=10); + explicit String(long, unsigned char base=10); + explicit String(unsigned long, unsigned char base=10); + ~String(void); + + // memory management + // return true on success, false on failure (in which case, the string + // is left unchanged). reserve(0), if successful, will validate an + // invalid string (i.e., "if (s)" will be true afterwards) + unsigned char reserve(unsigned int size); + inline unsigned int length(void) const {return len;} + + // creates a copy of the assigned value. if the value is null or + // invalid, or if the memory allocation fails, the string will be + // marked as invalid ("if (s)" will be false). + String & operator = (const String &rhs); + String & operator = (const char *cstr); + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + String & operator = (String &&rval); + String & operator = (StringSumHelper &&rval); + #endif + + // concatenate (works w/ built-in types) + + // returns true on success, false on failure (in which case, the string + // is left unchanged). if the argument is null or invalid, the + // concatenation is considered unsucessful. + unsigned char concat(const String &str); + unsigned char concat(const char *cstr); + unsigned char concat(char c); + unsigned char concat(unsigned char c); + unsigned char concat(int num); + unsigned char concat(unsigned int num); + unsigned char concat(long num); + unsigned char concat(unsigned long num); + + // if there's not enough memory for the concatenated value, the string + // will be left unchanged (but this isn't signalled in any way) + String & operator += (const String &rhs) {concat(rhs); return (*this);} + String & operator += (const char *cstr) {concat(cstr); return (*this);} + String & operator += (char c) {concat(c); return (*this);} + String & operator += (unsigned char num) {concat(num); return (*this);} + String & operator += (int num) {concat(num); return (*this);} + String & operator += (unsigned int num) {concat(num); return (*this);} + String & operator += (long num) {concat(num); return (*this);} + String & operator += (unsigned long num) {concat(num); return (*this);} + + friend StringSumHelper & operator + (const StringSumHelper &lhs, const String &rhs); + friend StringSumHelper & operator + (const StringSumHelper &lhs, const char *cstr); + friend StringSumHelper & operator + (const StringSumHelper &lhs, char c); + friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned char num); + friend StringSumHelper & operator + (const StringSumHelper &lhs, int num); + friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned int num); + friend StringSumHelper & operator + (const StringSumHelper &lhs, long num); + friend StringSumHelper & operator + (const StringSumHelper &lhs, unsigned long num); + + // comparison (only works w/ Strings and "strings") + operator StringIfHelperType() const { return buffer ? &String::StringIfHelper : 0; } + int compareTo(const String &s) const; + unsigned char equals(const String &s) const; + unsigned char equals(const char *cstr) const; + unsigned char operator == (const String &rhs) const {return equals(rhs);} + unsigned char operator == (const char *cstr) const {return equals(cstr);} + unsigned char operator != (const String &rhs) const {return !equals(rhs);} + unsigned char operator != (const char *cstr) const {return !equals(cstr);} + unsigned char operator < (const String &rhs) const; + unsigned char operator > (const String &rhs) const; + unsigned char operator <= (const String &rhs) const; + unsigned char operator >= (const String &rhs) const; + unsigned char equalsIgnoreCase(const String &s) const; + unsigned char startsWith( const String &prefix) const; + unsigned char startsWith(const String &prefix, unsigned int offset) const; + unsigned char endsWith(const String &suffix) const; + + // character acccess + char charAt(unsigned int index) const; + void setCharAt(unsigned int index, char c); + char operator [] (unsigned int index) const; + char& operator [] (unsigned int index); + void getBytes(unsigned char *buf, unsigned int bufsize, unsigned int index=0) const; + void toCharArray(char *buf, unsigned int bufsize, unsigned int index=0) const + {getBytes((unsigned char *)buf, bufsize, index);} + + // search + int indexOf( char ch ) const; + int indexOf( char ch, unsigned int fromIndex ) const; + int indexOf( const String &str ) const; + int indexOf( const String &str, unsigned int fromIndex ) const; + int lastIndexOf( char ch ) const; + int lastIndexOf( char ch, unsigned int fromIndex ) const; + int lastIndexOf( const String &str ) const; + int lastIndexOf( const String &str, unsigned int fromIndex ) const; + String substring( unsigned int beginIndex ) const; + String substring( unsigned int beginIndex, unsigned int endIndex ) const; + + // modification + void replace(char find, char replace); + void replace(const String& find, const String& replace); + void toLowerCase(void); + void toUpperCase(void); + void trim(void); + + // parsing/conversion + long toInt(void) const; + +protected: + char *buffer; // the actual char array + unsigned int capacity; // the array length minus one (for the '\0') + unsigned int len; // the String length (not counting the '\0') + unsigned char flags; // unused, for future features +protected: + void init(void); + void invalidate(void); + unsigned char changeBuffer(unsigned int maxStrLen); + unsigned char concat(const char *cstr, unsigned int length); + + // copy and move + String & copy(const char *cstr, unsigned int length); + #ifdef __GXX_EXPERIMENTAL_CXX0X__ + void move(String &rhs); + #endif +}; + +class StringSumHelper : public String +{ +public: + StringSumHelper(const String &s) : String(s) {} + StringSumHelper(const char *p) : String(p) {} + StringSumHelper(char c) : String(c) {} + StringSumHelper(unsigned char num) : String(num) {} + StringSumHelper(int num) : String(num) {} + StringSumHelper(unsigned int num) : String(num) {} + StringSumHelper(long num) : String(num) {} + StringSumHelper(unsigned long num) : String(num) {} +}; + +#endif // __cplusplus +#endif // String_class_h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/binary.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,515 @@ +#ifndef Binary_h +#define Binary_h + +#define B0 0 +#define B00 0 +#define B000 0 +#define B0000 0 +#define B00000 0 +#define B000000 0 +#define B0000000 0 +#define B00000000 0 +#define B1 1 +#define B01 1 +#define B001 1 +#define B0001 1 +#define B00001 1 +#define B000001 1 +#define B0000001 1 +#define B00000001 1 +#define B10 2 +#define B010 2 +#define B0010 2 +#define B00010 2 +#define B000010 2 +#define B0000010 2 +#define B00000010 2 +#define B11 3 +#define B011 3 +#define B0011 3 +#define B00011 3 +#define B000011 3 +#define B0000011 3 +#define B00000011 3 +#define B100 4 +#define B0100 4 +#define B00100 4 +#define B000100 4 +#define B0000100 4 +#define B00000100 4 +#define B101 5 +#define B0101 5 +#define B00101 5 +#define B000101 5 +#define B0000101 5 +#define B00000101 5 +#define B110 6 +#define B0110 6 +#define B00110 6 +#define B000110 6 +#define B0000110 6 +#define B00000110 6 +#define B111 7 +#define B0111 7 +#define B00111 7 +#define B000111 7 +#define B0000111 7 +#define B00000111 7 +#define B1000 8 +#define B01000 8 +#define B001000 8 +#define B0001000 8 +#define B00001000 8 +#define B1001 9 +#define B01001 9 +#define B001001 9 +#define B0001001 9 +#define B00001001 9 +#define B1010 10 +#define B01010 10 +#define B001010 10 +#define B0001010 10 +#define B00001010 10 +#define B1011 11 +#define B01011 11 +#define B001011 11 +#define B0001011 11 +#define B00001011 11 +#define B1100 12 +#define B01100 12 +#define B001100 12 +#define B0001100 12 +#define B00001100 12 +#define B1101 13 +#define B01101 13 +#define B001101 13 +#define B0001101 13 +#define B00001101 13 +#define B1110 14 +#define B01110 14 +#define B001110 14 +#define B0001110 14 +#define B00001110 14 +#define B1111 15 +#define B01111 15 +#define B001111 15 +#define B0001111 15 +#define B00001111 15 +#define B10000 16 +#define B010000 16 +#define B0010000 16 +#define B00010000 16 +#define B10001 17 +#define B010001 17 +#define B0010001 17 +#define B00010001 17 +#define B10010 18 +#define B010010 18 +#define B0010010 18 +#define B00010010 18 +#define B10011 19 +#define B010011 19 +#define B0010011 19 +#define B00010011 19 +#define B10100 20 +#define B010100 20 +#define B0010100 20 +#define B00010100 20 +#define B10101 21 +#define B010101 21 +#define B0010101 21 +#define B00010101 21 +#define B10110 22 +#define B010110 22 +#define B0010110 22 +#define B00010110 22 +#define B10111 23 +#define B010111 23 +#define B0010111 23 +#define B00010111 23 +#define B11000 24 +#define B011000 24 +#define B0011000 24 +#define B00011000 24 +#define B11001 25 +#define B011001 25 +#define B0011001 25 +#define B00011001 25 +#define B11010 26 +#define B011010 26 +#define B0011010 26 +#define B00011010 26 +#define B11011 27 +#define B011011 27 +#define B0011011 27 +#define B00011011 27 +#define B11100 28 +#define B011100 28 +#define B0011100 28 +#define B00011100 28 +#define B11101 29 +#define B011101 29 +#define B0011101 29 +#define B00011101 29 +#define B11110 30 +#define B011110 30 +#define B0011110 30 +#define B00011110 30 +#define B11111 31 +#define B011111 31 +#define B0011111 31 +#define B00011111 31 +#define B100000 32 +#define B0100000 32 +#define B00100000 32 +#define B100001 33 +#define B0100001 33 +#define B00100001 33 +#define B100010 34 +#define B0100010 34 +#define B00100010 34 +#define B100011 35 +#define B0100011 35 +#define B00100011 35 +#define B100100 36 +#define B0100100 36 +#define B00100100 36 +#define B100101 37 +#define B0100101 37 +#define B00100101 37 +#define B100110 38 +#define B0100110 38 +#define B00100110 38 +#define B100111 39 +#define B0100111 39 +#define B00100111 39 +#define B101000 40 +#define B0101000 40 +#define B00101000 40 +#define B101001 41 +#define B0101001 41 +#define B00101001 41 +#define B101010 42 +#define B0101010 42 +#define B00101010 42 +#define B101011 43 +#define B0101011 43 +#define B00101011 43 +#define B101100 44 +#define B0101100 44 +#define B00101100 44 +#define B101101 45 +#define B0101101 45 +#define B00101101 45 +#define B101110 46 +#define B0101110 46 +#define B00101110 46 +#define B101111 47 +#define B0101111 47 +#define B00101111 47 +#define B110000 48 +#define B0110000 48 +#define B00110000 48 +#define B110001 49 +#define B0110001 49 +#define B00110001 49 +#define B110010 50 +#define B0110010 50 +#define B00110010 50 +#define B110011 51 +#define B0110011 51 +#define B00110011 51 +#define B110100 52 +#define B0110100 52 +#define B00110100 52 +#define B110101 53 +#define B0110101 53 +#define B00110101 53 +#define B110110 54 +#define B0110110 54 +#define B00110110 54 +#define B110111 55 +#define B0110111 55 +#define B00110111 55 +#define B111000 56 +#define B0111000 56 +#define B00111000 56 +#define B111001 57 +#define B0111001 57 +#define B00111001 57 +#define B111010 58 +#define B0111010 58 +#define B00111010 58 +#define B111011 59 +#define B0111011 59 +#define B00111011 59 +#define B111100 60 +#define B0111100 60 +#define B00111100 60 +#define B111101 61 +#define B0111101 61 +#define B00111101 61 +#define B111110 62 +#define B0111110 62 +#define B00111110 62 +#define B111111 63 +#define B0111111 63 +#define B00111111 63 +#define B1000000 64 +#define B01000000 64 +#define B1000001 65 +#define B01000001 65 +#define B1000010 66 +#define B01000010 66 +#define B1000011 67 +#define B01000011 67 +#define B1000100 68 +#define B01000100 68 +#define B1000101 69 +#define B01000101 69 +#define B1000110 70 +#define B01000110 70 +#define B1000111 71 +#define B01000111 71 +#define B1001000 72 +#define B01001000 72 +#define B1001001 73 +#define B01001001 73 +#define B1001010 74 +#define B01001010 74 +#define B1001011 75 +#define B01001011 75 +#define B1001100 76 +#define B01001100 76 +#define B1001101 77 +#define B01001101 77 +#define B1001110 78 +#define B01001110 78 +#define B1001111 79 +#define B01001111 79 +#define B1010000 80 +#define B01010000 80 +#define B1010001 81 +#define B01010001 81 +#define B1010010 82 +#define B01010010 82 +#define B1010011 83 +#define B01010011 83 +#define B1010100 84 +#define B01010100 84 +#define B1010101 85 +#define B01010101 85 +#define B1010110 86 +#define B01010110 86 +#define B1010111 87 +#define B01010111 87 +#define B1011000 88 +#define B01011000 88 +#define B1011001 89 +#define B01011001 89 +#define B1011010 90 +#define B01011010 90 +#define B1011011 91 +#define B01011011 91 +#define B1011100 92 +#define B01011100 92 +#define B1011101 93 +#define B01011101 93 +#define B1011110 94 +#define B01011110 94 +#define B1011111 95 +#define B01011111 95 +#define B1100000 96 +#define B01100000 96 +#define B1100001 97 +#define B01100001 97 +#define B1100010 98 +#define B01100010 98 +#define B1100011 99 +#define B01100011 99 +#define B1100100 100 +#define B01100100 100 +#define B1100101 101 +#define B01100101 101 +#define B1100110 102 +#define B01100110 102 +#define B1100111 103 +#define B01100111 103 +#define B1101000 104 +#define B01101000 104 +#define B1101001 105 +#define B01101001 105 +#define B1101010 106 +#define B01101010 106 +#define B1101011 107 +#define B01101011 107 +#define B1101100 108 +#define B01101100 108 +#define B1101101 109 +#define B01101101 109 +#define B1101110 110 +#define B01101110 110 +#define B1101111 111 +#define B01101111 111 +#define B1110000 112 +#define B01110000 112 +#define B1110001 113 +#define B01110001 113 +#define B1110010 114 +#define B01110010 114 +#define B1110011 115 +#define B01110011 115 +#define B1110100 116 +#define B01110100 116 +#define B1110101 117 +#define B01110101 117 +#define B1110110 118 +#define B01110110 118 +#define B1110111 119 +#define B01110111 119 +#define B1111000 120 +#define B01111000 120 +#define B1111001 121 +#define B01111001 121 +#define B1111010 122 +#define B01111010 122 +#define B1111011 123 +#define B01111011 123 +#define B1111100 124 +#define B01111100 124 +#define B1111101 125 +#define B01111101 125 +#define B1111110 126 +#define B01111110 126 +#define B1111111 127 +#define B01111111 127 +#define B10000000 128 +#define B10000001 129 +#define B10000010 130 +#define B10000011 131 +#define B10000100 132 +#define B10000101 133 +#define B10000110 134 +#define B10000111 135 +#define B10001000 136 +#define B10001001 137 +#define B10001010 138 +#define B10001011 139 +#define B10001100 140 +#define B10001101 141 +#define B10001110 142 +#define B10001111 143 +#define B10010000 144 +#define B10010001 145 +#define B10010010 146 +#define B10010011 147 +#define B10010100 148 +#define B10010101 149 +#define B10010110 150 +#define B10010111 151 +#define B10011000 152 +#define B10011001 153 +#define B10011010 154 +#define B10011011 155 +#define B10011100 156 +#define B10011101 157 +#define B10011110 158 +#define B10011111 159 +#define B10100000 160 +#define B10100001 161 +#define B10100010 162 +#define B10100011 163 +#define B10100100 164 +#define B10100101 165 +#define B10100110 166 +#define B10100111 167 +#define B10101000 168 +#define B10101001 169 +#define B10101010 170 +#define B10101011 171 +#define B10101100 172 +#define B10101101 173 +#define B10101110 174 +#define B10101111 175 +#define B10110000 176 +#define B10110001 177 +#define B10110010 178 +#define B10110011 179 +#define B10110100 180 +#define B10110101 181 +#define B10110110 182 +#define B10110111 183 +#define B10111000 184 +#define B10111001 185 +#define B10111010 186 +#define B10111011 187 +#define B10111100 188 +#define B10111101 189 +#define B10111110 190 +#define B10111111 191 +#define B11000000 192 +#define B11000001 193 +#define B11000010 194 +#define B11000011 195 +#define B11000100 196 +#define B11000101 197 +#define B11000110 198 +#define B11000111 199 +#define B11001000 200 +#define B11001001 201 +#define B11001010 202 +#define B11001011 203 +#define B11001100 204 +#define B11001101 205 +#define B11001110 206 +#define B11001111 207 +#define B11010000 208 +#define B11010001 209 +#define B11010010 210 +#define B11010011 211 +#define B11010100 212 +#define B11010101 213 +#define B11010110 214 +#define B11010111 215 +#define B11011000 216 +#define B11011001 217 +#define B11011010 218 +#define B11011011 219 +#define B11011100 220 +#define B11011101 221 +#define B11011110 222 +#define B11011111 223 +#define B11100000 224 +#define B11100001 225 +#define B11100010 226 +#define B11100011 227 +#define B11100100 228 +#define B11100101 229 +#define B11100110 230 +#define B11100111 231 +#define B11101000 232 +#define B11101001 233 +#define B11101010 234 +#define B11101011 235 +#define B11101100 236 +#define B11101101 237 +#define B11101110 238 +#define B11101111 239 +#define B11110000 240 +#define B11110001 241 +#define B11110010 242 +#define B11110011 243 +#define B11110100 244 +#define B11110101 245 +#define B11110110 246 +#define B11110111 247 +#define B11111000 248 +#define B11111001 249 +#define B11111010 250 +#define B11111011 251 +#define B11111100 252 +#define B11111101 253 +#define B11111110 254 +#define B11111111 255 + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/main.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,20 @@ +#include <Arduino.h> + +int main(void) +{ + init(); + +#if defined(USBCON) + USBDevice.attach(); +#endif + + setup(); + + for (;;) { + loop(); + if (serialEventRun) serialEventRun(); + } + + return 0; +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/new.cpp Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,18 @@ +#include <new.h> + +void * operator new(size_t size) +{ + return malloc(size); +} + +void operator delete(void * ptr) +{ + free(ptr); +} + +int __cxa_guard_acquire(__guard *g) {return !*(char *)(g);}; +void __cxa_guard_release (__guard *g) {*(char *)g = 1;}; +void __cxa_guard_abort (__guard *) {}; + +void __cxa_pure_virtual(void) {}; +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/new.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,22 @@ +/* Header to define new/delete operators as they aren't provided by avr-gcc by default + Taken from http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=59453 + */ + +#ifndef NEW_H +#define NEW_H + +#include <stdlib.h> + +void * operator new(size_t size); +void operator delete(void * ptr); + +__extension__ typedef int __guard __attribute__((mode (__DI__))); + +extern "C" int __cxa_guard_acquire(__guard *); +extern "C" void __cxa_guard_release (__guard *); +extern "C" void __cxa_guard_abort (__guard *); + +extern "C" void __cxa_pure_virtual(void); + +#endif +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,324 @@ +/* + wiring.c - Partial implementation of the Wiring API for the ATmega8. + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id$ +*/ + +#include "wiring_private.h" + +// the prescaler is set so that timer0 ticks every 64 clock cycles, and the +// the overflow handler is called every 256 ticks. +#define MICROSECONDS_PER_TIMER0_OVERFLOW (clockCyclesToMicroseconds(64 * 256)) + +// the whole number of milliseconds per timer0 overflow +#define MILLIS_INC (MICROSECONDS_PER_TIMER0_OVERFLOW / 1000) + +// the fractional number of milliseconds per timer0 overflow. we shift right +// by three to fit these numbers into a byte. (for the clock speeds we care +// about - 8 and 16 MHz - this doesn't lose precision.) +#define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3) +#define FRACT_MAX (1000 >> 3) + +volatile unsigned long timer0_overflow_count = 0; +volatile unsigned long timer0_millis = 0; +static unsigned char timer0_fract = 0; + +#if defined(__AVR_ATtiny24__) || defined(__AVR_ATtiny44__) || defined(__AVR_ATtiny84__) +SIGNAL(TIM0_OVF_vect) +#else +SIGNAL(TIMER0_OVF_vect) +#endif +{ + // copy these to local variables so they can be stored in registers + // (volatile variables must be read from memory on every access) + unsigned long m = timer0_millis; + unsigned char f = timer0_fract; + + m += MILLIS_INC; + f += FRACT_INC; + if (f >= FRACT_MAX) { + f -= FRACT_MAX; + m += 1; + } + + timer0_fract = f; + timer0_millis = m; + timer0_overflow_count++; +} + +unsigned long millis() +{ + unsigned long m; + uint8_t oldSREG = SREG; + + // disable interrupts while we read timer0_millis or we might get an + // inconsistent value (e.g. in the middle of a write to timer0_millis) + cli(); + m = timer0_millis; + SREG = oldSREG; + + return m; +} + +unsigned long micros() { + unsigned long m; + uint8_t oldSREG = SREG, t; + + cli(); + m = timer0_overflow_count; +#if defined(TCNT0) + t = TCNT0; +#elif defined(TCNT0L) + t = TCNT0L; +#else + #error TIMER 0 not defined +#endif + + +#ifdef TIFR0 + if ((TIFR0 & _BV(TOV0)) && (t < 255)) + m++; +#else + if ((TIFR & _BV(TOV0)) && (t < 255)) + m++; +#endif + + SREG = oldSREG; + + return ((m << 8) + t) * (64 / clockCyclesPerMicrosecond()); +} + +void delay(unsigned long ms) +{ + uint16_t start = (uint16_t)micros(); + + while (ms > 0) { + if (((uint16_t)micros() - start) >= 1000) { + ms--; + start += 1000; + } + } +} + +/* Delay for the given number of microseconds. Assumes a 8 or 16 MHz clock. */ +void delayMicroseconds(unsigned int us) +{ + // calling avrlib's delay_us() function with low values (e.g. 1 or + // 2 microseconds) gives delays longer than desired. + //delay_us(us); +#if F_CPU >= 20000000L + // for the 20 MHz clock on rare Arduino boards + + // for a one-microsecond delay, simply wait 2 cycle and return. The overhead + // of the function call yields a delay of exactly a one microsecond. + __asm__ __volatile__ ( + "nop" "\n\t" + "nop"); //just waiting 2 cycle + if (--us == 0) + return; + + // the following loop takes a 1/5 of a microsecond (4 cycles) + // per iteration, so execute it five times for each microsecond of + // delay requested. + us = (us<<2) + us; // x5 us + + // account for the time taken in the preceeding commands. + us -= 2; + +#elif F_CPU >= 16000000L + // for the 16 MHz clock on most Arduino boards + + // for a one-microsecond delay, simply return. the overhead + // of the function call yields a delay of approximately 1 1/8 us. + if (--us == 0) + return; + + // the following loop takes a quarter of a microsecond (4 cycles) + // per iteration, so execute it four times for each microsecond of + // delay requested. + us <<= 2; + + // account for the time taken in the preceeding commands. + us -= 2; +#else + // for the 8 MHz internal clock on the ATmega168 + + // for a one- or two-microsecond delay, simply return. the overhead of + // the function calls takes more than two microseconds. can't just + // subtract two, since us is unsigned; we'd overflow. + if (--us == 0) + return; + if (--us == 0) + return; + + // the following loop takes half of a microsecond (4 cycles) + // per iteration, so execute it twice for each microsecond of + // delay requested. + us <<= 1; + + // partially compensate for the time taken by the preceeding commands. + // we can't subtract any more than this or we'd overflow w/ small delays. + us--; +#endif + + // busy wait + __asm__ __volatile__ ( + "1: sbiw %0,1" "\n\t" // 2 cycles + "brne 1b" : "=w" (us) : "0" (us) // 2 cycles + ); +} + +void init() +{ + // this needs to be called before setup() or some functions won't + // work there + sei(); + + // on the ATmega168, timer 0 is also used for fast hardware pwm + // (using phase-correct PWM would mean that timer 0 overflowed half as often + // resulting in different millis() behavior on the ATmega8 and ATmega168) +#if defined(TCCR0A) && defined(WGM01) + sbi(TCCR0A, WGM01); + sbi(TCCR0A, WGM00); +#endif + + // set timer 0 prescale factor to 64 +#if defined(__AVR_ATmega128__) + // CPU specific: different values for the ATmega128 + sbi(TCCR0, CS02); +#elif defined(TCCR0) && defined(CS01) && defined(CS00) + // this combination is for the standard atmega8 + sbi(TCCR0, CS01); + sbi(TCCR0, CS00); +#elif defined(TCCR0B) && defined(CS01) && defined(CS00) + // this combination is for the standard 168/328/1280/2560 + sbi(TCCR0B, CS01); + sbi(TCCR0B, CS00); +#elif defined(TCCR0A) && defined(CS01) && defined(CS00) + // this combination is for the __AVR_ATmega645__ series + sbi(TCCR0A, CS01); + sbi(TCCR0A, CS00); +#else + #error Timer 0 prescale factor 64 not set correctly +#endif + + // enable timer 0 overflow interrupt +#if defined(TIMSK) && defined(TOIE0) + sbi(TIMSK, TOIE0); +#elif defined(TIMSK0) && defined(TOIE0) + sbi(TIMSK0, TOIE0); +#else + #error Timer 0 overflow interrupt not set correctly +#endif + + // timers 1 and 2 are used for phase-correct hardware pwm + // this is better for motors as it ensures an even waveform + // note, however, that fast pwm mode can achieve a frequency of up + // 8 MHz (with a 16 MHz clock) at 50% duty cycle + +#if defined(TCCR1B) && defined(CS11) && defined(CS10) + TCCR1B = 0; + + // set timer 1 prescale factor to 64 + sbi(TCCR1B, CS11); +#if F_CPU >= 8000000L + sbi(TCCR1B, CS10); +#endif +#elif defined(TCCR1) && defined(CS11) && defined(CS10) + sbi(TCCR1, CS11); +#if F_CPU >= 8000000L + sbi(TCCR1, CS10); +#endif +#endif + // 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 +#if defined(TCCR2) && defined(CS22) + sbi(TCCR2, CS22); +#elif defined(TCCR2B) && defined(CS22) + sbi(TCCR2B, CS22); +#else + #warning Timer 2 not finished (may not be present on this CPU) +#endif + + // configure timer 2 for phase correct pwm (8-bit) +#if defined(TCCR2) && defined(WGM20) + sbi(TCCR2, WGM20); +#elif defined(TCCR2A) && defined(WGM20) + sbi(TCCR2A, WGM20); +#else + #warning Timer 2 not finished (may not be present on this CPU) +#endif + +#if defined(TCCR3B) && defined(CS31) && defined(WGM30) + sbi(TCCR3B, CS31); // set timer 3 prescale factor to 64 + sbi(TCCR3B, CS30); + sbi(TCCR3A, WGM30); // put timer 3 in 8-bit phase correct pwm mode +#endif + +#if defined(TCCR4A) && defined(TCCR4B) && defined(TCCR4D) /* beginning of timer4 block for 32U4 and similar */ + sbi(TCCR4B, CS42); // set timer4 prescale factor to 64 + sbi(TCCR4B, CS41); + sbi(TCCR4B, CS40); + sbi(TCCR4D, WGM40); // put timer 4 in phase- and frequency-correct PWM mode + sbi(TCCR4A, PWM4A); // enable PWM mode for comparator OCR4A + sbi(TCCR4C, PWM4D); // enable PWM mode for comparator OCR4D +#else /* beginning of timer4 block for ATMEGA1280 and ATMEGA2560 */ +#if defined(TCCR4B) && defined(CS41) && defined(WGM40) + sbi(TCCR4B, CS41); // set timer 4 prescale factor to 64 + sbi(TCCR4B, CS40); + sbi(TCCR4A, WGM40); // put timer 4 in 8-bit phase correct pwm mode +#endif +#endif /* end timer4 block for ATMEGA1280/2560 and similar */ + +#if defined(TCCR5B) && defined(CS51) && defined(WGM50) + sbi(TCCR5B, CS51); // set timer 5 prescale factor to 64 + sbi(TCCR5B, CS50); + sbi(TCCR5A, WGM50); // put timer 5 in 8-bit phase correct pwm mode +#endif + +#if defined(ADCSRA) + // set a2d prescale factor to 128 + // 16 MHz / 128 = 125 KHz, inside the desired 50-200 KHz range. + // XXX: this will not work properly for other clock speeds, and + // this code should use F_CPU to determine the prescale factor. + sbi(ADCSRA, ADPS2); + sbi(ADCSRA, ADPS1); + sbi(ADCSRA, ADPS0); + + // enable a2d conversions + sbi(ADCSRA, ADEN); +#endif + + // the bootloader connects pins 0 and 1 to the USART; disconnect them + // here so they can be used as normal digital i/o; they will be + // reconnected in Serial.begin() +#if defined(UCSRB) + UCSRB = 0; +#elif defined(UCSR0B) + UCSR0B = 0; +#endif +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring_analog.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,282 @@ +/* + wiring_analog.c - analog input and output + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + Modified 28 September 2010 by Mark Sproul + + $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ +*/ + +#include "wiring_private.h" +#include "pins_arduino.h" + +uint8_t analog_reference = DEFAULT; + +void analogReference(uint8_t mode) +{ + // can't actually set the register here because the default setting + // will connect AVCC and the AREF pin, which would cause a short if + // there's something connected to AREF. + analog_reference = mode; +} + +int analogRead(uint8_t pin) +{ + uint8_t low, high; + +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) + if (pin >= 54) pin -= 54; // allow for channel or pin numbers +#elif defined(__AVR_ATmega32U4__) + if (pin >= 18) pin -= 18; // allow for channel or pin numbers +#elif defined(__AVR_ATmega1284__) || defined(__AVR_ATmega644p__) + if (pin >= 24) pin -= 24; // allow for channel or pin numbers +#else + if (pin >= 14) pin -= 14; // allow for channel or pin numbers +#endif + +#if defined(__AVR_ATmega32U4__) + pin = analogPinToChannel(pin); + ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5); +#elif defined(ADCSRB) && defined(MUX5) + // the MUX5 bit of ADCSRB selects whether we're reading from channels + // 0 to 7 (MUX5 low) or 8 to 15 (MUX5 high). + ADCSRB = (ADCSRB & ~(1 << MUX5)) | (((pin >> 3) & 0x01) << MUX5); +#endif + + // set the analog reference (high two bits of ADMUX) and select the + // channel (low 4 bits). this also sets ADLAR (left-adjust result) + // to 0 (the default). +#if defined(ADMUX) + ADMUX = (analog_reference << 6) | (pin & 0x07); +#endif + + // without a delay, we seem to read from the wrong channel + //delay(1); + +#if defined(ADCSRA) && defined(ADCL) + // start the conversion + sbi(ADCSRA, ADSC); + + // ADSC is cleared when the conversion finishes + while (bit_is_set(ADCSRA, ADSC)); + + // we have to read ADCL first; doing so locks both ADCL + // and ADCH until ADCH is read. reading ADCL second would + // cause the results of each conversion to be discarded, + // as ADCL and ADCH would be locked when it completed. + low = ADCL; + high = ADCH; +#else + // we dont have an ADC, return 0 + low = 0; + high = 0; +#endif + + // combine the two bytes + return (high << 8) | low; +} + +// Right now, PWM output only works on the pins with +// hardware support. These are defined in the appropriate +// pins_*.c file. For the rest of the pins, we default +// to digital output. +void analogWrite(uint8_t pin, int val) +{ + // We need to make sure the PWM output is enabled for those pins + // that support it, as we turn it off when digitally reading or + // writing with them. Also, make sure the pin is in output mode + // for consistenty with Wiring, which doesn't require a pinMode + // call for the analog output pins. + pinMode(pin, OUTPUT); + if (val == 0) + { + digitalWrite(pin, LOW); + } + else if (val == 255) + { + digitalWrite(pin, HIGH); + } + else + { + switch(digitalPinToTimer(pin)) + { + // XXX fix needed for atmega8 + #if defined(TCCR0) && defined(COM00) && !defined(__AVR_ATmega8__) + case TIMER0A: + // connect pwm to pin on timer 0 + sbi(TCCR0, COM00); + OCR0 = val; // set pwm duty + break; + #endif + + #if defined(TCCR0A) && defined(COM0A1) + case TIMER0A: + // connect pwm to pin on timer 0, channel A + sbi(TCCR0A, COM0A1); + OCR0A = val; // set pwm duty + break; + #endif + + #if defined(TCCR0A) && defined(COM0B1) + case TIMER0B: + // connect pwm to pin on timer 0, channel B + sbi(TCCR0A, COM0B1); + OCR0B = val; // set pwm duty + break; + #endif + + #if defined(TCCR1A) && defined(COM1A1) + case TIMER1A: + // connect pwm to pin on timer 1, channel A + sbi(TCCR1A, COM1A1); + OCR1A = val; // set pwm duty + break; + #endif + + #if defined(TCCR1A) && defined(COM1B1) + case TIMER1B: + // connect pwm to pin on timer 1, channel B + sbi(TCCR1A, COM1B1); + OCR1B = val; // set pwm duty + break; + #endif + + #if defined(TCCR2) && defined(COM21) + case TIMER2: + // connect pwm to pin on timer 2 + sbi(TCCR2, COM21); + OCR2 = val; // set pwm duty + break; + #endif + + #if defined(TCCR2A) && defined(COM2A1) + case TIMER2A: + // connect pwm to pin on timer 2, channel A + sbi(TCCR2A, COM2A1); + OCR2A = val; // set pwm duty + break; + #endif + + #if defined(TCCR2A) && defined(COM2B1) + case TIMER2B: + // connect pwm to pin on timer 2, channel B + sbi(TCCR2A, COM2B1); + OCR2B = val; // set pwm duty + break; + #endif + + #if defined(TCCR3A) && defined(COM3A1) + case TIMER3A: + // connect pwm to pin on timer 3, channel A + sbi(TCCR3A, COM3A1); + OCR3A = val; // set pwm duty + break; + #endif + + #if defined(TCCR3A) && defined(COM3B1) + case TIMER3B: + // connect pwm to pin on timer 3, channel B + sbi(TCCR3A, COM3B1); + OCR3B = val; // set pwm duty + break; + #endif + + #if defined(TCCR3A) && defined(COM3C1) + case TIMER3C: + // connect pwm to pin on timer 3, channel C + sbi(TCCR3A, COM3C1); + OCR3C = val; // set pwm duty + break; + #endif + + #if defined(TCCR4A) + case TIMER4A: + //connect pwm to pin on timer 4, channel A + sbi(TCCR4A, COM4A1); + #if defined(COM4A0) // only used on 32U4 + cbi(TCCR4A, COM4A0); + #endif + OCR4A = val; // set pwm duty + break; + #endif + + #if defined(TCCR4A) && defined(COM4B1) + case TIMER4B: + // connect pwm to pin on timer 4, channel B + sbi(TCCR4A, COM4B1); + OCR4B = val; // set pwm duty + break; + #endif + + #if defined(TCCR4A) && defined(COM4C1) + case TIMER4C: + // connect pwm to pin on timer 4, channel C + sbi(TCCR4A, COM4C1); + OCR4C = val; // set pwm duty + break; + #endif + + #if defined(TCCR4C) && defined(COM4D1) + case TIMER4D: + // connect pwm to pin on timer 4, channel D + sbi(TCCR4C, COM4D1); + #if defined(COM4D0) // only used on 32U4 + cbi(TCCR4C, COM4D0); + #endif + OCR4D = val; // set pwm duty + break; + #endif + + + #if defined(TCCR5A) && defined(COM5A1) + case TIMER5A: + // connect pwm to pin on timer 5, channel A + sbi(TCCR5A, COM5A1); + OCR5A = val; // set pwm duty + break; + #endif + + #if defined(TCCR5A) && defined(COM5B1) + case TIMER5B: + // connect pwm to pin on timer 5, channel B + sbi(TCCR5A, COM5B1); + OCR5B = val; // set pwm duty + break; + #endif + + #if defined(TCCR5A) && defined(COM5C1) + case TIMER5C: + // connect pwm to pin on timer 5, channel C + sbi(TCCR5A, COM5C1); + OCR5C = val; // set pwm duty + break; + #endif + + case NOT_ON_TIMER: + default: + if (val < 128) { + digitalWrite(pin, LOW); + } else { + digitalWrite(pin, HIGH); + } + } + } +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring_digital.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,178 @@ +/* + wiring_digital.c - digital input and output functions + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + Modified 28 September 2010 by Mark Sproul + + $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ +*/ + +#define ARDUINO_MAIN +#include "wiring_private.h" +#include "pins_arduino.h" + +void pinMode(uint8_t pin, uint8_t mode) +{ + uint8_t bit = digitalPinToBitMask(pin); + uint8_t port = digitalPinToPort(pin); + volatile uint8_t *reg, *out; + + if (port == NOT_A_PIN) return; + + // JWS: can I let the optimizer do this? + reg = portModeRegister(port); + out = portOutputRegister(port); + + if (mode == INPUT) { + uint8_t oldSREG = SREG; + cli(); + *reg &= ~bit; + *out &= ~bit; + SREG = oldSREG; + } else if (mode == INPUT_PULLUP) { + uint8_t oldSREG = SREG; + cli(); + *reg &= ~bit; + *out |= bit; + SREG = oldSREG; + } else { + uint8_t oldSREG = SREG; + cli(); + *reg |= bit; + SREG = oldSREG; + } +} + +// Forcing this inline keeps the callers from having to push their own stuff +// on the stack. It is a good performance win and only takes 1 more byte per +// user than calling. (It will take more bytes on the 168.) +// +// But shouldn't this be moved into pinMode? Seems silly to check and do on +// each digitalread or write. +// +// Mark Sproul: +// - Removed inline. Save 170 bytes on atmega1280 +// - changed to a switch statment; added 32 bytes but much easier to read and maintain. +// - Added more #ifdefs, now compiles for atmega645 +// +//static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline)); +//static inline void turnOffPWM(uint8_t timer) +static void turnOffPWM(uint8_t timer) +{ + switch (timer) + { + #if defined(TCCR1A) && defined(COM1A1) + case TIMER1A: cbi(TCCR1A, COM1A1); break; + #endif + #if defined(TCCR1A) && defined(COM1B1) + case TIMER1B: cbi(TCCR1A, COM1B1); break; + #endif + + #if defined(TCCR2) && defined(COM21) + case TIMER2: cbi(TCCR2, COM21); break; + #endif + + #if defined(TCCR0A) && defined(COM0A1) + case TIMER0A: cbi(TCCR0A, COM0A1); break; + #endif + + #if defined(TIMER0B) && defined(COM0B1) + case TIMER0B: cbi(TCCR0A, COM0B1); break; + #endif + #if defined(TCCR2A) && defined(COM2A1) + case TIMER2A: cbi(TCCR2A, COM2A1); break; + #endif + #if defined(TCCR2A) && defined(COM2B1) + case TIMER2B: cbi(TCCR2A, COM2B1); break; + #endif + + #if defined(TCCR3A) && defined(COM3A1) + case TIMER3A: cbi(TCCR3A, COM3A1); break; + #endif + #if defined(TCCR3A) && defined(COM3B1) + case TIMER3B: cbi(TCCR3A, COM3B1); break; + #endif + #if defined(TCCR3A) && defined(COM3C1) + case TIMER3C: cbi(TCCR3A, COM3C1); break; + #endif + + #if defined(TCCR4A) && defined(COM4A1) + case TIMER4A: cbi(TCCR4A, COM4A1); break; + #endif + #if defined(TCCR4A) && defined(COM4B1) + case TIMER4B: cbi(TCCR4A, COM4B1); break; + #endif + #if defined(TCCR4A) && defined(COM4C1) + case TIMER4C: cbi(TCCR4A, COM4C1); break; + #endif + #if defined(TCCR4C) && defined(COM4D1) + case TIMER4D: cbi(TCCR4C, COM4D1); break; + #endif + + #if defined(TCCR5A) + case TIMER5A: cbi(TCCR5A, COM5A1); break; + case TIMER5B: cbi(TCCR5A, COM5B1); break; + case TIMER5C: cbi(TCCR5A, COM5C1); break; + #endif + } +} + +void digitalWrite(uint8_t pin, uint8_t val) +{ + uint8_t timer = digitalPinToTimer(pin); + uint8_t bit = digitalPinToBitMask(pin); + uint8_t port = digitalPinToPort(pin); + volatile uint8_t *out; + + if (port == NOT_A_PIN) return; + + // If the pin that support PWM output, we need to turn it off + // before doing a digital write. + if (timer != NOT_ON_TIMER) turnOffPWM(timer); + + out = portOutputRegister(port); + + uint8_t oldSREG = SREG; + cli(); + + if (val == LOW) { + *out &= ~bit; + } else { + *out |= bit; + } + + SREG = oldSREG; +} + +int digitalRead(uint8_t pin) +{ + uint8_t timer = digitalPinToTimer(pin); + uint8_t bit = digitalPinToBitMask(pin); + uint8_t port = digitalPinToPort(pin); + + if (port == NOT_A_PIN) return LOW; + + // If the pin that support PWM output, we need to turn it off + // before getting a digital reading. + if (timer != NOT_ON_TIMER) turnOffPWM(timer); + + if (*portInputRegister(port) & bit) return HIGH; + return LOW; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring_private.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,69 @@ +/* + wiring_private.h - Internal header file. + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.h 239 2007-01-12 17:58:39Z mellis $ +*/ + +#ifndef WiringPrivate_h +#define WiringPrivate_h + +#include <avr/io.h> +#include <avr/interrupt.h> +#include <stdio.h> +#include <stdarg.h> + +#include "Arduino.h" + +#ifdef __cplusplus +extern "C"{ +#endif + +#ifndef cbi +#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) +#endif +#ifndef sbi +#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) +#endif + +#define EXTERNAL_INT_0 0 +#define EXTERNAL_INT_1 1 +#define EXTERNAL_INT_2 2 +#define EXTERNAL_INT_3 3 +#define EXTERNAL_INT_4 4 +#define EXTERNAL_INT_5 5 +#define EXTERNAL_INT_6 6 +#define EXTERNAL_INT_7 7 + +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#define EXTERNAL_NUM_INTERRUPTS 8 +#elif defined(__AVR_ATmega1284P__) +#define EXTERNAL_NUM_INTERRUPTS 3 +#else +#define EXTERNAL_NUM_INTERRUPTS 2 +#endif + +typedef void (*voidFuncPtr)(void); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring_pulse.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,69 @@ +/* + wiring_pulse.c - pulseIn() function + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ +*/ + +#include "wiring_private.h" +#include "pins_arduino.h" + +/* Measures the length (in microseconds) of a pulse on the pin; state is HIGH + * or LOW, the type of pulse to measure. Works on pulses from 2-3 microseconds + * to 3 minutes in length, but must be called at least a few dozen microseconds + * before the start of the pulse. */ +unsigned long pulseIn(uint8_t pin, uint8_t state, unsigned long timeout) +{ + // cache the port and bit of the pin in order to speed up the + // pulse width measuring loop and achieve finer resolution. calling + // digitalRead() instead yields much coarser resolution. + uint8_t bit = digitalPinToBitMask(pin); + uint8_t port = digitalPinToPort(pin); + uint8_t stateMask = (state ? bit : 0); + unsigned long width = 0; // keep initialization out of time critical area + + // 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) / 16; + + // wait for any previous pulse to end + while ((*portInputRegister(port) & bit) == stateMask) + if (numloops++ == maxloops) + return 0; + + // wait for the pulse to start + while ((*portInputRegister(port) & bit) != stateMask) + if (numloops++ == maxloops) + return 0; + + // wait for the pulse to stop + while ((*portInputRegister(port) & bit) == stateMask) { + if (numloops++ == maxloops) + return 0; + width++; + } + + // convert the reading to microseconds. The loop has been determined + // to be 20 clock cycles long and have about 16 clocks between the edge + // and the start of the loop. There will be some error introduced by + // the interrupt handlers. + return clockCyclesToMicroseconds(width * 21 + 16); +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/cores/arduino/wiring_shift.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,55 @@ +/* + wiring_shift.c - shiftOut() function + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2005-2006 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.c 248 2007-02-03 15:36:30Z mellis $ +*/ + +#include "wiring_private.h" + +uint8_t shiftIn(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder) { + uint8_t value = 0; + uint8_t i; + + for (i = 0; i < 8; ++i) { + digitalWrite(clockPin, HIGH); + if (bitOrder == LSBFIRST) + value |= digitalRead(dataPin) << i; + else + value |= digitalRead(dataPin) << (7 - i); + digitalWrite(clockPin, LOW); + } + return value; +} + +void shiftOut(uint8_t dataPin, uint8_t clockPin, uint8_t bitOrder, uint8_t val) +{ + uint8_t i; + + for (i = 0; i < 8; i++) { + if (bitOrder == LSBFIRST) + digitalWrite(dataPin, !!(val & (1 << i))); + else + digitalWrite(dataPin, !!(val & (1 << (7 - i)))); + + digitalWrite(clockPin, HIGH); + digitalWrite(clockPin, LOW); + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Mega2560-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,467 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123420001000102DC0109023E0002017D +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:103000004BC0000064C0000062C0000060C000004F +:103010005EC000005CC000005AC0000058C0000044 +:1030200056C0000054C0000052C00000EEC40000B2 +:103030004EC000004CC000004AC0000048C0000064 +:1030400046C0000044C0000042C0000040C0000074 +:103050003EC000003CC000003AC0000038C0000084 +:1030600036C0000034C0000032C0000030C0000094 +:103070002EC000002CC000002AC0000028C00000A4 +:1030800026C0000024C0000022C0000020C00000B4 +:103090001EC000001CC0000011241FBECFEFD2E0F4 +:1030A000DEBFCDBF11E0A0E0B1E0EAEFFCE302C07B +:1030B00005900D92AA33B107D9F711E0AAE3B1E068 +:1030C00001C01D92AB35B107E1F772D314C698CF9A +:1030D000982F15C08091F200882371F48091E80048 +:1030E0008B7F8093E80003C08EB3882351F08091DA +:1030F000E80082FFF9CF02C08091F100915099233E +:1031000049F7089520914A01309149018091480181 +:103110009091470180933F0190934001C9018093B2 +:103120004101909342010895DF93CF9300D000D0E6 +:1031300000D0CDB7DEB780914501843009F45AC084 +:10314000853030F4813059F0833009F0D7C01FC08A +:10315000853009F4A0C0863009F0D0C0C3C080918A +:103160004601823008F0CAC0CDDF80914601882335 +:1031700061F480913F019091400123E0FC01209394 +:103180005700E89507B600FCFDCF85E008C08091A8 +:103190004601882311F0823029F4B4DF89E080935E +:1031A0000101ACC0813009F0A9C020E030E040E06E +:1031B00050E0F90184918F3F81F0CA01AA27BB2713 +:1031C00080933E013093400120933F018AE0809339 +:1031D000010185E080933B0191C02F5F3F4F4F4F2E +:1031E0005F4F2030F0E33F07F0E04F07F0E05F076C +:1031F00001F784C080914601833051F581E08093CE +:103200003A0180914B0190914C01892B71F0809192 +:103210004701813009F072C080914A0190914901C3 +:1032200090933D0180933C0169C0809147018823C0 +:1032300061F42CE088E190E00FB6F894A8958093B3 +:1032400060000FBE2093600059C01092000156C06C +:10325000882309F053C0809147018F3F09F04EC089 +:10326000E0E0F0E093E085E090935700E89507B642 +:1032700000FCFDCF80935700E89507B600FCFDCF1A +:10328000E058FF4F20E3E030F20771F781E18093CF +:103290005700E89533C0DE011196E5E0F1E083E0E8 +:1032A00001900D928150E1F7DE011496E2E0F1E029 +:1032B00083E001900D928150E1F790914701809158 +:1032C0004601882329F4FE01E90FF11D818107C021 +:1032D0008130A1F4FE01BC97E90FF11D808180933C +:1032E00050010CC080914601833041F48091470128 +:1032F000882321F48091480180933E0126960FB6E1 +:10330000F894DEBF0FBECDBFCF91DF9108952F920D +:103310003F924F925F926F927F929F92AF92BF9235 +:10332000CF92DF92EF92FF920F931F93CF93DF9391 +:103330008091590190915A0190934C0180934B01D7 +:1033400080914D01882351F080914D0181508093EF +:103350004D0180914D01882309F45D9A80914E01C1 +:10336000882351F080914E01815080934E018091CD +:103370004E01882309F45C9A80915401833009F44A +:10338000B2C1843030F4813071F0823009F0E3C191 +:1033900011C1853009F4C5C1853008F4BAC1863041 +:1033A00009F0D9C1CDC15C9883E080934E01809132 +:1033B000E800877F8093E80080913A01882329F014 +:1033C000B3DE5D9A5C9A10923A0120914B013091E4 +:1033D0004C012115310529F42AC08EB3882309F444 +:1033E000BAC18091E80082FFF8CF8091F10080930C +:1033F00045012150304030934C0120934B01E6E4CD +:10340000F1E00CC08091F10081932150304081E0C7 +:10341000EB34F80719F43183208308C08091F2005F +:10342000882381F730934C0120934B017DDE8091FE +:103430000101853009F0BAC080914B0190914C0197 +:10344000892B21F482E080930101B0C08AE140DE43 +:1034500080913F018F713CDEC0914101D0914201CA +:1034600020913F013091400121968E01021B130BE8 +:10347000219780914601882309F093C01801369462 +:103480002794C901A0913E01B0E09C01AD0162E02A +:10349000E62EF12C012D112DE20EF31E041F151F37 +:1034A00059016A0190E099249394B5E0A3E048C0E3 +:1034B0008091F200882371F48091E8008B7F8093E3 +:1034C000E80004C08EB3882309F445C18091E80068 +:1034D00082FFF8CF0894210831088091F100682F0D +:1034E0008091F100782FF5010B0190925700E8953B +:1034F00011249F5F903419F021143104A1F4F901D3 +:10350000B0935700E89507B600FCFDCF21143104B5 +:1035100051F0F701A0935700E89507B600FCFDCFE6 +:10352000A801970190E042E0442E512C612C712CAF +:10353000E40CF51C061D171DA40CB51CC61CD71CDD +:103540002114310409F0B4CFD0934001C0933F015E +:1035500081E180935700E89527C08091F20088238D +:1035600071F48091E8008B7F8093E80004C08EB3F3 +:10357000882309F4F0C08091E80082FFF8CF6091C1 +:10358000F10080913F0190914001A7D380913F01CC +:103590009091400101969093400180933F0101502A +:1035A000104001151105C9F680E192DD8091E80017 +:1035B0008B7FC3C08091E800877F8093E8005D988F +:1035C00083E080934D0104C08EB3882309F4C3C007 +:1035D0008091E80080FFF8CF80910101893091F05F +:1035E0008A3069F480914601813049F480913F012D +:1035F000909140018093F1009093F1009BC08091E5 +:10360000500196C0609141017091420120913F01AB +:10361000309140016F5F7F4F7B01E21AF30A6150E6 +:10362000704080914601882389F58701169507959A +:10363000C901A0913E01B0E09C01AD011FC0809185 +:10364000F200803271F48091E8008E7F8093E80070 +:1036500004C08EB3882309F47EC08091E80080FF07 +:10366000F8CFF901859194918093F1009093F10046 +:10367000015010402E5F3F4F4F4F5F4F0115110516 +:10368000F1F67093400160933F0129C0823039F513 +:1036900023C08091F200803271F48091E8008E7F27 +:1036A0008093E80004C08EB3882309F454C080914D +:1036B000E80080FFF8CF00913F0110914001C80160 +:1036C00004D38093F1000F5F1F4F109340010093CC +:1036D0003F010894E108F108E114F104D1F682E019 +:1036E0008093010127C08091E800877F8093E800E4 +:1036F00080913B018093F1001092F1001092F10053 +:103700001092F100809101018093F1001092F1007C +:1037100011C08091E800877F8093E80010923B0100 +:1037200019C08091E800877F8093E80080910101B3 +:103730008093F1008091E8008E7F8093E8000AC0BA +:103740008091E800877F8093E8005D9A5C9A82E030 +:103750008093010187D0DF91CF911F910F91FF904E +:10376000EF90DF90CF90BF90AF909F907F906F9041 +:103770005F904F903F902F9008952BD181E085BFAF +:1037800015BE089584B7877F84BF88E10FB6F8948B +:1037900080936000109260000FBE81E085BF82E0E0 +:1037A00085BF8AB180638AB98BB180638BB90CC144 +:1037B000E9DF789401C080D2809100018823D9F795 +:1037C00080913A018823B9F7D8DFE0913C01F0916C +:1037D0003D010995FA01923071F0933089F09130F2 +:1037E00029F488E091E022E130E019C080E090E027 +:1037F00020E030E014C08AE191E02BE130E00FC01E +:10380000882339F480913501282F30E085E391E059 +:1038100006C080914301282F30E083E491E091833A +:103820008083C90108958091EB0081608093EB0053 +:103830001092ED006093EC004093ED008091EE005B +:10384000881F8827881F08951092F4001092F000B6 +:103850001092E8001092ED00EBEEF0E080818E7F98 +:10386000808308958091530188238CF403C08EB324 +:103870008823B1F08091E80082FFF9CF8091E800C1 +:103880008B7F8093E80008958EB3882349F0809160 +:10389000E80080FFF9CF8091E8008E7F8093E800F8 +:1038A00008959C014091590150915A0146175707BC +:1038B00018F4F90120E038C06115710511F0AB0171 +:1038C000F8CF8091E8008E7F8093E80040E050E0E0 +:1038D000F0CF8091E80083FF02C081E008958091DD +:1038E000E80082FD2DC08EB3882381F18EB3853030 +:1038F00079F18091E80080FF17C09091F20006C036 +:1039000081918093F100415050409F5F41155105D6 +:1039100011F09032A8F320E0903209F421E0809178 +:10392000E8008E7F8093E8004115510591F622232F +:1039300081F606C08EB3882349F08EB3853041F0FE +:103940008091E80082FFF6CF80E0089582E008953C +:1039500083E0089554D056D01EBA1092510184E0ED +:1039600089BD89B5826089BD09B400FEFDCF809113 +:10397000D800982F9F779093D80080688093D800C4 +:10398000809163008E7F809363008091D8008F7D4B +:103990008093D8008091E0008E7F8093E00080913A +:1039A000E1008E7F8093E1008091E200816080934E +:1039B000E2008091E100877F8093E1008091E20046 +:1039C00088608093E2000895C5DF81E08093520112 +:1039D0000895C0DFE0EEF0E0808181608083E8ED53 +:1039E000F0E080818F7780830AD00CD019BCE3E6A9 +:1039F000F0E08081816080831092520108951092DE +:103A0000E20008951092E10008951F920F920FB600 +:103A10000F9211242F933F934F935F936F937F9354 +:103A20008F939F93AF93BF93EF93FF938091E100A8 +:103A300080FF1BC08091E20080FF17C08091E100F1 +:103A40008E7F8093E1008091E2008E7F8093E20080 +:103A50008091E20080618093E2008091D8008062D2 +:103A60008093D80019BC1EBA26D18091E10084FF52 +:103A700029C08091E20084FF25C084E089BD89B51A +:103A8000826089BD09B400FEFDCF8091D8008F7D92 +:103A90008093D8008091E1008F7E8093E100809137 +:103AA000E2008F7E8093E2008091E200816080934B +:103AB000E20080915101882311F481E001C084E08B +:103AC0008EBBF9D08091E10083FF22C08091E2009B +:103AD00083FF1EC08091E100877F8093E10082E038 +:103AE0008EBB109251018091E1008E7F8093E100A6 +:103AF0008091E2008E7F8093E2008091E2008061FD +:103B00008093E200A1DE80E060E042E28CDED3D070 +:103B10008091E10082FF0AC08091E20082FF06C02E +:103B20008091E1008B7F8093E100C5D0FF91EF9100 +:103B3000BF91AF919F918F917F916F915F914F91C5 +:103B40003F912F910F900FBE0F901F9018951F93CC +:103B5000DF93CF9300D0CDB7DEB7E3E5F1E08091FE +:103B6000F100819381E0EB35F807C9F7909153019B +:103B700080915401853011F1863040F48130B9F0E4 +:103B8000813070F0833009F081C011C0883009F4B1 +:103B900053C0893009F462C0863009F077C02DC067 +:103BA000903809F474C0923809F070C070C099233D +:103BB00009F46DC0923009F069C069C0992309F019 +:103BC00065C0109155018091E800877F8093E800DF +:103BD00049DE04C08EB3882309F459C08091E800FF +:103BE00080FFF8CF812F8F7711F492E001C093E02E +:103BF0009EBB80688093E3004AC09058923008F0E2 +:103C000045C0809155019091560160915701AE01D8 +:103C10004F5F5F4FDFDDBC010097C9F18091E80085 +:103C2000877F8093E80089819A813BDE8091E8005C +:103C30008B7F8093E8002BC0903841F58091E8009D +:103C4000877F8093E800809151018093F1008091FB +:103C5000E8008E7F8093E80005DE19C09923B1F457 +:103C600090915501923098F48091E800877F80937D +:103C7000E80090935101F6DD80915101882311F401 +:103C800083E001C084E08EBB16D001C040DB809190 +:103C9000E80083FF0AC08091EB0080628093EB0014 +:103CA0008091E800877F8093E8000F900F90CF917C +:103CB000DF911F91089508958EB3882329F0809194 +:103CC000E80083FF01C043CF0895F999FECF92BD6C +:103CD00081BDF89A992780B50895262FF999FECFCE +:103CE0001FBA92BD81BD20BD0FB6F894FA9AF99A19 +:0A3CF0000FBE01960895F894FFCF6F +:103CFA0001021E948920DCFB120110010000002041 +:103D0A00EB03EF2F00000001000109021B00010173 +:103D1A000080320904000000FE01020009210300AC +:0A3D2A0000000C000104030904006E +:0400000300003000C9 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-MegaADK-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,467 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123440001000102DC0109023E0002017B +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:103000004BC0000064C0000062C0000060C000004F +:103010005EC000005CC000005AC0000058C0000044 +:1030200056C0000054C0000052C00000EEC40000B2 +:103030004EC000004CC000004AC0000048C0000064 +:1030400046C0000044C0000042C0000040C0000074 +:103050003EC000003CC000003AC0000038C0000084 +:1030600036C0000034C0000032C0000030C0000094 +:103070002EC000002CC000002AC0000028C00000A4 +:1030800026C0000024C0000022C0000020C00000B4 +:103090001EC000001CC0000011241FBECFEFD2E0F4 +:1030A000DEBFCDBF11E0A0E0B1E0EAEFFCE302C07B +:1030B00005900D92AA33B107D9F711E0AAE3B1E068 +:1030C00001C01D92AB35B107E1F772D314C698CF9A +:1030D000982F15C08091F200882371F48091E80048 +:1030E0008B7F8093E80003C08EB3882351F08091DA +:1030F000E80082FFF9CF02C08091F100915099233E +:1031000049F7089520914A01309149018091480181 +:103110009091470180933F0190934001C9018093B2 +:103120004101909342010895DF93CF9300D000D0E6 +:1031300000D0CDB7DEB780914501843009F45AC084 +:10314000853030F4813059F0833009F0D7C01FC08A +:10315000853009F4A0C0863009F0D0C0C3C080918A +:103160004601823008F0CAC0CDDF80914601882335 +:1031700061F480913F019091400123E0FC01209394 +:103180005700E89507B600FCFDCF85E008C08091A8 +:103190004601882311F0823029F4B4DF89E080935E +:1031A0000101ACC0813009F0A9C020E030E040E06E +:1031B00050E0F90184918F3F81F0CA01AA27BB2713 +:1031C00080933E013093400120933F018AE0809339 +:1031D000010185E080933B0191C02F5F3F4F4F4F2E +:1031E0005F4F2030F0E33F07F0E04F07F0E05F076C +:1031F00001F784C080914601833051F581E08093CE +:103200003A0180914B0190914C01892B71F0809192 +:103210004701813009F072C080914A0190914901C3 +:1032200090933D0180933C0169C0809147018823C0 +:1032300061F42CE088E190E00FB6F894A8958093B3 +:1032400060000FBE2093600059C01092000156C06C +:10325000882309F053C0809147018F3F09F04EC089 +:10326000E0E0F0E093E085E090935700E89507B642 +:1032700000FCFDCF80935700E89507B600FCFDCF1A +:10328000E058FF4F20E3E030F20771F781E18093CF +:103290005700E89533C0DE011196E5E0F1E083E0E8 +:1032A00001900D928150E1F7DE011496E2E0F1E029 +:1032B00083E001900D928150E1F790914701809158 +:1032C0004601882329F4FE01E90FF11D818107C021 +:1032D0008130A1F4FE01BC97E90FF11D808180933C +:1032E00050010CC080914601833041F48091470128 +:1032F000882321F48091480180933E0126960FB6E1 +:10330000F894DEBF0FBECDBFCF91DF9108952F920D +:103310003F924F925F926F927F929F92AF92BF9235 +:10332000CF92DF92EF92FF920F931F93CF93DF9391 +:103330008091590190915A0190934C0180934B01D7 +:1033400080914D01882351F080914D0181508093EF +:103350004D0180914D01882309F45D9A80914E01C1 +:10336000882351F080914E01815080934E018091CD +:103370004E01882309F45C9A80915401833009F44A +:10338000B2C1843030F4813071F0823009F0E3C191 +:1033900011C1853009F4C5C1853008F4BAC1863041 +:1033A00009F0D9C1CDC15C9883E080934E01809132 +:1033B000E800877F8093E80080913A01882329F014 +:1033C000B3DE5D9A5C9A10923A0120914B013091E4 +:1033D0004C012115310529F42AC08EB3882309F444 +:1033E000BAC18091E80082FFF8CF8091F10080930C +:1033F00045012150304030934C0120934B01E6E4CD +:10340000F1E00CC08091F10081932150304081E0C7 +:10341000EB34F80719F43183208308C08091F2005F +:10342000882381F730934C0120934B017DDE8091FE +:103430000101853009F0BAC080914B0190914C0197 +:10344000892B21F482E080930101B0C08AE140DE43 +:1034500080913F018F713CDEC0914101D0914201CA +:1034600020913F013091400121968E01021B130BE8 +:10347000219780914601882309F093C01801369462 +:103480002794C901A0913E01B0E09C01AD0162E02A +:10349000E62EF12C012D112DE20EF31E041F151F37 +:1034A00059016A0190E099249394B5E0A3E048C0E3 +:1034B0008091F200882371F48091E8008B7F8093E3 +:1034C000E80004C08EB3882309F445C18091E80068 +:1034D00082FFF8CF0894210831088091F100682F0D +:1034E0008091F100782FF5010B0190925700E8953B +:1034F00011249F5F903419F021143104A1F4F901D3 +:10350000B0935700E89507B600FCFDCF21143104B5 +:1035100051F0F701A0935700E89507B600FCFDCFE6 +:10352000A801970190E042E0442E512C612C712CAF +:10353000E40CF51C061D171DA40CB51CC61CD71CDD +:103540002114310409F0B4CFD0934001C0933F015E +:1035500081E180935700E89527C08091F20088238D +:1035600071F48091E8008B7F8093E80004C08EB3F3 +:10357000882309F4F0C08091E80082FFF8CF6091C1 +:10358000F10080913F0190914001A7D380913F01CC +:103590009091400101969093400180933F0101502A +:1035A000104001151105C9F680E192DD8091E80017 +:1035B0008B7FC3C08091E800877F8093E8005D988F +:1035C00083E080934D0104C08EB3882309F4C3C007 +:1035D0008091E80080FFF8CF80910101893091F05F +:1035E0008A3069F480914601813049F480913F012D +:1035F000909140018093F1009093F1009BC08091E5 +:10360000500196C0609141017091420120913F01AB +:10361000309140016F5F7F4F7B01E21AF30A6150E6 +:10362000704080914601882389F58701169507959A +:10363000C901A0913E01B0E09C01AD011FC0809185 +:10364000F200803271F48091E8008E7F8093E80070 +:1036500004C08EB3882309F47EC08091E80080FF07 +:10366000F8CFF901859194918093F1009093F10046 +:10367000015010402E5F3F4F4F4F5F4F0115110516 +:10368000F1F67093400160933F0129C0823039F513 +:1036900023C08091F200803271F48091E8008E7F27 +:1036A0008093E80004C08EB3882309F454C080914D +:1036B000E80080FFF8CF00913F0110914001C80160 +:1036C00004D38093F1000F5F1F4F109340010093CC +:1036D0003F010894E108F108E114F104D1F682E019 +:1036E0008093010127C08091E800877F8093E800E4 +:1036F00080913B018093F1001092F1001092F10053 +:103700001092F100809101018093F1001092F1007C +:1037100011C08091E800877F8093E80010923B0100 +:1037200019C08091E800877F8093E80080910101B3 +:103730008093F1008091E8008E7F8093E8000AC0BA +:103740008091E800877F8093E8005D9A5C9A82E030 +:103750008093010187D0DF91CF911F910F91FF904E +:10376000EF90DF90CF90BF90AF909F907F906F9041 +:103770005F904F903F902F9008952BD181E085BFAF +:1037800015BE089584B7877F84BF88E10FB6F8948B +:1037900080936000109260000FBE81E085BF82E0E0 +:1037A00085BF8AB180638AB98BB180638BB90CC144 +:1037B000E9DF789401C080D2809100018823D9F795 +:1037C00080913A018823B9F7D8DFE0913C01F0916C +:1037D0003D010995FA01923071F0933089F09130F2 +:1037E00029F488E091E022E130E019C080E090E027 +:1037F00020E030E014C08AE191E02BE130E00FC01E +:10380000882339F480913501282F30E085E391E059 +:1038100006C080914301282F30E083E491E091833A +:103820008083C90108958091EB0081608093EB0053 +:103830001092ED006093EC004093ED008091EE005B +:10384000881F8827881F08951092F4001092F000B6 +:103850001092E8001092ED00EBEEF0E080818E7F98 +:10386000808308958091530188238CF403C08EB324 +:103870008823B1F08091E80082FFF9CF8091E800C1 +:103880008B7F8093E80008958EB3882349F0809160 +:10389000E80080FFF9CF8091E8008E7F8093E800F8 +:1038A00008959C014091590150915A0146175707BC +:1038B00018F4F90120E038C06115710511F0AB0171 +:1038C000F8CF8091E8008E7F8093E80040E050E0E0 +:1038D000F0CF8091E80083FF02C081E008958091DD +:1038E000E80082FD2DC08EB3882381F18EB3853030 +:1038F00079F18091E80080FF17C09091F20006C036 +:1039000081918093F100415050409F5F41155105D6 +:1039100011F09032A8F320E0903209F421E0809178 +:10392000E8008E7F8093E8004115510591F622232F +:1039300081F606C08EB3882349F08EB3853041F0FE +:103940008091E80082FFF6CF80E0089582E008953C +:1039500083E0089554D056D01EBA1092510184E0ED +:1039600089BD89B5826089BD09B400FEFDCF809113 +:10397000D800982F9F779093D80080688093D800C4 +:10398000809163008E7F809363008091D8008F7D4B +:103990008093D8008091E0008E7F8093E00080913A +:1039A000E1008E7F8093E1008091E200816080934E +:1039B000E2008091E100877F8093E1008091E20046 +:1039C00088608093E2000895C5DF81E08093520112 +:1039D0000895C0DFE0EEF0E0808181608083E8ED53 +:1039E000F0E080818F7780830AD00CD019BCE3E6A9 +:1039F000F0E08081816080831092520108951092DE +:103A0000E20008951092E10008951F920F920FB600 +:103A10000F9211242F933F934F935F936F937F9354 +:103A20008F939F93AF93BF93EF93FF938091E100A8 +:103A300080FF1BC08091E20080FF17C08091E100F1 +:103A40008E7F8093E1008091E2008E7F8093E20080 +:103A50008091E20080618093E2008091D8008062D2 +:103A60008093D80019BC1EBA26D18091E10084FF52 +:103A700029C08091E20084FF25C084E089BD89B51A +:103A8000826089BD09B400FEFDCF8091D8008F7D92 +:103A90008093D8008091E1008F7E8093E100809137 +:103AA000E2008F7E8093E2008091E200816080934B +:103AB000E20080915101882311F481E001C084E08B +:103AC0008EBBF9D08091E10083FF22C08091E2009B +:103AD00083FF1EC08091E100877F8093E10082E038 +:103AE0008EBB109251018091E1008E7F8093E100A6 +:103AF0008091E2008E7F8093E2008091E2008061FD +:103B00008093E200A1DE80E060E042E28CDED3D070 +:103B10008091E10082FF0AC08091E20082FF06C02E +:103B20008091E1008B7F8093E100C5D0FF91EF9100 +:103B3000BF91AF919F918F917F916F915F914F91C5 +:103B40003F912F910F900FBE0F901F9018951F93CC +:103B5000DF93CF9300D0CDB7DEB7E3E5F1E08091FE +:103B6000F100819381E0EB35F807C9F7909153019B +:103B700080915401853011F1863040F48130B9F0E4 +:103B8000813070F0833009F081C011C0883009F4B1 +:103B900053C0893009F462C0863009F077C02DC067 +:103BA000903809F474C0923809F070C070C099233D +:103BB00009F46DC0923009F069C069C0992309F019 +:103BC00065C0109155018091E800877F8093E800DF +:103BD00049DE04C08EB3882309F459C08091E800FF +:103BE00080FFF8CF812F8F7711F492E001C093E02E +:103BF0009EBB80688093E3004AC09058923008F0E2 +:103C000045C0809155019091560160915701AE01D8 +:103C10004F5F5F4FDFDDBC010097C9F18091E80085 +:103C2000877F8093E80089819A813BDE8091E8005C +:103C30008B7F8093E8002BC0903841F58091E8009D +:103C4000877F8093E800809151018093F1008091FB +:103C5000E8008E7F8093E80005DE19C09923B1F457 +:103C600090915501923098F48091E800877F80937D +:103C7000E80090935101F6DD80915101882311F401 +:103C800083E001C084E08EBB16D001C040DB809190 +:103C9000E80083FF0AC08091EB0080628093EB0014 +:103CA0008091E800877F8093E8000F900F90CF917C +:103CB000DF911F91089508958EB3882329F0809194 +:103CC000E80083FF01C043CF0895F999FECF92BD6C +:103CD00081BDF89A992780B50895262FF999FECFCE +:103CE0001FBA92BD81BD20BD0FB6F894FA9AF99A19 +:0A3CF0000FBE01960895F894FFCF6F +:103CFA0001021E948920DCFB120110010000002041 +:103D0A00EB03EF2F00000001000109021B00010173 +:103D1A000080320904000000FE01020009210300AC +:0A3D2A0000000C000104030904006E +:0400000300003000C9 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/Arduino-COMBINED-dfu-usbserial-atmega16u2-Uno-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,467 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123430001000102DC0109023E0002017C +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:103000004BC0000064C0000062C0000060C000004F +:103010005EC000005CC000005AC0000058C0000044 +:1030200056C0000054C0000052C00000EEC40000B2 +:103030004EC000004CC000004AC0000048C0000064 +:1030400046C0000044C0000042C0000040C0000074 +:103050003EC000003CC000003AC0000038C0000084 +:1030600036C0000034C0000032C0000030C0000094 +:103070002EC000002CC000002AC0000028C00000A4 +:1030800026C0000024C0000022C0000020C00000B4 +:103090001EC000001CC0000011241FBECFEFD2E0F4 +:1030A000DEBFCDBF11E0A0E0B1E0EAEFFCE302C07B +:1030B00005900D92AA33B107D9F711E0AAE3B1E068 +:1030C00001C01D92AB35B107E1F772D314C698CF9A +:1030D000982F15C08091F200882371F48091E80048 +:1030E0008B7F8093E80003C08EB3882351F08091DA +:1030F000E80082FFF9CF02C08091F100915099233E +:1031000049F7089520914A01309149018091480181 +:103110009091470180933F0190934001C9018093B2 +:103120004101909342010895DF93CF9300D000D0E6 +:1031300000D0CDB7DEB780914501843009F45AC084 +:10314000853030F4813059F0833009F0D7C01FC08A +:10315000853009F4A0C0863009F0D0C0C3C080918A +:103160004601823008F0CAC0CDDF80914601882335 +:1031700061F480913F019091400123E0FC01209394 +:103180005700E89507B600FCFDCF85E008C08091A8 +:103190004601882311F0823029F4B4DF89E080935E +:1031A0000101ACC0813009F0A9C020E030E040E06E +:1031B00050E0F90184918F3F81F0CA01AA27BB2713 +:1031C00080933E013093400120933F018AE0809339 +:1031D000010185E080933B0191C02F5F3F4F4F4F2E +:1031E0005F4F2030F0E33F07F0E04F07F0E05F076C +:1031F00001F784C080914601833051F581E08093CE +:103200003A0180914B0190914C01892B71F0809192 +:103210004701813009F072C080914A0190914901C3 +:1032200090933D0180933C0169C0809147018823C0 +:1032300061F42CE088E190E00FB6F894A8958093B3 +:1032400060000FBE2093600059C01092000156C06C +:10325000882309F053C0809147018F3F09F04EC089 +:10326000E0E0F0E093E085E090935700E89507B642 +:1032700000FCFDCF80935700E89507B600FCFDCF1A +:10328000E058FF4F20E3E030F20771F781E18093CF +:103290005700E89533C0DE011196E5E0F1E083E0E8 +:1032A00001900D928150E1F7DE011496E2E0F1E029 +:1032B00083E001900D928150E1F790914701809158 +:1032C0004601882329F4FE01E90FF11D818107C021 +:1032D0008130A1F4FE01BC97E90FF11D808180933C +:1032E00050010CC080914601833041F48091470128 +:1032F000882321F48091480180933E0126960FB6E1 +:10330000F894DEBF0FBECDBFCF91DF9108952F920D +:103310003F924F925F926F927F929F92AF92BF9235 +:10332000CF92DF92EF92FF920F931F93CF93DF9391 +:103330008091590190915A0190934C0180934B01D7 +:1033400080914D01882351F080914D0181508093EF +:103350004D0180914D01882309F45D9A80914E01C1 +:10336000882351F080914E01815080934E018091CD +:103370004E01882309F45C9A80915401833009F44A +:10338000B2C1843030F4813071F0823009F0E3C191 +:1033900011C1853009F4C5C1853008F4BAC1863041 +:1033A00009F0D9C1CDC15C9883E080934E01809132 +:1033B000E800877F8093E80080913A01882329F014 +:1033C000B3DE5D9A5C9A10923A0120914B013091E4 +:1033D0004C012115310529F42AC08EB3882309F444 +:1033E000BAC18091E80082FFF8CF8091F10080930C +:1033F00045012150304030934C0120934B01E6E4CD +:10340000F1E00CC08091F10081932150304081E0C7 +:10341000EB34F80719F43183208308C08091F2005F +:10342000882381F730934C0120934B017DDE8091FE +:103430000101853009F0BAC080914B0190914C0197 +:10344000892B21F482E080930101B0C08AE140DE43 +:1034500080913F018F713CDEC0914101D0914201CA +:1034600020913F013091400121968E01021B130BE8 +:10347000219780914601882309F093C01801369462 +:103480002794C901A0913E01B0E09C01AD0162E02A +:10349000E62EF12C012D112DE20EF31E041F151F37 +:1034A00059016A0190E099249394B5E0A3E048C0E3 +:1034B0008091F200882371F48091E8008B7F8093E3 +:1034C000E80004C08EB3882309F445C18091E80068 +:1034D00082FFF8CF0894210831088091F100682F0D +:1034E0008091F100782FF5010B0190925700E8953B +:1034F00011249F5F903419F021143104A1F4F901D3 +:10350000B0935700E89507B600FCFDCF21143104B5 +:1035100051F0F701A0935700E89507B600FCFDCFE6 +:10352000A801970190E042E0442E512C612C712CAF +:10353000E40CF51C061D171DA40CB51CC61CD71CDD +:103540002114310409F0B4CFD0934001C0933F015E +:1035500081E180935700E89527C08091F20088238D +:1035600071F48091E8008B7F8093E80004C08EB3F3 +:10357000882309F4F0C08091E80082FFF8CF6091C1 +:10358000F10080913F0190914001A7D380913F01CC +:103590009091400101969093400180933F0101502A +:1035A000104001151105C9F680E192DD8091E80017 +:1035B0008B7FC3C08091E800877F8093E8005D988F +:1035C00083E080934D0104C08EB3882309F4C3C007 +:1035D0008091E80080FFF8CF80910101893091F05F +:1035E0008A3069F480914601813049F480913F012D +:1035F000909140018093F1009093F1009BC08091E5 +:10360000500196C0609141017091420120913F01AB +:10361000309140016F5F7F4F7B01E21AF30A6150E6 +:10362000704080914601882389F58701169507959A +:10363000C901A0913E01B0E09C01AD011FC0809185 +:10364000F200803271F48091E8008E7F8093E80070 +:1036500004C08EB3882309F47EC08091E80080FF07 +:10366000F8CFF901859194918093F1009093F10046 +:10367000015010402E5F3F4F4F4F5F4F0115110516 +:10368000F1F67093400160933F0129C0823039F513 +:1036900023C08091F200803271F48091E8008E7F27 +:1036A0008093E80004C08EB3882309F454C080914D +:1036B000E80080FFF8CF00913F0110914001C80160 +:1036C00004D38093F1000F5F1F4F109340010093CC +:1036D0003F010894E108F108E114F104D1F682E019 +:1036E0008093010127C08091E800877F8093E800E4 +:1036F00080913B018093F1001092F1001092F10053 +:103700001092F100809101018093F1001092F1007C +:1037100011C08091E800877F8093E80010923B0100 +:1037200019C08091E800877F8093E80080910101B3 +:103730008093F1008091E8008E7F8093E8000AC0BA +:103740008091E800877F8093E8005D9A5C9A82E030 +:103750008093010187D0DF91CF911F910F91FF904E +:10376000EF90DF90CF90BF90AF909F907F906F9041 +:103770005F904F903F902F9008952BD181E085BFAF +:1037800015BE089584B7877F84BF88E10FB6F8948B +:1037900080936000109260000FBE81E085BF82E0E0 +:1037A00085BF8AB180638AB98BB180638BB90CC144 +:1037B000E9DF789401C080D2809100018823D9F795 +:1037C00080913A018823B9F7D8DFE0913C01F0916C +:1037D0003D010995FA01923071F0933089F09130F2 +:1037E00029F488E091E022E130E019C080E090E027 +:1037F00020E030E014C08AE191E02BE130E00FC01E +:10380000882339F480913501282F30E085E391E059 +:1038100006C080914301282F30E083E491E091833A +:103820008083C90108958091EB0081608093EB0053 +:103830001092ED006093EC004093ED008091EE005B +:10384000881F8827881F08951092F4001092F000B6 +:103850001092E8001092ED00EBEEF0E080818E7F98 +:10386000808308958091530188238CF403C08EB324 +:103870008823B1F08091E80082FFF9CF8091E800C1 +:103880008B7F8093E80008958EB3882349F0809160 +:10389000E80080FFF9CF8091E8008E7F8093E800F8 +:1038A00008959C014091590150915A0146175707BC +:1038B00018F4F90120E038C06115710511F0AB0171 +:1038C000F8CF8091E8008E7F8093E80040E050E0E0 +:1038D000F0CF8091E80083FF02C081E008958091DD +:1038E000E80082FD2DC08EB3882381F18EB3853030 +:1038F00079F18091E80080FF17C09091F20006C036 +:1039000081918093F100415050409F5F41155105D6 +:1039100011F09032A8F320E0903209F421E0809178 +:10392000E8008E7F8093E8004115510591F622232F +:1039300081F606C08EB3882349F08EB3853041F0FE +:103940008091E80082FFF6CF80E0089582E008953C +:1039500083E0089554D056D01EBA1092510184E0ED +:1039600089BD89B5826089BD09B400FEFDCF809113 +:10397000D800982F9F779093D80080688093D800C4 +:10398000809163008E7F809363008091D8008F7D4B +:103990008093D8008091E0008E7F8093E00080913A +:1039A000E1008E7F8093E1008091E200816080934E +:1039B000E2008091E100877F8093E1008091E20046 +:1039C00088608093E2000895C5DF81E08093520112 +:1039D0000895C0DFE0EEF0E0808181608083E8ED53 +:1039E000F0E080818F7780830AD00CD019BCE3E6A9 +:1039F000F0E08081816080831092520108951092DE +:103A0000E20008951092E10008951F920F920FB600 +:103A10000F9211242F933F934F935F936F937F9354 +:103A20008F939F93AF93BF93EF93FF938091E100A8 +:103A300080FF1BC08091E20080FF17C08091E100F1 +:103A40008E7F8093E1008091E2008E7F8093E20080 +:103A50008091E20080618093E2008091D8008062D2 +:103A60008093D80019BC1EBA26D18091E10084FF52 +:103A700029C08091E20084FF25C084E089BD89B51A +:103A8000826089BD09B400FEFDCF8091D8008F7D92 +:103A90008093D8008091E1008F7E8093E100809137 +:103AA000E2008F7E8093E2008091E200816080934B +:103AB000E20080915101882311F481E001C084E08B +:103AC0008EBBF9D08091E10083FF22C08091E2009B +:103AD00083FF1EC08091E100877F8093E10082E038 +:103AE0008EBB109251018091E1008E7F8093E100A6 +:103AF0008091E2008E7F8093E2008091E2008061FD +:103B00008093E200A1DE80E060E042E28CDED3D070 +:103B10008091E10082FF0AC08091E20082FF06C02E +:103B20008091E1008B7F8093E100C5D0FF91EF9100 +:103B3000BF91AF919F918F917F916F915F914F91C5 +:103B40003F912F910F900FBE0F901F9018951F93CC +:103B5000DF93CF9300D0CDB7DEB7E3E5F1E08091FE +:103B6000F100819381E0EB35F807C9F7909153019B +:103B700080915401853011F1863040F48130B9F0E4 +:103B8000813070F0833009F081C011C0883009F4B1 +:103B900053C0893009F462C0863009F077C02DC067 +:103BA000903809F474C0923809F070C070C099233D +:103BB00009F46DC0923009F069C069C0992309F019 +:103BC00065C0109155018091E800877F8093E800DF +:103BD00049DE04C08EB3882309F459C08091E800FF +:103BE00080FFF8CF812F8F7711F492E001C093E02E +:103BF0009EBB80688093E3004AC09058923008F0E2 +:103C000045C0809155019091560160915701AE01D8 +:103C10004F5F5F4FDFDDBC010097C9F18091E80085 +:103C2000877F8093E80089819A813BDE8091E8005C +:103C30008B7F8093E8002BC0903841F58091E8009D +:103C4000877F8093E800809151018093F1008091FB +:103C5000E8008E7F8093E80005DE19C09923B1F457 +:103C600090915501923098F48091E800877F80937D +:103C7000E80090935101F6DD80915101882311F401 +:103C800083E001C084E08EBB16D001C040DB809190 +:103C9000E80083FF0AC08091EB0080628093EB0014 +:103CA0008091E800877F8093E8000F900F90CF917C +:103CB000DF911F91089508958EB3882329F0809194 +:103CC000E80083FF01C043CF0895F999FECF92BD6C +:103CD00081BDF89A992780B50895262FF999FECFCE +:103CE0001FBA92BD81BD20BD0FB6F894FA9AF99A19 +:0A3CF0000FBE01960895F894FFCF6F +:103CFA0001021E948920DCFB120110010000002041 +:103D0A00EB03EF2F00000001000109021B00010173 +:103D1A000080320904000000FE01020009210300AC +:0A3D2A0000000C000104030904006E +:0400000300003000C9 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/MEGA-dfu_and_usbserial_combined.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,234 @@ +:20000000A2C00000BBC00000B9C00000B7C00000B5C00000B3C00000B1C00000AFC000004B +:20002000ADC00000ABC00000A9C000005AC400001EC40000A3C00000A1C000009FC000005C +:200040009DC000009BC0000099C0000097C0000095C0000093C0000091C0000014C100006A +:200060008DC000008BC0000089C0000087C0000085C0000083C0000081C000007FC0000050 +:200080007DC000007BC0000079C0000077C0000075C0000073C000001201100102000008E2 +:2000A0004123100001000102DC0109023E00020100C0320904000001020201000524000170 +:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC +:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA +:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D +:200120002403410072006400750069006E006F0020004D00650067006100200032003500A5 +:2001400036003000000011241FBECFEFD2E0DEBFCDBF11E0A0E0B1E0E0EDFFE002C0059089 +:200160000D92A631B107D9F712E0A6E1B1E001C01D92AF32B107E1F7F1D028C741CF9C0139 +:20018000DC01AE57BF4FED91FC91119741911196FC93EE9380589F4FE817F90711F42D93A9 +:2001A0003C939FB7F894F901EC57FF4F8081815080839FBF842F0895DF92EF92FF920F935B +:2001C0001F93FC018489813019F0823021F405C040E3D42E04C0DD2402C030E2D32E838952 +:2001E000823011F488E0D82A8589873031F0883031F0863031F482E003C084E001C086E094 +:20020000D82A1092C9001092C8001092CA00E784F0880189128980E0E81681EEF80680E068 +:20022000080780E0180719F420E130E00FC0C801B701969587957795679560587B47814E2A +:200240009F4FA8019701A0D6215030403093CD002093CC00D092CA0080E0E81681EEF80612 +:2002600080E0080780E0180711F082E001C080E08093C80088E98093C9001F910F91FF9005 +:20028000EF90DF9008951F920F920FB60F9211242F938F939F93EF93FF939091CE008EB38C +:2002A0008430F1F4E0919901F0919A019083E0919901F0919A01CF01019690939A0180930C +:2002C00099018959914021F489E191E0928381839FB7F89480919D018F5F80939D019FBF3A +:2002E000FF91EF919F918F912F910F900FBE0F901F901895FC01858580FF02C05F9808959B +:200300005F9A089580E091E0D5C580E091E088C584B7877F84BF28E10FB6F89420936000CD +:20032000109260000FBE87E690E09093CD008093CC0086E08093CA001092C8002093C90019 +:20034000539A5A9A8AB180638AB98BB180638BB983D284E085BD5F9A579A08950F931F9322 +:20036000CF93DF93D5DF2FB7F8948EE991E090931F0280931E0290932102809320022FBFBB +:200380002FB7F89489E191E090939A018093990190939C0180939B012FBF7894CEE9D1E0D4 +:2003A00003E08FB7F894909122028FBF903809F180E091E0ABD497FD1CC0E0911E02F09161 +:2003C0001F028083E0911E02F0911F02CF01019690931F0280931E028E51924011F4D283DD +:2003E000C1839FB7F894809122028F5F809322029FBF8FB7F89410919D018FBFA89902C0BD +:20040000113678F1A89A80919D01882361F05D980093160108C089E191E0B1DE682F80E077 +:2004200091E0DAD411501123B1F780911601882351F0809116018150809316018091160101 +:20044000882309F45D9A80911701882351F08091170181508093170180911701882309F4F2 +:200460005C9A8FB7F894909122028FBF992369F08EE991E084DE982F8091C80085FFFCCFD3 +:200480009093CE005C980093170180E091E095D42AD487CFDA01923049F0933061F0913093 +:2004A000F9F4E8E9F0E022E130E01EC0EAEAF0E02EE330E019C0813049F0813018F08230CA +:2004C00079F408C0E8EEF0E0849107C0ECEEF0E0849103C0E0E2F1E08491282F30E004C010 +:2004E000E0E0F0E020E030E0ED93FC93C901089528E030E040E003C04F5F220F331F28177B +:200500003907D0F3842F8295807F08958093E9008091EB0081608093EB001092ED00609319 +:20052000EC004093ED008091EE00881F8827881F08951092F40090E09093E9001092F000D2 +:200540001092E8001092ED008091EB008E7F8093EB009F5F953081F70895809127028823BE +:200560008CF403C08EB38823B1F08091E80082FFF9CF8091E8008B778093E80008958EB395 +:20058000882349F08091E80080FFF9CF8091E8008E778093E800089594E68091EC0080FFAB +:2005A00005C08091E80080FF05C023C08091E80082FD1FC08EB3882311F482E008958EB3CE +:2005C000853011F483E008958091EB0085FF02C081E008958091E10082FFDFCF8091E1000E +:2005E0008B7F8093E100992311F484E008959150D4CF80E008959C0140912D0250912E020C +:200600004617570718F4F90120E038C06115710511F0AB01F8CF8091E8008E778093E800C8 +:2006200040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC08EB3882381F1AD +:200640008EB3853079F18091E80080FF17C09091F20006C081918093F100415050409F5FDD +:200660004115510511F09830A8F320E0983009F421E08091E8008E778093E80041155105FF +:2006800091F6222381F606C08EB3882349F08EB3853041F08091E80082FFF6CF80E00895C9 +:2006A00082E0089583E008959C0140912D0250912E024617570710F490E03BC06115710577 +:2006C00011F0AB01F9CF8091E8008E778093E80040E050E0F1CF8091E80083FF02C081E0FE +:2006E00008958091E80082FD30C08EB3882399F18EB3853091F18091E80080FF1AC08091A4 +:20070000F20009C0F9012F5F3F4FE491E093F100415050408F5F4115510511F0883090F338 +:2007200090E0883009F491E08091E8008E778093E8004115510579F6992369F606C08EB3ED +:20074000882349F08EB3853041F08091E80082FFF6CF80E0089582E0089583E008959C01B6 +:200760006115710529F48091E8008B778093E800F90120C08091E80083FF02C081E0089565 +:200780008EB3882339F18EB3853031F18091E80082FFF0CF06C08091F100819361507040B5 +:2007A00021F08091F2008823B1F78091E8008B778093E80061157105E9F606C08EB388235F +:2007C00049F08EB3853041F08091E80080FFF6CF80E0089582E0089583E0089542D044D05A +:2007E0001EBA10922502109224021092230284E089BD89B5826089BD09B400FEFDCF809121 +:20080000D800982F9F779093D80080688093D800809163008E7F809363008091D8008F7D69 +:200820008093D8008091E0008E7F8093E0008091E1008E7F8093E1008091E2008160809302 +:20084000E2008091E100877F8093E1008091E20088608093E2000895C1DF81E08093260221 +:2008600008951092E20008951092E10008951F920F920FB60F9211241F932F933F934F9385 +:200880005F936F937F938F939F93AF93BF93EF93FF93E9EEF0E0108117701082E0EFF0E066 +:2008A0008081877F80837894C3D0F894A9EEB0E01C92E0EFF0E08081886080831C93FF9164 +:2008C000EF91BF91AF919F918F917F916F915F914F913F912F911F910F900FBE0F901F90DE +:2008E00018951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF93BF93FA +:20090000EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E10080912A +:20092000E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC1EBAA7 +:20094000D1D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B400FE71 +:20096000FDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093E200E3 +:200980008091E20081608093E20080912502882311F481E001C084E08EBBA4D18091E10070 +:2009A00083FF27C08091E20083FF23C08091E100877F8093E10082E08EBB10922502809105 +:2009C000E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200AADD80E090 +:2009E00060E042E093DD8091F00088608093F00079D18091E10082FF0AC08091E20082FF3E +:200A000006C08091E1008B7F8093E1006BD1FF91EF91BF91AF919F918F917F916F915F91F4 +:200A20004F913F912F910F900FBE0F901F9018951F93DF93CF93CDB7DEB7AC970FB6F894AC +:200A4000DEBF0FBECDBFE7E2F2E08091F100819322E0EF32F207C9F78091270230912802EE +:200A6000353009F487C0363040F43130C9F1313070F0333009F01DC133C0383009F4EFC016 +:200A8000393009F4FEC0363009F013C192C0803821F0823809F00DC108C090912302809144 +:200AA0002402882399F0926011C080912B0287708093E9008091EB0090E025E09695879530 +:200AC0002A95E1F7982F91701092E9008091E800877F8093E8009093F1001092F100CAC001 +:200AE000882319F0823009F0E4C090E08F719070009721F0029709F0DDC00CC080912902A4 +:200B0000813009F0D7C010922402333069F5809324022AC080912902882331F520912B02FD +:200B2000277009F4C7C02093E9008091EB0080FFC1C0333021F48091EB00806213C08091C8 +:200B4000EB0080618093EB0081E090E002C0880F991F2A95E2F78093EA001092EA008091B7 +:200B6000EB0088608093EB001092E9008091E800877F83C0882309F09CC0109129028091FA +:200B8000E800877F8093E800E8DC04C08EB3882309F490C08091E80080FFF8CF812F8F77B6 +:200BA00011F492E001C093E09EBB80688093E30081C08058823008F07CC0809129029091F7 +:200BC0002A0223E08C3D920799F55FB7F894DE0115964EE020E030E061E2E42FF0E0609373 +:200BE0005700849120FF03C082958F704F5F982F9F70892F805D8A3308F0895F8C93119615 +:200C00001C9211972F5F3F4F12962431310529F75FBF8AE28B8383E08C838091E800877F06 +:200C20008093E800CE0103966AE270E0E4DC11C060912B02AE014F5F5F4F2CDCBC0100979F +:200C4000C9F18091E800877F8093E80089819A812BDD8091E8008B778093E8002BC080381A +:200C600041F58091E800877F8093E800809125028093F1008091E8008E778093E8006DDCC6 +:200C800019C08823B1F490912902923098F48091E800877F8093E800909325025EDC809102 +:200CA0002502882311F483E001C084E08EBB2DDB01C028DB8091E80083FF0AC08091EB007F +:200CC00080628093EB008091E800877F8093E800AC960FB6F894DEBF0FBECDBFCF91DF91E1 +:200CE0001F91089508951F938EB3882361F01091E9001092E9008091E80083FF01C098DE54 +:200D000017701093E9001F9108950895FC018EB3843021F587859089A189B2890097A10507 +:200D2000B105E1F085818093E9008091E80082FF15C08091F200882319F42FEF3FEF04C010 +:200D40008091F100282F30E08091F200882341F48091E8008B778093E80002C02FEF3FEF43 +:200D6000C9010895FC018EB3843011F587859089A189B2890097A105B105D1F081818093C1 +:200D8000E9008091F2008823A9F09091E8008091E8008E778093E80095FD0CC0FDDB982F24 +:200DA000882349F48091E8008E778093E80003C092E001C090E0892F0895FC018EB38430A5 +:200DC00051F487859089A189B2890097A105B10511F0CF01C7CF08951F93FC01162F8EB318 +:200DE0008430D9F487859089A189B2890097A105B10599F081818093E9008091E80085FDF3 +:200E000008C08091E8008E778093E800C5DB882329F41093F10080E001C082E01F91089545 +:200E20000F931F93CF93DF93EC010D96FC0189E0DF011D928A95E9F72A813B8109818C8108 +:200E4000882311F410E001C014E0C90151DB182B1260802F61E8412F59DB882329F12E8182 +:200E60003F810D818885882311F410E001C014E0C9013EDB182B1260802F60E8412F46DBA2 +:200E8000882391F02A853B8509858C85882311F410E001C014E0C9012BDB182B1260802F8F +:200EA00061EC412F33DB01C080E0DF91CF911F910F910895CF93DF93EC018091E80083FF4D +:200EC00060C0888190E020912B0230912C022817390709F056C080912802813261F082322B +:200EE00020F4803209F04DC019C0823269F1833209F047C038C080912702813A09F041C0A3 +:200F00008091E800877F8093E800CE010F9667E070E071DB8091E8008B7713C08091270278 +:200F2000813279F58091E800877F8093E800CE010F9667E070E013DCCE013ED98091E800BD +:200F40008E778093E8001DC0809127028132C9F48091E800877F8093E800809129028D87C0 +:200F6000CE01C8D90DC080912702813251F48091E800877F8093E800CE0160912902C5DE7A +:200F8000ECDADF91CF910895A1E21A2EAA1BBB1BFD010DC0AA1FBB1FEE1FFF1FA217B307AC +:200FA000E407F50720F0A21BB30BE40BF50B661F771F881F991F1A9469F760957095809539 +:200FC00090959B01AC01BD01CF010895F894FFCF000340000004400000020800000000008D +:200FE000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0B +:201000004BC0000064C0000062C0000060C000005EC000005CC000005AC0000058C00000F3 +:2010200056C0000054C0000052C00000CBC400004EC000004CC000004AC0000048C00000B9 +:2010400046C0000044C0000042C0000040C000003EC000003CC000003AC0000038C0000098 +:2010600036C0000034C0000032C0000030C000002EC000002CC000002AC0000028C00000F8 +:2010800026C0000024C0000022C0000020C000001EC000001CC0000011241FBECFEFD2E088 +:2010A000DEBFCDBF11E0A0E0B1E0E4EBFCE102C005900D92A836B107D9F711E0A8E6B1E0ED +:2010C00001C01D92A738B107E1F74FD3F1C598CF982F15C08091F200882371F48091E8004A +:2010E0008B7F8093E80003C08EB3882351F08091E80082FFF9CF02C08091F1009150992358 +:2011000049F708952091760130917501809174019091730180936D0190936E01C901809388 +:201120006F0190937001089580917101843009F45AC0853030F4813059F0833009F0C3C0BE +:201140001FC0853009F4A0C0863009F0BCC0AFC080917201823008F0B6C0D4DF8091720129 +:20116000882361F480916D0190916E0123E0FC0120935700E89507B600FCFDCF85E008C027 +:2011800080917201882311F0823029F4BBDF89E0809301010895813009F095C020E030E08C +:2011A00040E050E0F90184918F3F81F0CA01AA27BB2780936C0130936E0120936D018AE0D6 +:2011C0008093010185E08093690108952F5F3F4F4F4F5F4F2030F0E13F07F0E04F07F0E0B6 +:2011E0005F0701F7089580917201833051F581E0809368018091770190917801892B71F062 +:2012000080917301813009F05EC0809176019091750190936B0180936A0108958091730133 +:20122000882361F42CE088E190E00FB6F894A895809360000FBE20936000089510920001A8 +:201240000895882309F03FC0809173018F3F09F03AC0E0E0F0E093E085E090935700E895A9 +:2012600007B600FCFDCF80935700E89507B600FCFDCFE058FF4F20E1E030F20771F781E123 +:2012800080935700E8950895E091730180917201882321F4F0E0EB5FFE4F05C0813099F437 +:2012A000F0E0EE52FF4F808180937C01089580917201833041F480917301882321F48091E0 +:2012C000740180936C0108952F923F924F925F926F927F929F92AF92BF92CF92DF92EF92F0 +:2012E000FF920F931F93CF93DF938091850190918601909378018093770180917901882399 +:2013000051F08091790181508093790180917901882309F45D9A80917A01882351F08091F0 +:201320007A01815080937A0180917A01882309F45C9A80918001833009F4B2C1843030F41C +:20134000813071F0823009F0E3C111C1853009F4C5C1853008F4BAC1863009F0D9C1CDC11F +:201360005C9883E080937A018091E800877F8093E80080916801882329F0D6DE5D9A5C9AAF +:201380001092680120917701309178012115310529F42AC08EB3882309F4BAC18091E8000F +:2013A00082FFF8CF8091F10080937101215030403093780120937701E2E7F1E00CC080919F +:2013C000F10081932150304081E0E737F80719F43183208308C08091F200882381F7309394 +:2013E000780120937701A0DE80910101853009F0BAC08091770190917801892B21F482E042 +:2014000080930101B0C08AE163DE80916D018F715FDEC0916F01D091700120916D0130916C +:201420006E0121968E01021B130B219780917201882309F093C0180136942794C901A091F0 +:201440006C01B0E09C01AD0162E0E62EF12C012D112DE20EF31E041F151F59016A0190E0D8 +:2014600099249394B5E0A3E048C08091F200882371F48091E8008B7F8093E80004C08EB352 +:20148000882309F445C18091E80082FFF8CF0894210831088091F100682F8091F100782F1D +:2014A000F5010B0190925700E89511249F5F903419F021143104A1F4F901B0935700E89524 +:2014C00007B600FCFDCF2114310451F0F701A0935700E89507B600FCFDCFA801970190E0A7 +:2014E00042E0442E512C612C712CE40CF51C061D171DA40CB51CC61CD71C2114310409F0A0 +:20150000B4CFD0936E01C0936D0181E180935700E89527C08091F200882371F48091E80079 +:201520008B7F8093E80004C08EB3882309F4F0C08091E80082FFF8CF6091F10080916D01A7 +:2015400090916E01A7D380916D0190916E01019690936E0180936D010150104001151105FB +:20156000C9F680E1B5DD8091E8008B7FC3C08091E800877F8093E8005D9883E08093790154 +:2015800004C08EB3882309F4C3C08091E80080FFF8CF80910101893091F08A3069F4809167 +:2015A0007201813049F480916D0190916E018093F1009093F1009BC080917C0196C0609173 +:2015C0006F017091700120916D0130916E016F5F7F4F7B01E21AF30A6150704080917201E4 +:2015E000882389F5870116950795C901A0916C01B0E09C01AD011FC08091F200803271F4B7 +:201600008091E8008E7F8093E80004C08EB3882309F47EC08091E80080FFF8CFF90185918F +:2016200094918093F1009093F100015010402E5F3F4F4F4F5F4F01151105F1F670936E01E0 +:2016400060936D0129C0823039F523C08091F200803271F48091E8008E7F8093E80004C09E +:201660008EB3882309F454C08091E80080FFF8CF00916D0110916E01C80104D38093F1007B +:201680000F5F1F4F10936E0100936D010894E108F108E114F104D1F682E08093010127C0CE +:2016A0008091E800877F8093E800809169018093F1001092F1001092F1001092F1008091E7 +:2016C00001018093F1001092F10011C08091E800877F8093E8001092690119C08091E800C8 +:2016E000877F8093E800809101018093F1008091E8008E7F8093E8000AC08091E800877F08 +:201700008093E8005D9A5C9A82E08093010187D0DF91CF911F910F91FF90EF90DF90CF9017 +:20172000BF90AF909F907F906F905F904F903F902F9008952BD181E085BF15BE089584B799 +:20174000877F84BF88E10FB6F89480936000109260000FBE81E085BF82E085BF8AB18063DB +:201760008AB98BB180638BB90CC1E9DF789401C080D2809100018823D9F78091680188235D +:20178000B9F7D8DFE0916A01F0916B010995FA01923071F0933089F0913029F488E091E06A +:2017A00022E130E019C080E090E020E030E014C08AE191E02BE130E00FC0882339F48091D9 +:2017C0003501282F30E085E391E006C080913901282F30E089E391E091838083C9010895C0 +:2017E0008091EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881FE4 +:2018000008951092F4001092F0001092E8001092ED00EBEEF0E080818E7F80830895809182 +:201820007F0188238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B7F8093E8006D +:2018400008958EB3882349F08091E80080FFF9CF8091E8008E7F8093E80008959C0140917A +:201860008501509186014617570718F4F90120E038C06115710511F0AB01F8CF8091E80068 +:201880008E7F8093E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC091 +:2018A0008EB3882381F18EB3853079F18091E80080FF17C09091F20006C081918093F1002C +:2018C000415050409F5F4115510511F09032A8F320E0903209F421E08091E8008E7F809306 +:2018E000E8004115510591F6222381F606C08EB3882349F08EB3853041F08091E80082FF85 +:20190000F6CF80E0089582E0089583E0089554D056D01EBA10927D0184E089BD89B58260FA +:2019200089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809163008E7FC5 +:20194000809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1008E7F80932E +:20196000E1008091E20081608093E2008091E100877F8093E1008091E20088608093E20001 +:201980000895C5DF81E080937E010895C0DFE0EEF0E0808181608083E8EDF0E080818F77A8 +:2019A00080830AD00CD019BCE3E6F0E080818160808310927E0108951092E200089510929A +:2019C000E10008951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF938A +:2019E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E100F9 +:201A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC7D +:201A20001EBA26D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B451 +:201A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093D6 +:201A6000E2008091E20081608093E20080917D01882311F481E001C084E08EBBF9D08091D3 +:201A8000E10083FF22C08091E20083FF1EC08091E100877F8093E10082E08EBB10927D01F7 +:201AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200A1DEF6 +:201AC00080E060E042E28CDED3D08091E10082FF0AC08091E20082FF06C08091E1008B7FC2 +:201AE0008093E100C5D0FF91EF91BF91AF919F918F917F916F915F914F913F912F910F905E +:201B00000FBE0F901F9018951F93DF93CF9300D0CDB7DEB7EFE7F1E08091F100819381E070 +:201B2000E738F807C9F790917F0180918001853011F1863040F48130B9F0813070F08330D5 +:201B400009F081C011C0883009F453C0893009F462C0863009F077C02DC0903809F474C00E +:201B6000923809F070C070C0992309F46DC0923009F069C069C0992309F065C01091810152 +:201B80008091E800877F8093E80049DE04C08EB3882309F459C08091E80080FFF8CF812F6F +:201BA0008F7711F492E001C093E09EBB80688093E3004AC09058923008F045C080918101F9 +:201BC0009091820160918301AE014F5F5F4FDFDDBC010097C9F18091E800877F8093E8001D +:201BE00089819A813BDE8091E8008B7F8093E8002BC0903841F58091E800877F8093E800C6 +:201C000080917D018093F1008091E8008E7F8093E80005DE19C09923B1F4909181019230AE +:201C200098F48091E800877F8093E80090937D01F6DD80917D01882311F483E001C084E0E3 +:201C40008EBB16D001C040DB8091E80083FF0AC08091EB0080628093EB008091E800877F59 +:201C60008093E8000F900F90CF91DF911F91089508958EB3882329F08091E80083FF01C030 +:201C800043CF0895F999FECF92BD81BDF89A992780B50895262FF999FECF1FBA92BD81BD6B +:201CA00020BD0FB6F894FA9AF99A0FBE01960895F894FFCF01021E938220DCFB1201100123 +:201CC00000000020EB03F72F00000001000109021B0001010080320904000000FE010200E6 +:201CE0000921030000000C0001040309042C03410072006400750069006E006F0020004D28 +:1C1D000000650067006100200032003500360030002000440046005500000000AE +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/README.txt Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,33 @@ +Arduino Uno and Mega 2560 Firmwares for the ATmega8U2 + +This directory contains the firmwares used on the ATmega8U2 on the Arduino +Uno and Arduino Mega 2560. The arduino-usbdfu directory contains the DFU +bootloader on the 8U2; the arduino-usbserial directory contains the actual +usb to serial firmware. Both should be compiled against LUFA 100807. The +two .hex files in this directory combine the dfu and serial firmwares into +a single file to burn onto the 8U2. + +To burn (Uno): +avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:UNO-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m + +To burn (Mega 2560): +avrdude -p at90usb82 -F -P usb -c avrispmkii -U flash:w:MEGA-dfu_and_usbserial_combined.hex -U lfuse:w:0xFF:m -U hfuse:w:0xD9:m -U efuse:w:0xF4:m -U lock:w:0x0F:m + + +Note on USB Vendor IDs (VID) and Product IDs (PID): The arduino-usbdfu +project uses Atmel's VID and MCU-specific PIDs to maintain compatibility +with their FLIP software. The source code to the arduino-usbserial +project includes Atmel's VID and a PID donated by them to LUFA. This +PID is used in LUFA's USBtoSerial project, which forms the basis for +arduino-usbserial. According to the LUFA documentation, this VID/PID +combination is: + + "For use in testing of LUFA powered devices during development only, + by non-commercial entities. All devices must accept collisions on this + VID/PID range (from other in-development LUFA devices) to be resolved + by using a unique release number in the Device Descriptor. No devices + using this VID/PID combination may be released to the general public." + +The production version of the arduino-usbserial firmware uses the +Arduino VID. This is only for use with official Arduino hardware and +should not be used on other products. \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/UNO-dfu_and_usbserial_combined.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,234 @@ +:200000009CC00000B5C00000B3C00000B1C00000AFC00000ADC00000ABC00000A9C000007B +:20002000A7C00000A5C00000A3C0000054C4000018C400009DC000009BC0000099C000008C +:2000400097C0000095C0000093C0000091C000008FC000008DC000008BC000000EC100009A +:2000600087C0000085C0000083C0000081C000007FC000007DC000007BC0000079C0000080 +:2000800077C0000075C0000073C0000071C000006FC000006DC00000120110010200000806 +:2000A0004123010001000102DC0109023E00020100C032090400000102020100052400017F +:2000C00010042402060524060001070582030800FF09040100020A000000070504024000AC +:2000E0000107058302400001040309043203410072006400750069006E006F0020002800CA +:200100007700770077002E00610072006400750069006E006F002E0063006300290000003D +:200120001803410072006400750069006E006F00200055006E006F00000011241FBECFEFB0 +:20014000D2E0DEBFCDBF11E0A0E0B1E0E4ECFFE002C005900D92A631B107D9F712E0A6E145 +:20016000B1E001C01D92AF32B107E1F7F1D028C747CF9C01DC01AE57BF4FED91FC91119707 +:2001800041911196FC93EE9380589F4FE817F90711F42D933C939FB7F894F901EC57FF4F10 +:2001A0008081815080839FBF842F0895DF92EF92FF920F931F93FC018489813019F082306F +:2001C00021F405C040E3D42E04C0DD2402C030E2D32E8389823011F488E0D82A8589873094 +:2001E00031F0883031F0863031F482E003C084E001C086E0D82A1092C9001092C800109201 +:20020000CA00E784F0880189128980E0E81681EEF80680E0080780E0180719F420E130E035 +:200220000FC0C801B701969587957795679560587B47814E9F4FA8019701A0D62150304050 +:200240003093CD002093CC00D092CA0080E0E81681EEF80680E0080780E0180711F082E047 +:2002600001C080E08093C80088E98093C9001F910F91FF90EF90DF9008951F920F920FB6B4 +:200280000F9211242F938F939F93EF93FF939091CE008EB38430F1F4E0919901F0919A016E +:2002A0009083E0919901F0919A01CF01019690939A01809399018959914021F489E191E08F +:2002C000928381839FB7F89480919D018F5F80939D019FBFFF91EF919F918F912F910F90B8 +:2002E0000FBE0F901F901895FC01858580FF02C05F9808955F9A089580E091E0D5C580E0F9 +:2003000091E088C584B7877F84BF28E10FB6F89420936000109260000FBE87E690E090935F +:20032000CD008093CC0086E08093CA001092C8002093C900539A5A9A8AB180638AB98BB16A +:2003400080638BB983D284E085BD5F9A579A08950F931F93CF93DF93D5DF2FB7F8948EE92F +:2003600091E090931F0280931E0290932102809320022FBF2FB7F89489E191E090939A0121 +:200380008093990190939C0180939B012FBF7894CEE9D1E003E08FB7F894909122028FBF97 +:2003A000903809F180E091E0ABD497FD1CC0E0911E02F0911F028083E0911E02F0911F0252 +:2003C000CF01019690931F0280931E028E51924011F4D283C1839FB7F894809122028F5FEB +:2003E000809322029FBF8FB7F89410919D018FBFA89902C0113678F1A89A80919D018823BA +:2004000061F05D980093160108C089E191E0B1DE682F80E091E0DAD411501123B1F7809156 +:200420001601882351F08091160181508093160180911601882309F45D9A809117018823FB +:2004400051F08091170181508093170180911701882309F45C9A8FB7F894909122028FBF0A +:20046000992369F08EE991E084DE982F8091C80085FFFCCF9093CE005C980093170180E03E +:2004800091E095D42AD487CFDA01923049F0933061F09130F9F4E8E9F0E022E130E01EC004 +:2004A000EAEAF0E02EE330E019C0813049F0813018F0823079F408C0E8EEF0E0849107C092 +:2004C000ECEEF0E0849103C0E0E2F1E08491282F30E004C0E0E0F0E020E030E0ED93FC9318 +:2004E000C901089528E030E040E003C04F5F220F331F28173907D0F3842F8295807F0895C1 +:200500008093E9008091EB0081608093EB001092ED006093EC004093ED008091EE00881F30 +:200520008827881F08951092F40090E09093E9001092F0001092E8001092ED008091EB000F +:200540008E7F8093EB009F5F953081F708958091270288238CF403C08EB38823B1F08091F2 +:20056000E80082FFF9CF8091E8008B778093E80008958EB3882349F08091E80080FFF9CF52 +:200580008091E8008E778093E800089594E68091EC0080FF05C08091E80080FF05C023C0EA +:2005A0008091E80082FD1FC08EB3882311F482E008958EB3853011F483E008958091EB00FD +:2005C00085FF02C081E008958091E10082FFDFCF8091E1008B7F8093E100992311F484E0A1 +:2005E00008959150D4CF80E008959C0140912D0250912E024617570718F4F90120E038C076 +:200600006115710511F0AB01F8CF8091E8008E778093E80040E050E0F0CF8091E80083FFF7 +:2006200002C081E008958091E80082FD2DC08EB3882381F18EB3853079F18091E80080FF5F +:2006400017C09091F20006C081918093F100415050409F5F4115510511F09830A8F320E0A5 +:20066000983009F421E08091E8008E778093E8004115510591F6222381F606C08EB388231A +:2006800049F08EB3853041F08091E80082FFF6CF80E0089582E0089583E008959C01409151 +:2006A0002D0250912E024617570710F490E03BC06115710511F0AB01F9CF8091E8008E7771 +:2006C0008093E80040E050E0F1CF8091E80083FF02C081E008958091E80082FD30C08EB32B +:2006E000882399F18EB3853091F18091E80080FF1AC08091F20009C0F9012F5F3F4FE491A4 +:20070000E093F100415050408F5F4115510511F0883090F390E0883009F491E08091E800EF +:200720008E778093E8004115510579F6992369F606C08EB3882349F08EB3853041F0809160 +:20074000E80082FFF6CF80E0089582E0089583E008959C016115710529F48091E8008B77CE +:200760008093E800F90120C08091E80083FF02C081E008958EB3882339F18EB3853031F13B +:200780008091E80082FFF0CF06C08091F10081936150704021F08091F2008823B1F780916B +:2007A000E8008B778093E80061157105E9F606C08EB3882349F08EB3853041F08091E8007E +:2007C00080FFF6CF80E0089582E0089583E0089542D044D01EBA10922502109224021092A8 +:2007E000230284E089BD89B5826089BD09B400FEFDCF8091D800982F9F779093D800806894 +:200800008093D800809163008E7F809363008091D8008F7D8093D8008091E0008E7F809305 +:20082000E0008091E1008E7F8093E1008091E20081608093E2008091E100877F8093E10030 +:200840008091E20088608093E2000895C1DF81E08093260208951092E20008951092E100AE +:2008600008951F920F920FB60F9211241F932F933F934F935F936F937F938F939F93AF932A +:20088000BF93EF93FF93E9EEF0E0108117701082E0EFF0E08081877F80837894C3D0F894CD +:2008A000A9EEB0E01C92E0EFF0E08081886080831C93FF91EF91BF91AF919F918F917F9129 +:2008C0006F915F914F913F912F911F910F900FBE0F901F9018951F920F920FB60F921124B4 +:2008E0002F933F934F935F936F937F938F939F93AF93BF93EF93FF938091E10080FF1BC034 +:200900008091E20080FF17C08091E1008E7F8093E1008091E2008E7F8093E2008091E200B3 +:2009200080618093E2008091D80080628093D80019BC1EBAD1D18091E10084FF29C080916D +:20094000E20084FF25C084E089BD89B5826089BD09B400FEFDCF8091D8008F7D8093D800D6 +:200960008091E1008F7E8093E1008091E2008F7E8093E2008091E20081608093E2008091B5 +:200980002502882311F481E001C084E08EBBA4D18091E10083FF27C08091E20083FF23C089 +:2009A0008091E100877F8093E10082E08EBB109225028091E1008E7F8093E1008091E200F1 +:2009C0008E7F8093E2008091E20080618093E200AADD80E060E042E093DD8091F0008860AA +:2009E0008093F00079D18091E10082FF0AC08091E20082FF06C08091E1008B7F8093E10043 +:200A00006BD1FF91EF91BF91AF919F918F917F916F915F914F913F912F910F900FBE0F902F +:200A20001F9018951F93DF93CF93CDB7DEB7AC970FB6F894DEBF0FBECDBFE7E2F2E0809185 +:200A4000F100819322E0EF32F207C9F78091270230912802353009F487C0363040F43130EC +:200A6000C9F1313070F0333009F01DC133C0383009F4EFC0393009F4FEC0363009F013C163 +:200A800092C0803821F0823809F00DC108C09091230280912402882399F0926011C080916D +:200AA0002B0287708093E9008091EB0090E025E0969587952A95E1F7982F91701092E90074 +:200AC0008091E800877F8093E8009093F1001092F100CAC0882319F0823009F0E4C090E078 +:200AE0008F719070009721F0029709F0DDC00CC080912902813009F0D7C0109224023330AB +:200B000069F5809324022AC080912902882331F520912B02277009F4C7C02093E9008091A1 +:200B2000EB0080FFC1C0333021F48091EB00806213C08091EB0080618093EB0081E090E0F5 +:200B400002C0880F991F2A95E2F78093EA001092EA008091EB0088608093EB001092E900F6 +:200B60008091E800877F83C0882309F09CC0109129028091E800877F8093E800E8DC04C0E5 +:200B80008EB3882309F490C08091E80080FFF8CF812F8F7711F492E001C093E09EBB80683B +:200BA0008093E30081C08058823008F07CC08091290290912A0223E08C3D920799F55FB7AE +:200BC000F894DE0115964EE020E030E061E2E42FF0E060935700849120FF03C082958F7044 +:200BE0004F5F982F9F70892F805D8A3308F0895F8C9311961C9211972F5F3F4F129624310A +:200C0000310529F75FBF8AE28B8383E08C838091E800877F8093E800CE0103966AE270E076 +:200C2000E4DC11C060912B02AE014F5F5F4F2CDCBC010097C9F18091E800877F8093E800EA +:200C400089819A812BDD8091E8008B778093E8002BC0803841F58091E800877F8093E8009E +:200C6000809125028093F1008091E8008E778093E8006DDC19C08823B1F4909129029230BF +:200C800098F48091E800877F8093E800909325025EDC80912502882311F483E001C084E0DA +:200CA0008EBB2DDB01C028DB8091E80083FF0AC08091EB0080628093EB008091E800877FFF +:200CC0008093E800AC960FB6F894DEBF0FBECDBFCF91DF911F91089508951F938EB3882338 +:200CE00061F01091E9001092E9008091E80083FF01C098DE17701093E9001F9108950895DF +:200D0000FC018EB3843021F587859089A189B2890097A105B105E1F085818093E90080916A +:200D2000E80082FF15C08091F200882319F42FEF3FEF04C08091F100282F30E08091F2003E +:200D4000882341F48091E8008B778093E80002C02FEF3FEFC9010895FC018EB3843011F550 +:200D600087859089A189B2890097A105B105D1F081818093E9008091F2008823A9F09091CF +:200D8000E8008091E8008E778093E80095FD0CC0FDDB982F882349F48091E8008E7780937C +:200DA000E80003C092E001C090E0892F0895FC018EB3843051F487859089A189B289009738 +:200DC000A105B10511F0CF01C7CF08951F93FC01162F8EB38430D9F487859089A189B28973 +:200DE0000097A105B10599F081818093E9008091E80085FD08C08091E8008E778093E8003D +:200E0000C5DB882329F41093F10080E001C082E01F9108950F931F93CF93DF93EC010D964E +:200E2000FC0189E0DF011D928A95E9F72A813B8109818C81882311F410E001C014E0C901A1 +:200E400051DB182B1260802F61E8412F59DB882329F12E813F810D818885882311F410E0A6 +:200E600001C014E0C9013EDB182B1260802F60E8412F46DB882391F02A853B8509858C8563 +:200E8000882311F410E001C014E0C9012BDB182B1260802F61EC412F33DB01C080E0DF916D +:200EA000CF911F910F910895CF93DF93EC018091E80083FF60C0888190E020912B02309171 +:200EC0002C022817390709F056C080912802813261F0823220F4803209F04DC019C082320A +:200EE00069F1833209F047C038C080912702813A09F041C08091E800877F8093E800CE0133 +:200F00000F9667E070E071DB8091E8008B7713C080912702813279F58091E800877F80930E +:200F2000E800CE010F9667E070E013DCCE013ED98091E8008E778093E8001DC080912702D9 +:200F40008132C9F48091E800877F8093E800809129028D87CE01C8D90DC0809127028132AD +:200F600051F48091E800877F8093E800CE0160912902C5DEECDADF91CF910895A1E21A2EA6 +:200F8000AA1BBB1BFD010DC0AA1FBB1FEE1FFF1FA217B307E407F50720F0A21BB30BE40B49 +:200FA000F50B661F771F881F991F1A9469F760957095809590959B01AC01BD01CF01089501 +:200FC000F894FFCF00034000000440000002080000000000000000000000FFFFFFFFFFFF2C +:200FE000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF11 +:201000004BC0000064C0000062C0000060C000005EC000005CC000005AC0000058C00000F3 +:2010200056C0000054C0000052C00000CBC400004EC000004CC000004AC0000048C00000B9 +:2010400046C0000044C0000042C0000040C000003EC000003CC000003AC0000038C0000098 +:2010600036C0000034C0000032C0000030C000002EC000002CC000002AC0000028C00000F8 +:2010800026C0000024C0000022C0000020C000001EC000001CC0000011241FBECFEFD2E088 +:2010A000DEBFCDBF11E0A0E0B1E0E4EBFCE102C005900D92AC35B107D9F711E0ACE5B1E0E7 +:2010C00001C01D92AB37B107E1F74FD3F1C598CF982F15C08091F200882371F48091E80047 +:2010E0008B7F8093E80003C08EB3882351F08091E80082FFF9CF02C08091F1009150992358 +:2011000049F7089520916A013091690180916801909167018093610190936201C9018093D0 +:20112000630190936401089580916501843009F45AC0853030F4813059F0833009F0C3C0E2 +:201140001FC0853009F4A0C0863009F0BCC0AFC080916601823008F0B6C0D4DF8091660141 +:20116000882361F4809161019091620123E0FC0120935700E89507B600FCFDCF85E008C03F +:2011800080916601882311F0823029F4BBDF89E0809301010895813009F095C020E030E098 +:2011A00040E050E0F90184918F3F81F0CA01AA27BB278093600130936201209361018AE0FA +:2011C0008093010185E080935D0108952F5F3F4F4F4F5F4F2030F0E13F07F0E04F07F0E0C2 +:2011E0005F0701F7089580916601833051F581E080935C0180916B0190916C01892B71F092 +:2012000080916701813009F05EC080916A019091690190935F0180935E010895809167017B +:20122000882361F42CE088E190E00FB6F894A895809360000FBE20936000089510920001A8 +:201240000895882309F03FC0809167018F3F09F03AC0E0E0F0E093E085E090935700E895B5 +:2012600007B600FCFDCF80935700E89507B600FCFDCFE058FF4F20E1E030F20771F781E123 +:2012800080935700E8950895E091670180916601882321F4F0E0EB5FFE4F05C0813099F44F +:2012A000F0E0EE52FF4F808180937001089580916601833041F480916701882321F4809104 +:2012C00068018093600108952F923F924F925F926F927F929F92AF92BF92CF92DF92EF9208 +:2012E000FF920F931F93CF93DF938091790190917A0190936C0180936B0180916D018823D5 +:2013000051F080916D01815080936D0180916D01882309F45D9A80916E01882351F0809120 +:201320006E01815080936E0180916E01882309F45C9A80917401833009F4B2C1843030F44C +:20134000813071F0823009F0E3C111C1853009F4C5C1853008F4BAC1863009F0D9C1CDC11F +:201360005C9883E080936E018091E800877F8093E80080915C01882329F0D6DE5D9A5C9AC7 +:2013800010925C0120916B0130916C012115310529F42AC08EB3882309F4BAC18091E80033 +:2013A00082FFF8CF8091F100809365012150304030936C0120936B01E6E6F1E00CC08091C0 +:2013C000F10081932150304081E0EB36F80719F43183208308C08091F200882381F7309391 +:2013E0006C0120936B01A0DE80910101853009F0BAC080916B0190916C01892B21F482E072 +:2014000080930101B0C08AE163DE809161018F715FDEC0916301D09164012091610130919C +:20142000620121968E01021B130B219780916601882309F093C0180136942794C901A09108 +:201440006001B0E09C01AD0162E0E62EF12C012D112DE20EF31E041F151F59016A0190E0E4 +:2014600099249394B5E0A3E048C08091F200882371F48091E8008B7F8093E80004C08EB352 +:20148000882309F445C18091E80082FFF8CF0894210831088091F100682F8091F100782F1D +:2014A000F5010B0190925700E89511249F5F903419F021143104A1F4F901B0935700E89524 +:2014C00007B600FCFDCF2114310451F0F701A0935700E89507B600FCFDCFA801970190E0A7 +:2014E00042E0442E512C612C712CE40CF51C061D171DA40CB51CC61CD71C2114310409F0A0 +:20150000B4CFD0936201C093610181E180935700E89527C08091F200882371F48091E80091 +:201520008B7F8093E80004C08EB3882309F4F0C08091E80082FFF8CF6091F10080916101B3 +:2015400090916201A7D3809161019091620101969093620180936101015010400115110537 +:20156000C9F680E1B5DD8091E8008B7FC3C08091E800877F8093E8005D9883E080936D0160 +:2015800004C08EB3882309F4C3C08091E80080FFF8CF80910101893091F08A3069F4809167 +:2015A0006601813049F480916101909162018093F1009093F1009BC08091700196C06091A3 +:2015C00063017091640120916101309162016F5F7F4F7B01E21AF30A615070408091660120 +:2015E000882389F5870116950795C901A0916001B0E09C01AD011FC08091F200803271F4C3 +:201600008091E8008E7F8093E80004C08EB3882309F47EC08091E80080FFF8CFF90185918F +:2016200094918093F1009093F100015010402E5F3F4F4F4F5F4F01151105F1F670936201EC +:201640006093610129C0823039F523C08091F200803271F48091E8008E7F8093E80004C0AA +:201660008EB3882309F454C08091E80080FFF8CF0091610110916201C80104D38093F10093 +:201680000F5F1F4F10936201009361010894E108F108E114F104D1F682E08093010127C0E6 +:2016A0008091E800877F8093E80080915D018093F1001092F1001092F1001092F1008091F3 +:2016C00001018093F1001092F10011C08091E800877F8093E80010925D0119C08091E800D4 +:2016E000877F8093E800809101018093F1008091E8008E7F8093E8000AC08091E800877F08 +:201700008093E8005D9A5C9A82E08093010187D0DF91CF911F910F91FF90EF90DF90CF9017 +:20172000BF90AF909F907F906F905F904F903F902F9008952BD181E085BF15BE089584B799 +:20174000877F84BF88E10FB6F89480936000109260000FBE81E085BF82E085BF8AB18063DB +:201760008AB98BB180638BB90CC1E9DF789401C080D2809100018823D9F780915C01882369 +:20178000B9F7D8DFE0915E01F0915F010995FA01923071F0933089F0913029F488E091E082 +:2017A00022E130E019C080E090E020E030E014C08AE191E02BE130E00FC0882339F48091D9 +:2017C0003501282F30E085E391E006C080913901282F30E089E391E091838083C9010895C0 +:2017E0008091EB0081608093EB001092ED006093EC004093ED008091EE00881F8827881FE4 +:2018000008951092F4001092F0001092E8001092ED00EBEEF0E080818E7F80830895809182 +:20182000730188238CF403C08EB38823B1F08091E80082FFF9CF8091E8008B7F8093E80079 +:2018400008958EB3882349F08091E80080FFF9CF8091E8008E7F8093E80008959C0140917A +:20186000790150917A014617570718F4F90120E038C06115710511F0AB01F8CF8091E80080 +:201880008E7F8093E80040E050E0F0CF8091E80083FF02C081E008958091E80082FD2DC091 +:2018A0008EB3882381F18EB3853079F18091E80080FF17C09091F20006C081918093F1002C +:2018C000415050409F5F4115510511F09032A8F320E0903209F421E08091E8008E7F809306 +:2018E000E8004115510591F6222381F606C08EB3882349F08EB3853041F08091E80082FF85 +:20190000F6CF80E0089582E0089583E0089554D056D01EBA1092710184E089BD89B5826006 +:2019200089BD09B400FEFDCF8091D800982F9F779093D80080688093D800809163008E7FC5 +:20194000809363008091D8008F7D8093D8008091E0008E7F8093E0008091E1008E7F80932E +:20196000E1008091E20081608093E2008091E100877F8093E1008091E20088608093E20001 +:201980000895C5DF81E0809372010895C0DFE0EEF0E0808181608083E8EDF0E080818F77B4 +:2019A00080830AD00CD019BCE3E6F0E08081816080831092720108951092E20008951092A6 +:2019C000E10008951F920F920FB60F9211242F933F934F935F936F937F938F939F93AF938A +:2019E000BF93EF93FF938091E10080FF1BC08091E20080FF17C08091E1008E7F8093E100F9 +:201A00008091E2008E7F8093E2008091E20080618093E2008091D80080628093D80019BC7D +:201A20001EBA26D18091E10084FF29C08091E20084FF25C084E089BD89B5826089BD09B451 +:201A400000FEFDCF8091D8008F7D8093D8008091E1008F7E8093E1008091E2008F7E8093D6 +:201A6000E2008091E20081608093E20080917101882311F481E001C084E08EBBF9D08091DF +:201A8000E10083FF22C08091E20083FF1EC08091E100877F8093E10082E08EBB1092710103 +:201AA0008091E1008E7F8093E1008091E2008E7F8093E2008091E20080618093E200A1DEF6 +:201AC00080E060E042E28CDED3D08091E10082FF0AC08091E20082FF06C08091E1008B7FC2 +:201AE0008093E100C5D0FF91EF91BF91AF919F918F917F916F915F914F913F912F910F905E +:201B00000FBE0F901F9018951F93DF93CF9300D0CDB7DEB7E3E7F1E08091F100819381E07C +:201B2000EB37F807C9F79091730180917401853011F1863040F48130B9F0813070F08330EA +:201B400009F081C011C0883009F453C0893009F462C0863009F077C02DC0903809F474C00E +:201B6000923809F070C070C0992309F46DC0923009F069C069C0992309F065C0109175015E +:201B80008091E800877F8093E80049DE04C08EB3882309F459C08091E80080FFF8CF812F6F +:201BA0008F7711F492E001C093E09EBB80688093E3004AC09058923008F045C08091750105 +:201BC0009091760160917701AE014F5F5F4FDFDDBC010097C9F18091E800877F8093E80035 +:201BE00089819A813BDE8091E8008B7F8093E8002BC0903841F58091E800877F8093E800C6 +:201C0000809171018093F1008091E8008E7F8093E80005DE19C09923B1F4909175019230C6 +:201C200098F48091E800877F8093E80090937101F6DD80917101882311F483E001C084E0FB +:201C40008EBB16D001C040DB8091E80083FF0AC08091EB0080628093EB008091E800877F59 +:201C60008093E8000F900F90CF91DF911F91089508958EB3882329F08091E80083FF01C030 +:201C800043CF0895F999FECF92BD81BDF89A992780B50895262FF999FECF1FBA92BD81BD6B +:201CA00020BD0FB6F894FA9AF99A0FBE01960895F894FFCF01021E938220DCFB1201100123 +:201CC00000000020EB03F72F00000001000109021B0001010080320904000000FE010200E6 +:201CE0000921030000000C0001040309042003410072006400750069006E006F002000552C +:101D0000006E006F002000440046005500000000F7 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/Arduino-usbdfu.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,728 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Main source file for the DFU class bootloader. This file contains the complete bootloader logic. + */ + +#define INCLUDE_FROM_BOOTLOADER_C +#include "Arduino-usbdfu.h" + +/** Flag to indicate if the bootloader should be running, or should exit and allow the application code to run + * via a soft reset. When cleared, the bootloader will abort, the USB interface will shut down and the application + * jumped to via an indirect jump to location 0x0000 (or other location specified by the host). + */ +bool RunBootloader = true; + +/** Flag to indicate if the bootloader is waiting to exit. When the host requests the bootloader to exit and + * jump to the application address it specifies, it sends two sequential commands which must be properly + * acknowledged. Upon reception of the first the RunBootloader flag is cleared and the WaitForExit flag is set, + * causing the bootloader to wait for the final exit command before shutting down. + */ +bool WaitForExit = false; + +/** Current DFU state machine state, one of the values in the DFU_State_t enum. */ +uint8_t DFU_State = dfuIDLE; + +/** Status code of the last executed DFU command. This is set to one of the values in the DFU_Status_t enum after + * each operation, and returned to the host when a Get Status DFU request is issued. + */ +uint8_t DFU_Status = OK; + +/** Data containing the DFU command sent from the host. */ +DFU_Command_t SentCommand; + +/** Response to the last issued Read Data DFU command. Unlike other DFU commands, the read command + * requires a single byte response from the bootloader containing the read data when the next DFU_UPLOAD command + * is issued by the host. + */ +uint8_t ResponseByte; + +/** Pointer to the start of the user application. By default this is 0x0000 (the reset vector), however the host + * may specify an alternate address when issuing the application soft-start command. + */ +AppPtr_t AppStartPtr = (AppPtr_t)0x0000; + +/** 64-bit flash page number. This is concatenated with the current 16-bit address on USB AVRs containing more than + * 64KB of flash memory. + */ +uint8_t Flash64KBPage = 0; + +/** Memory start address, indicating the current address in the memory being addressed (either FLASH or EEPROM + * depending on the issued command from the host). + */ +uint16_t StartAddr = 0x0000; + +/** Memory end address, indicating the end address to read to/write from in the memory being addressed (either FLASH + * of EEPROM depending on the issued command from the host). + */ +uint16_t EndAddr = 0x0000; + + +/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ +volatile struct +{ + uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ + uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ + uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */ +} PulseMSRemaining; + +/** Main program entry point. This routine configures the hardware required by the bootloader, then continuously + * runs the bootloader processing routine until instructed to soft-exit, or hard-reset via the watchdog to start + * the loaded application code. + */ +int main(void) +{ + /* Configure hardware required by the bootloader */ + SetupHardware(); + + /* Enable global interrupts so that the USB stack can function */ + sei(); + + /* Run the USB management task while the bootloader is supposed to be running */ + while (RunBootloader || WaitForExit) + USB_USBTask(); + + /* Reset configured hardware back to their original states for the user application */ + ResetHardware(); + + /* Start the user application */ + AppStartPtr(); +} + +/** Configures all hardware required for the bootloader. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Disable clock division */ +// clock_prescale_set(clock_div_1); + + /* Relocate the interrupt vector table to the bootloader section */ + MCUCR = (1 << IVCE); + MCUCR = (1 << IVSEL); + + LEDs_Init(); + + /* Initialize the USB subsystem */ + USB_Init(); +} + +/** Resets all configured hardware required for the bootloader back to their original states. */ +void ResetHardware(void) +{ + /* Shut down the USB subsystem */ + USB_ShutDown(); + + /* Relocate the interrupt vector table back to the application section */ + MCUCR = (1 << IVCE); + MCUCR = 0; +} + +/** Event handler for the USB_UnhandledControlRequest event. This is used to catch standard and class specific + * control requests that are not handled internally by the USB library (including the DFU commands, which are + * all issued via the control endpoint), so that they can be handled appropriately for the application. + */ +void EVENT_USB_Device_UnhandledControlRequest(void) +{ + /* Get the size of the command and data from the wLength value */ + SentCommand.DataSize = USB_ControlRequest.wLength; + + /* Turn off TX LED(s) once the TX pulse period has elapsed */ + if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse)) + LEDs_TurnOffLEDs(LEDMASK_TX); + + /* Turn off RX LED(s) once the RX pulse period has elapsed */ + if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse)) + LEDs_TurnOffLEDs(LEDMASK_RX); + + switch (USB_ControlRequest.bRequest) + { + case DFU_DNLOAD: + LEDs_TurnOnLEDs(LEDMASK_RX); + PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS; + + Endpoint_ClearSETUP(); + + /* Check if bootloader is waiting to terminate */ + if (WaitForExit) + { + /* Bootloader is terminating - process last received command */ + ProcessBootloaderCommand(); + + /* Turn off TX/RX status LEDs so that they're not left on when application starts */ + LEDs_TurnOffLEDs(LEDMASK_TX); + LEDs_TurnOffLEDs(LEDMASK_RX); + + /* Indicate that the last command has now been processed - free to exit bootloader */ + WaitForExit = false; + } + + /* If the request has a data stage, load it into the command struct */ + if (SentCommand.DataSize) + { + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + /* First byte of the data stage is the DNLOAD request's command */ + SentCommand.Command = Endpoint_Read_Byte(); + + /* One byte of the data stage is the command, so subtract it from the total data bytes */ + SentCommand.DataSize--; + + /* Load in the rest of the data stage as command parameters */ + for (uint8_t DataByte = 0; (DataByte < sizeof(SentCommand.Data)) && + Endpoint_BytesInEndpoint(); DataByte++) + { + SentCommand.Data[DataByte] = Endpoint_Read_Byte(); + SentCommand.DataSize--; + } + + /* Process the command */ + ProcessBootloaderCommand(); + } + + /* Check if currently downloading firmware */ + if (DFU_State == dfuDNLOAD_IDLE) + { + if (!(SentCommand.DataSize)) + { + DFU_State = dfuIDLE; + } + else + { + /* Throw away the filler bytes before the start of the firmware */ + DiscardFillerBytes(DFU_FILLER_BYTES_SIZE); + + /* Throw away the packet alignment filler bytes before the start of the firmware */ + DiscardFillerBytes(StartAddr % FIXED_CONTROL_ENDPOINT_SIZE); + + /* Calculate the number of bytes remaining to be written */ + uint16_t BytesRemaining = ((EndAddr - StartAddr) + 1); + + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Write flash + { + /* Calculate the number of words to be written from the number of bytes to be written */ + uint16_t WordsRemaining = (BytesRemaining >> 1); + + union + { + uint16_t Words[2]; + uint32_t Long; + } CurrFlashAddress = {.Words = {StartAddr, Flash64KBPage}}; + + uint32_t CurrFlashPageStartAddress = CurrFlashAddress.Long; + uint8_t WordsInFlashPage = 0; + + while (WordsRemaining--) + { + /* Check if endpoint is empty - if so clear it and wait until ready for next packet */ + if (!(Endpoint_BytesInEndpoint())) + { + Endpoint_ClearOUT(); + + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + } + + /* Write the next word into the current flash page */ + boot_page_fill(CurrFlashAddress.Long, Endpoint_Read_Word_LE()); + + /* Adjust counters */ + WordsInFlashPage += 1; + CurrFlashAddress.Long += 2; + + /* See if an entire page has been written to the flash page buffer */ + if ((WordsInFlashPage == (SPM_PAGESIZE >> 1)) || !(WordsRemaining)) + { + /* Commit the flash page to memory */ + boot_page_write(CurrFlashPageStartAddress); + boot_spm_busy_wait(); + + /* Check if programming incomplete */ + if (WordsRemaining) + { + CurrFlashPageStartAddress = CurrFlashAddress.Long; + WordsInFlashPage = 0; + + /* Erase next page's temp buffer */ + boot_page_erase(CurrFlashAddress.Long); + boot_spm_busy_wait(); + } + } + } + + /* Once programming complete, start address equals the end address */ + StartAddr = EndAddr; + + /* Re-enable the RWW section of flash */ + boot_rww_enable(); + } + else // Write EEPROM + { + while (BytesRemaining--) + { + /* Check if endpoint is empty - if so clear it and wait until ready for next packet */ + if (!(Endpoint_BytesInEndpoint())) + { + Endpoint_ClearOUT(); + + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + } + + /* Read the byte from the USB interface and write to to the EEPROM */ + eeprom_write_byte((uint8_t*)StartAddr, Endpoint_Read_Byte()); + + /* Adjust counters */ + StartAddr++; + } + } + + /* Throw away the currently unused DFU file suffix */ + DiscardFillerBytes(DFU_FILE_SUFFIX_SIZE); + } + } + + Endpoint_ClearOUT(); + + Endpoint_ClearStatusStage(); + + break; + case DFU_UPLOAD: + Endpoint_ClearSETUP(); + + LEDs_TurnOnLEDs(LEDMASK_TX); + PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS; + + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + + if (DFU_State != dfuUPLOAD_IDLE) + { + if ((DFU_State == dfuERROR) && IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Blank Check + { + /* Blank checking is performed in the DFU_DNLOAD request - if we get here we've told the host + that the memory isn't blank, and the host is requesting the first non-blank address */ + Endpoint_Write_Word_LE(StartAddr); + } + else + { + /* Idle state upload - send response to last issued command */ + Endpoint_Write_Byte(ResponseByte); + } + } + else + { + /* Determine the number of bytes remaining in the current block */ + uint16_t BytesRemaining = ((EndAddr - StartAddr) + 1); + + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Read FLASH + { + /* Calculate the number of words to be written from the number of bytes to be written */ + uint16_t WordsRemaining = (BytesRemaining >> 1); + + union + { + uint16_t Words[2]; + uint32_t Long; + } CurrFlashAddress = {.Words = {StartAddr, Flash64KBPage}}; + + while (WordsRemaining--) + { + /* Check if endpoint is full - if so clear it and wait until ready for next packet */ + if (Endpoint_BytesInEndpoint() == FIXED_CONTROL_ENDPOINT_SIZE) + { + Endpoint_ClearIN(); + + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + } + + /* Read the flash word and send it via USB to the host */ + #if (FLASHEND > 0xFFFF) + Endpoint_Write_Word_LE(pgm_read_word_far(CurrFlashAddress.Long)); + #else + Endpoint_Write_Word_LE(pgm_read_word(CurrFlashAddress.Long)); + #endif + + /* Adjust counters */ + CurrFlashAddress.Long += 2; + } + + /* Once reading is complete, start address equals the end address */ + StartAddr = EndAddr; + } + else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x02)) // Read EEPROM + { + while (BytesRemaining--) + { + /* Check if endpoint is full - if so clear it and wait until ready for next packet */ + if (Endpoint_BytesInEndpoint() == FIXED_CONTROL_ENDPOINT_SIZE) + { + Endpoint_ClearIN(); + + while (!(Endpoint_IsINReady())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + } + + /* Read the EEPROM byte and send it via USB to the host */ + Endpoint_Write_Byte(eeprom_read_byte((uint8_t*)StartAddr)); + + /* Adjust counters */ + StartAddr++; + } + } + + /* Return to idle state */ + DFU_State = dfuIDLE; + } + + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); + break; + case DFU_GETSTATUS: + Endpoint_ClearSETUP(); + + /* Write 8-bit status value */ + Endpoint_Write_Byte(DFU_Status); + + /* Write 24-bit poll timeout value */ + Endpoint_Write_Byte(0); + Endpoint_Write_Word_LE(0); + + /* Write 8-bit state value */ + Endpoint_Write_Byte(DFU_State); + + /* Write 8-bit state string ID number */ + Endpoint_Write_Byte(0); + + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); + break; + case DFU_CLRSTATUS: + Endpoint_ClearSETUP(); + + /* Reset the status value variable to the default OK status */ + DFU_Status = OK; + + Endpoint_ClearStatusStage(); + break; + case DFU_GETSTATE: + Endpoint_ClearSETUP(); + + /* Write the current device state to the endpoint */ + Endpoint_Write_Byte(DFU_State); + + Endpoint_ClearIN(); + + Endpoint_ClearStatusStage(); + break; + case DFU_ABORT: + Endpoint_ClearSETUP(); + + /* Turn off TX/RX status LEDs so that they're not left on when application starts */ + LEDs_TurnOffLEDs(LEDMASK_TX); + LEDs_TurnOffLEDs(LEDMASK_RX); + + /* Reset the current state variable to the default idle state */ + DFU_State = dfuIDLE; + + Endpoint_ClearStatusStage(); + break; + } +} + +/** Routine to discard the specified number of bytes from the control endpoint stream. This is used to + * discard unused bytes in the stream from the host, including the memory program block suffix. + * + * \param[in] NumberOfBytes Number of bytes to discard from the host from the control endpoint + */ +static void DiscardFillerBytes(uint8_t NumberOfBytes) +{ + while (NumberOfBytes--) + { + if (!(Endpoint_BytesInEndpoint())) + { + Endpoint_ClearOUT(); + + /* Wait until next data packet received */ + while (!(Endpoint_IsOUTReceived())) + { + if (USB_DeviceState == DEVICE_STATE_Unattached) + return; + } + } + else + { + Endpoint_Discard_Byte(); + } + } +} + +/** Routine to process an issued command from the host, via a DFU_DNLOAD request wrapper. This routine ensures + * that the command is allowed based on the current secure mode flag value, and passes the command off to the + * appropriate handler function. + */ +static void ProcessBootloaderCommand(void) +{ + /* Check if device is in secure mode */ +// if (IsSecure) +// { +// /* Don't process command unless it is a READ or chip erase command */ +// if (!(((SentCommand.Command == COMMAND_WRITE) && +// IS_TWOBYTE_COMMAND(SentCommand.Data, 0x00, 0xFF)) || +// (SentCommand.Command == COMMAND_READ))) +// { +// /* Set the state and status variables to indicate the error */ +// DFU_State = dfuERROR; +// DFU_Status = errWRITE; +// +// /* Stall command */ +// Endpoint_StallTransaction(); +// +// /* Don't process the command */ +// return; +// } +// } + + /* Dispatch the required command processing routine based on the command type */ + switch (SentCommand.Command) + { + case COMMAND_PROG_START: + ProcessMemProgCommand(); + break; + case COMMAND_DISP_DATA: + ProcessMemReadCommand(); + break; + case COMMAND_WRITE: + ProcessWriteCommand(); + break; + case COMMAND_READ: + ProcessReadCommand(); + break; + case COMMAND_CHANGE_BASE_ADDR: + if (IS_TWOBYTE_COMMAND(SentCommand.Data, 0x03, 0x00)) // Set 64KB flash page command + Flash64KBPage = SentCommand.Data[2]; + break; + } +} + +/** Routine to concatenate the given pair of 16-bit memory start and end addresses from the host, and store them + * in the StartAddr and EndAddr global variables. + */ +static void LoadStartEndAddresses(void) +{ + union + { + uint8_t Bytes[2]; + uint16_t Word; + } Address[2] = {{.Bytes = {SentCommand.Data[2], SentCommand.Data[1]}}, + {.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}}}; + + /* Load in the start and ending read addresses from the sent data packet */ + StartAddr = Address[0].Word; + EndAddr = Address[1].Word; +} + +/** Handler for a Memory Program command issued by the host. This routine handles the preparations needed + * to write subsequent data from the host into the specified memory. + */ +static void ProcessMemProgCommand(void) +{ + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00) || // Write FLASH command + IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Write EEPROM command + { + /* Load in the start and ending read addresses */ + LoadStartEndAddresses(); + + /* If FLASH is being written to, we need to pre-erase the first page to write to */ + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) + { + union + { + uint16_t Words[2]; + uint32_t Long; + } CurrFlashAddress = {.Words = {StartAddr, Flash64KBPage}}; + + /* Erase the current page's temp buffer */ + boot_page_erase(CurrFlashAddress.Long); + boot_spm_busy_wait(); + } + + /* Set the state so that the next DNLOAD requests reads in the firmware */ + DFU_State = dfuDNLOAD_IDLE; + } +} + +/** Handler for a Memory Read command issued by the host. This routine handles the preparations needed + * to read subsequent data from the specified memory out to the host, as well as implementing the memory + * blank check command. + */ +static void ProcessMemReadCommand(void) +{ + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00) || // Read FLASH command + IS_ONEBYTE_COMMAND(SentCommand.Data, 0x02)) // Read EEPROM command + { + /* Load in the start and ending read addresses */ + LoadStartEndAddresses(); + + /* Set the state so that the next UPLOAD requests read out the firmware */ + DFU_State = dfuUPLOAD_IDLE; + } + else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Blank check FLASH command + { + uint32_t CurrFlashAddress = 0; + + while (CurrFlashAddress < BOOT_START_ADDR) + { + /* Check if the current byte is not blank */ + #if (FLASHEND > 0xFFFF) + if (pgm_read_byte_far(CurrFlashAddress) != 0xFF) + #else + if (pgm_read_byte(CurrFlashAddress) != 0xFF) + #endif + { + /* Save the location of the first non-blank byte for response back to the host */ + Flash64KBPage = (CurrFlashAddress >> 16); + StartAddr = CurrFlashAddress; + + /* Set state and status variables to the appropriate error values */ + DFU_State = dfuERROR; + DFU_Status = errCHECK_ERASED; + + break; + } + + CurrFlashAddress++; + } + } +} + +/** Handler for a Data Write command issued by the host. This routine handles non-programming commands such as + * bootloader exit (both via software jumps and hardware watchdog resets) and flash memory erasure. + */ +static void ProcessWriteCommand(void) +{ + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x03)) // Start application + { + /* Indicate that the bootloader is terminating */ + WaitForExit = true; + + /* Check if data supplied for the Start Program command - no data executes the program */ + if (SentCommand.DataSize) + { + if (SentCommand.Data[1] == 0x01) // Start via jump + { + union + { + uint8_t Bytes[2]; + AppPtr_t FuncPtr; + } Address = {.Bytes = {SentCommand.Data[4], SentCommand.Data[3]}}; + + /* Load in the jump address into the application start address pointer */ + AppStartPtr = Address.FuncPtr; + } + } + else + { + if (SentCommand.Data[1] == 0x00) // Start via watchdog + { + /* Start the watchdog to reset the AVR once the communications are finalized */ + wdt_enable(WDTO_250MS); + } + else // Start via jump + { + /* Set the flag to terminate the bootloader at next opportunity */ + RunBootloader = false; + } + } + } + else if (IS_TWOBYTE_COMMAND(SentCommand.Data, 0x00, 0xFF)) // Erase flash + { + uint32_t CurrFlashAddress = 0; + + /* Clear the application section of flash */ + while (CurrFlashAddress < BOOT_START_ADDR) + { + boot_page_erase(CurrFlashAddress); + boot_spm_busy_wait(); + boot_page_write(CurrFlashAddress); + boot_spm_busy_wait(); + + CurrFlashAddress += SPM_PAGESIZE; + } + + /* Re-enable the RWW section of flash as writing to the flash locks it out */ + boot_rww_enable(); + + /* Memory has been erased, reset the security bit so that programming/reading is allowed */ +// IsSecure = false; + } +} + +/** Handler for a Data Read command issued by the host. This routine handles bootloader information retrieval + * commands such as device signature and bootloader version retrieval. + */ +static void ProcessReadCommand(void) +{ + const uint8_t BootloaderInfo[3] = {BOOTLOADER_VERSION, BOOTLOADER_ID_BYTE1, BOOTLOADER_ID_BYTE2}; + const uint8_t SignatureInfo[3] = {AVR_SIGNATURE_1, AVR_SIGNATURE_2, AVR_SIGNATURE_3}; + + uint8_t DataIndexToRead = SentCommand.Data[1]; + + if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x00)) // Read bootloader info + ResponseByte = BootloaderInfo[DataIndexToRead]; + else if (IS_ONEBYTE_COMMAND(SentCommand.Data, 0x01)) // Read signature byte + ResponseByte = SignatureInfo[DataIndexToRead - 0x30]; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/Arduino-usbdfu.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,220 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Header file for Arduino-usbdfu.c. + */ + +#ifndef _ARDUINO_USB_DFU_BOOTLOADER_H_ +#define _ARDUINO_USB_DFU_BOOTLOADER_H_ + + /* Includes: */ + #include <avr/io.h> + #include <avr/wdt.h> + #include <avr/boot.h> + #include <avr/pgmspace.h> + #include <avr/eeprom.h> + #include <avr/power.h> + #include <avr/interrupt.h> + #include <stdbool.h> + + #include "Descriptors.h" + + #include <LUFA/Drivers/Board/LEDs.h> + #include <LUFA/Drivers/USB/USB.h> + + /* Macros: */ + /** LED mask for the library LED driver, to indicate TX activity. */ + #define LEDMASK_TX LEDS_LED1 + + /** LED mask for the library LED driver, to indicate RX activity. */ + #define LEDMASK_RX LEDS_LED2 + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2) + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2) + + /** Configuration define. Define this token to true to case the bootloader to reject all memory commands + * until a memory erase has been performed. When used in conjunction with the lockbits of the AVR, this + * can protect the AVR's firmware from being dumped from a secured AVR. When false, memory operations are + * allowed at any time. + */ +// #define SECURE_MODE false + + /** Major bootloader version number. */ + #define BOOTLOADER_VERSION_MINOR 2 + + /** Minor bootloader version number. */ + #define BOOTLOADER_VERSION_REV 0 + + /** Complete bootloader version number expressed as a packed byte, constructed from the + * two individual bootloader version macros. + */ + #define BOOTLOADER_VERSION ((BOOTLOADER_VERSION_MINOR << 4) | BOOTLOADER_VERSION_REV) + + /** First byte of the bootloader identification bytes, used to identify a device's bootloader. */ + #define BOOTLOADER_ID_BYTE1 0xDC + + /** Second byte of the bootloader identification bytes, used to identify a device's bootloader. */ + #define BOOTLOADER_ID_BYTE2 0xFB + + /** Convenience macro, used to determine if the issued command is the given one-byte long command. + * + * \param[in] dataarr Command byte array to check against + * \param[in] cb1 First command byte to check + */ + #define IS_ONEBYTE_COMMAND(dataarr, cb1) (dataarr[0] == (cb1)) + + /** Convenience macro, used to determine if the issued command is the given two-byte long command. + * + * \param[in] dataarr Command byte array to check against + * \param[in] cb1 First command byte to check + * \param[in] cb2 Second command byte to check + */ + #define IS_TWOBYTE_COMMAND(dataarr, cb1, cb2) ((dataarr[0] == (cb1)) && (dataarr[1] == (cb2))) + + /** Length of the DFU file suffix block, appended to the end of each complete memory write command. + * The DFU file suffix is currently unused (but is designed to give extra file information, such as + * a CRC of the complete firmware for error checking) and so is discarded. + */ + #define DFU_FILE_SUFFIX_SIZE 16 + + /** Length of the DFU file filler block, appended to the start of each complete memory write command. + * Filler bytes are added to the start of each complete memory write command, and must be discarded. + */ + #define DFU_FILLER_BYTES_SIZE 26 + + /** DFU class command request to detach from the host. */ + #define DFU_DETATCH 0x00 + + /** DFU class command request to send data from the host to the bootloader. */ + #define DFU_DNLOAD 0x01 + + /** DFU class command request to send data from the bootloader to the host. */ + #define DFU_UPLOAD 0x02 + + /** DFU class command request to get the current DFU status and state from the bootloader. */ + #define DFU_GETSTATUS 0x03 + + /** DFU class command request to reset the current DFU status and state variables to their defaults. */ + #define DFU_CLRSTATUS 0x04 + + /** DFU class command request to get the current DFU state of the bootloader. */ + #define DFU_GETSTATE 0x05 + + /** DFU class command request to abort the current multi-request transfer and return to the dfuIDLE state. */ + #define DFU_ABORT 0x06 + + /** DFU command to begin programming the device's memory. */ + #define COMMAND_PROG_START 0x01 + + /** DFU command to begin reading the device's memory. */ + #define COMMAND_DISP_DATA 0x03 + + /** DFU command to issue a write command. */ + #define COMMAND_WRITE 0x04 + + /** DFU command to issue a read command. */ + #define COMMAND_READ 0x05 + + /** DFU command to issue a memory base address change command, to set the current 64KB flash page + * that subsequent flash operations should use. */ + #define COMMAND_CHANGE_BASE_ADDR 0x06 + + /* Type Defines: */ + /** Type define for a non-returning function pointer to the loaded application. */ + typedef void (*AppPtr_t)(void) ATTR_NO_RETURN; + + /** Type define for a structure containing a complete DFU command issued by the host. */ + typedef struct + { + uint8_t Command; /**< Single byte command to perform, one of the COMMAND_* macro values */ + uint8_t Data[5]; /**< Command parameters */ + uint16_t DataSize; /**< Size of the command parameters */ + } DFU_Command_t; + + /* Enums: */ + /** DFU bootloader states. Refer to the DFU class specification for information on each state. */ + enum DFU_State_t + { + appIDLE = 0, + appDETACH = 1, + dfuIDLE = 2, + dfuDNLOAD_SYNC = 3, + dfuDNBUSY = 4, + dfuDNLOAD_IDLE = 5, + dfuMANIFEST_SYNC = 6, + dfuMANIFEST = 7, + dfuMANIFEST_WAIT_RESET = 8, + dfuUPLOAD_IDLE = 9, + dfuERROR = 10 + }; + + /** DFU command status error codes. Refer to the DFU class specification for information on each error code. */ + enum DFU_Status_t + { + OK = 0, + errTARGET = 1, + errFILE = 2, + errWRITE = 3, + errERASE = 4, + errCHECK_ERASED = 5, + errPROG = 6, + errVERIFY = 7, + errADDRESS = 8, + errNOTDONE = 9, + errFIRMWARE = 10, + errVENDOR = 11, + errUSBR = 12, + errPOR = 13, + errUNKNOWN = 14, + errSTALLEDPKT = 15 + }; + + /* Function Prototypes: */ + void SetupHardware(void); + void ResetHardware(void); + + void EVENT_USB_Device_UnhandledControlRequest(void); + + #if defined(INCLUDE_FROM_BOOTLOADER_C) + static void DiscardFillerBytes(uint8_t NumberOfBytes); + static void ProcessBootloaderCommand(void); + static void LoadStartEndAddresses(void); + static void ProcessMemProgCommand(void); + static void ProcessMemReadCommand(void); + static void ProcessWriteCommand(void); + static void ProcessReadCommand(void); + #endif + +#endif /* _ARDUINO_USB_DFU_BOOTLOADER_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/Board/LEDs.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,110 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/* + Board LEDs driver for the Benito board, from www.dorkbotpdx.org. +*/ + +#ifndef __LEDS_ARDUINOUNO_H__ +#define __LEDS_ARDUINOUNO_H__ + + /* Includes: */ + #include <avr/io.h> + +/* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 5) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 4) + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) + + /** LED mask for the none of the board LEDs */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRD |= LEDS_ALL_LEDS; + PORTD |= LEDS_ALL_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTD &= ~LEDMask; + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTD |= LEDMask; + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) + { + PORTD = ((PORTD | ActiveMask) & ~LEDMask); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PORTD ^= LEDMask; + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return (PORTD & LEDS_ALL_LEDS); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/Descriptors.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,189 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +USB_Descriptor_Device_t DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(01.10), + .Class = 0x00, + .SubClass = 0x00, + .Protocol = 0x00, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, // Atmel + .ProductID = PRODUCT_ID_CODE, // MCU-dependent + .ReleaseNumber = 0x0000, + + .ManufacturerStrIndex = NO_DESCRIPTOR, + .ProductStrIndex = 0x01, + .SerialNumStrIndex = NO_DESCRIPTOR, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +USB_Descriptor_Configuration_t ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 1, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = USB_CONFIG_ATTR_BUSPOWERED, + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .DFU_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 0, + .AlternateSetting = 0, + + .TotalEndpoints = 0, + + .Class = 0xFE, + .SubClass = 0x01, + .Protocol = 0x02, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .DFU_Functional = + { + .Header = {.Size = sizeof(USB_DFU_Functional_Descriptor_t), .Type = DTYPE_DFUFunctional}, + + .Attributes = (ATTR_CAN_UPLOAD | ATTR_CAN_DOWNLOAD), + + .DetachTimeout = 0x0000, + .TransferSize = 0x0c00, + + .DFUSpecification = VERSION_BCD(01.01) + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +USB_Descriptor_String_t LanguageString = +{ + .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, + + .UnicodeString = {LANGUAGE_ID_ENG} +}; + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +USB_Descriptor_String_t ProductString = +{ + #if (ARDUINO_MODEL_PID == ARDUINO_UNO_PID) + .Header = {.Size = USB_STRING_LEN(15), .Type = DTYPE_String}, + + .UnicodeString = L"Arduino Uno DFU" + #elif (ARDUINO_MODEL_PID == ARDUINO_MEGA2560_PID) + .Header = {.Size = USB_STRING_LEN(21), .Type = DTYPE_String}, + + .UnicodeString = L"Arduino Mega 2560 DFU" + #endif +}; + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = &DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = &ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + if (!(DescriptorNumber)) + { + Address = &LanguageString; + Size = LanguageString.Header.Size; + } + else + { + Address = &ProductString; + Size = ProductString.Header.Size; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/Descriptors.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,177 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include <LUFA/Drivers/USB/USB.h> + + /* Product-specific definitions: */ + #define ARDUINO_UNO_PID 0x0001 + #define ARDUINO_MEGA2560_PID 0x0010 + + /* Macros: */ + /** Descriptor type value for a DFU class functional descriptor. */ + #define DTYPE_DFUFunctional 0x21 + + /** DFU attribute mask, indicating that the DFU device will detach and re-attach when a DFU_DETACH + * command is issued, rather than the host issuing a USB Reset. + */ + #define ATTR_WILL_DETATCH (1 << 3) + + /** DFU attribute mask, indicating that the DFU device can communicate during the manifestation phase + * (memory programming phase). + */ + #define ATTR_MANEFESTATION_TOLLERANT (1 << 2) + + /** DFU attribute mask, indicating that the DFU device can accept DFU_UPLOAD requests to send data from + * the device to the host. + */ + #define ATTR_CAN_UPLOAD (1 << 1) + + /** DFU attribute mask, indicating that the DFU device can accept DFU_DNLOAD requests to send data from + * the host to the device. + */ + #define ATTR_CAN_DOWNLOAD (1 << 0) + + #if defined(__AVR_AT90USB1287__) + #define PRODUCT_ID_CODE 0x2FFB + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x97 + #define AVR_SIGNATURE_3 0x82 + #elif defined(__AVR_AT90USB1286__) + #define PRODUCT_ID_CODE 0x2FFB + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x97 + #define AVR_SIGNATURE_3 0x82 + #elif defined(__AVR_AT90USB647__) + #define PRODUCT_ID_CODE 0x2FF9 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x96 + #define AVR_SIGNATURE_3 0x82 + #elif defined(__AVR_AT90USB646__) + #define PRODUCT_ID_CODE 0x2FF9 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x96 + #define AVR_SIGNATURE_3 0x82 + #elif defined(__AVR_ATmega32U6__) + #define PRODUCT_ID_CODE 0x2FFB + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x95 + #define AVR_SIGNATURE_3 0x88 + #elif defined(__AVR_ATmega32U4__) + #define PRODUCT_ID_CODE 0x2FF4 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x95 + #define AVR_SIGNATURE_3 0x87 + #elif defined(__AVR_ATmega32U2__) + #define PRODUCT_ID_CODE 0x2FF0 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x95 + #define AVR_SIGNATURE_3 0x8A + #elif defined(__AVR_ATmega16U4__) + #define PRODUCT_ID_CODE 0x2FF3 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x94 + #define AVR_SIGNATURE_3 0x88 + #elif defined(__AVR_ATmega16U2__) + #define PRODUCT_ID_CODE 0x2FEF + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x94 + #define AVR_SIGNATURE_3 0x89 + #elif defined(__AVR_AT90USB162__) + #define PRODUCT_ID_CODE 0x2FFA + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x94 + #define AVR_SIGNATURE_3 0x82 + #elif defined(__AVR_AT90USB82__) + #define PRODUCT_ID_CODE 0x2FEE + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x93 + #define AVR_SIGNATURE_3 0x89 + #elif defined(__AVR_ATmega8U2__) + #define PRODUCT_ID_CODE 0x2FF7 + #define AVR_SIGNATURE_1 0x1E + #define AVR_SIGNATURE_2 0x93 + #define AVR_SIGNATURE_3 0x82 + #else + #error The selected AVR part is not currently supported by this bootloader. + #endif + + #if !defined(PRODUCT_ID_CODE) + #error Current AVR model is not supported by this bootloader. + #endif + + /* Type Defines: */ + /** Type define for a DFU class function descriptor. This descriptor gives DFU class information + * to the host when read, indicating the DFU device's capabilities. + */ + typedef struct + { + USB_Descriptor_Header_t Header; /**< Standard descriptor header structure */ + + uint8_t Attributes; /**< DFU device attributes, a mask comprising of the + * ATTR_* macros listed in this source file + */ + uint16_t DetachTimeout; /**< Timeout in milliseconds between a USB_DETACH + * command being issued and the device detaching + * from the USB bus + */ + uint16_t TransferSize; /**< Maximum number of bytes the DFU device can accept + * from the host in a transaction + */ + uint16_t DFUSpecification; /**< BCD packed DFU specification number this DFU + * device complies with + */ + } USB_DFU_Functional_Descriptor_t; + + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + USB_Descriptor_Interface_t DFU_Interface; + USB_DFU_Functional_Descriptor_t DFU_Functional; + } USB_Descriptor_Configuration_t; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/makefile Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,710 @@ +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# >> Modified for use with the LUFA project. << +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# Carlos Lamas +# Dean Camera +# Opendous Inc. +# Denver Gingerich +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make doxygen = Generate DoxyGen documentation for the project (must have +# DoxyGen installed) +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + + +# MCU name +MCU = atmega8u2 +MCU_AVRDUDE = at90usb82 + +# Specify the Arduino model using the assigned PID. This is used by Descriptors.c +# to set the product descriptor string (for DFU we must use the PID for each +# chip that dfu-bootloader or Flip expect) +# Uno PID: +ARDUINO_MODEL_PID = 0x0001 +# Mega 2560 PID: +#ARDUINO_MODEL_PID = 0x0010 + +# Target board (see library "Board Types" documentation, NONE for projects not requiring +# LUFA board drivers). If USER is selected, put custom board drivers in a directory called +# "Board" inside the application directory. +BOARD = USER + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_CLOCK below, as it is sourced by +# F_CLOCK after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# Input clock frequency. +# This will define a symbol, F_CLOCK, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_CLOCK = $(F_CPU) + + +# Starting byte address of the bootloader, as a byte address - computed via the formula +# BOOT_START = ((TOTAL_FLASH_BYTES - BOOTLOADER_SECTION_SIZE_BYTES) * 1024) +# +# Note that the bootloader size and start address given in AVRStudio is in words and not +# bytes, and so will need to be doubled to obtain the byte address needed by AVR-GCC. +BOOT_START = 0x1000 + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Target file name (without extension). +TARGET = Arduino-usbdfu + + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = . + + +# Path to the LUFA library +LUFA_PATH = ../.. + + +# LUFA library compile-time options and predefined tokens +LUFA_OPTS = -D USB_DEVICE_ONLY +LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 +LUFA_OPTS += -D CONTROL_ONLY_DEVICE +LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=32 +LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 +LUFA_OPTS += -D USE_RAM_DESCRIPTORS +LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" +LUFA_OPTS += -D NO_INTERNAL_SERIAL +LUFA_OPTS += -D NO_DEVICE_SELF_POWER +LUFA_OPTS += -D NO_DEVICE_REMOTE_WAKEUP +LUFA_OPTS += -D NO_STREAM_CALLBACKS + + +# Create the LUFA source path variables by including the LUFA root makefile +include $(LUFA_PATH)/LUFA/makefile + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c \ + Descriptors.c \ + $(LUFA_SRC_USB) \ + + +# List C++ source files here. (C dependencies are automatically generated.) +CPPSRC = + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = $(LUFA_PATH)/ + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=c99 + + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL +CDEFS += -DARDUINO_MODEL_PID=$(ARDUINO_MODEL_PID) +CDEFS += -DF_CLOCK=$(F_CLOCK)UL +CDEFS += -DBOARD=BOARD_$(BOARD) +CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL +CDEFS += -DTX_RX_LED_PULSE_MS=3 +CDEFS += $(LUFA_OPTS) + + +# Place -D or -U options here for ASM sources +ADEFS = -DF_CPU=$(F_CPU) +ADEFS += -DF_CLOCK=$(F_CLOCK)UL +ADEFS += -DBOARD=BOARD_$(BOARD) +CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL +ADEFS += $(LUFA_OPTS) + +# Place -D or -U options here for C++ sources +CPPDEFS = -DF_CPU=$(F_CPU)UL +CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL +CPPDEFS += -DBOARD=BOARD_$(BOARD) +CDEFS += -DBOOT_START_ADDR=$(BOOT_START)UL +CPPDEFS += $(LUFA_OPTS) +#CPPDEFS += -D__STDC_LIMIT_MACROS +#CPPDEFS += -D__STDC_CONSTANT_MACROS + + + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fno-inline-small-functions +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing +CFLAGS += -Wall +CFLAGS += -Wstrict-prototypes +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + + +#---------------- Compiler Options C++ ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CPPFLAGS = -g$(DEBUG) +CPPFLAGS += $(CPPDEFS) +CPPFLAGS += -O$(OPT) +CPPFLAGS += -funsigned-char +CPPFLAGS += -funsigned-bitfields +CPPFLAGS += -fpack-struct +CPPFLAGS += -fshort-enums +CPPFLAGS += -fno-exceptions +CPPFLAGS += -Wall +CPPFLAGS += -Wundef +#CPPFLAGS += -mshort-calls +#CPPFLAGS += -fno-unit-at-a-time +#CPPFLAGS += -Wstrict-prototypes +#CPPFLAGS += -Wunreachable-code +#CPPFLAGS += -Wsign-compare +CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) +CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +#CPPFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# dump that will be displayed for a given single line of source input. +ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += -Wl,--section-start=.text=$(BOOT_START) +LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + + +#---------------- Programming Options (avrdude) ---------------- + +# Fuse settings for Arduino Uno DFU bootloader project +AVRDUDE_FUSES = -U efuse:w:0xF4:m -U hfuse:w:0xD9:m -U lfuse:w:0xFF:m + +# Lock settings for Arduino Uno DFU bootloader project +AVRDUDE_LOCK = -U lock:w:0x0F:m + +# Programming hardware +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = avrispmkii + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU_AVRDUDE) -F -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_COMPILING_CPP = Compiling C++: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + + + + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym +#build: lib + + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf +MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) +FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) + + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) $(AVRDUDE_FUSES) $(AVRDUDE_LOCK) + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT = $(OBJCOPY) --debugging +COFFCONVERT += --change-section-address .data-0x800000 +COFFCONVERT += --change-section-address .bss-0x800000 +COFFCONVERT += --change-section-address .noinit-0x800000 +COFFCONVERT += --change-section-address .eeprom-0x810000 + + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create object files from C++ source files. +$(OBJDIR)/%.o : %.cpp + @echo + @echo $(MSG_COMPILING_CPP) $< + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C++ source files. +%.s : %.cpp + $(CC) -S $(ALL_CPPFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +$(OBJDIR)/%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRC:.c=.i) + $(REMOVEDIR) .dep + +doxygen: + @echo Generating Project Documentation... + @doxygen Doxygen.conf + @echo Documentation Generation Complete. + +clean_doxygen: + rm -rf Documentation + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff doxygen clean \ +clean_list clean_doxygen program debug gdb-config
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbdfu/readme.txt Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,7 @@ +To setup the project and program an ATMEG8U2 with the Arduino USB DFU bootloader: +1. unpack the source into LUFA's Bootloader directory +2. set ARDUINO_MODEL_PID in the makefile as appropriate +3. do "make clean; make; make program" + +Check that the board enumerates as either "Arduino Uno DFU" or "Arduino Mega 2560 DFU". Test by uploading the Arduino-usbserial application firmware (see instructions in Arduino-usbserial directory) +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Mega2560-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123420001000102DC0109023E0002017D +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-MegaADK-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123440001000102DC0109023E0002017B +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial-atmega16u2-Uno-Rev3.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,254 @@ +:1000000090C00000A9C00000A7C00000A5C000006B +:10001000A3C00000A1C000009FC000009DC0000060 +:100020009BC0000099C0000097C0000048C40000B9 +:100030000CC4000091C000008FC000008DC0000003 +:100040008BC0000089C0000087C0000085C0000090 +:1000500083C0000081C000007FC0000002C100001A +:100060007BC0000079C0000077C0000075C00000B0 +:1000700073C0000071C000006FC000006DC00000C0 +:100080006BC0000069C0000067C0000065C00000D0 +:1000900063C0000061C000001201100102000008EE +:1000A0004123430001000102DC0109023E0002017C +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:10012000000011241FBECFEFD2E0DEBFCDBF11E033 +:10013000A0E0B1E0ECEAFFE002C005900D92A6312C +:10014000B107D9F712E0A6E1B1E001C01D92AF32CC +:10015000B107E1F7F1D028C753CF9C01DC01AE57BE +:10016000BF4FED91FC91119741911196FC93EE9345 +:1001700080589F4FE817F90711F42D933C939FB7D0 +:10018000F894F901EC57FF4F8081815080839FBF25 +:10019000842F0895DF92EF92FF920F931F93FC013B +:1001A0008489813019F0823021F405C040E3D42ED7 +:1001B00004C0DD2402C030E2D32E8389823011F4E2 +:1001C00088E0D82A8589873031F0883031F0863050 +:1001D00031F482E003C084E001C086E0D82A1092A6 +:1001E000C9001092C8001092CA00E784F088018903 +:1001F000128980E0E81681EEF80680E0080780E0CA +:10020000180719F420E130E00FC0C801B701969536 +:1002100087957795679560587B47814E9F4FA801DA +:100220009701A0D6215030403093CD002093CC00D0 +:10023000D092CA0080E0E81681EEF80680E0080758 +:1002400080E0180711F082E001C080E08093C800D0 +:1002500088E98093C9001F910F91FF90EF90DF9084 +:1002600008951F920F920FB60F9211242F938F9320 +:100270009F93EF93FF939091CE008EB38430F1F46F +:10028000E0919901F0919A019083E0919901F091A8 +:100290009A01CF01019690939A018093990189590F +:1002A000914021F489E191E0928381839FB7F89492 +:1002B00080919D018F5F80939D019FBFFF91EF9182 +:1002C0009F918F912F910F900FBE0F901F901895B7 +:1002D000FC01858580FF02C05F9808955F9A0895AC +:1002E00080E091E0D5C580E091E088C584B7877F44 +:1002F00084BF28E10FB6F89420936000109260004C +:100300000FBE87E690E09093CD008093CC0086E00E +:100310008093CA001092C8002093C900539A5A9A39 +:100320008AB180638AB98BB180638BB983D284E050 +:1003300085BD5F9A579A08950F931F93CF93DF93CC +:10034000D5DF2FB7F8948EE991E090931F02809348 +:100350001E0290932102809320022FBF2FB7F894A2 +:1003600089E191E090939A018093990190939C0187 +:1003700080939B012FBF7894CEE9D1E003E08FB743 +:10038000F894909122028FBF903809F180E091E0BB +:10039000ABD497FD1CC0E0911E02F0911F02808338 +:1003A000E0911E02F0911F02CF01019690931F026F +:1003B00080931E028E51924011F4D283C1839FB765 +:1003C000F894809122028F5F809322029FBF8FB7A3 +:1003D000F89410919D018FBFA89902C0113678F151 +:1003E000A89A80919D01882361F05D980093160181 +:1003F00008C089E191E0B1DE682F80E091E0DAD4B5 +:1004000011501123B1F780911601882351F080918A +:10041000160181508093160180911601882309F4FA +:100420005D9A80911701882351F0809117018150C6 +:100430008093170180911701882309F45C9A8FB784 +:10044000F894909122028FBF992369F08EE991E090 +:1004500084DE982F8091C80085FFFCCF9093CE005A +:100460005C980093170180E091E095D42AD487CF5F +:10047000DA01923049F0933061F09130F9F4E8E913 +:10048000F0E022E130E01EC0EAEAF0E02EE330E0E6 +:1004900019C0813049F0813018F0823079F408C0F9 +:1004A000E8EEF0E0849107C0ECEEF0E0849103C048 +:1004B000E0E2F1E08491282F30E004C0E0E0F0E0D9 +:1004C00020E030E0ED93FC93C901089528E030E08E +:1004D00040E003C04F5F220F331F28173907D0F3C6 +:1004E000842F8295807F08958093E9008091EB00AE +:1004F00081608093EB001092ED006093EC004093DC +:10050000ED008091EE00881F8827881F08951092C3 +:10051000F40090E09093E9001092F0001092E8004F +:100520001092ED008091EB008E7F8093EB009F5F37 +:10053000953081F708958091270288238CF403C0B9 +:100540008EB38823B1F08091E80082FFF9CF8091CB +:10055000E8008B778093E80008958EB3882349F0F4 +:100560008091E80080FFF9CF8091E8008E7780933A +:10057000E800089594E68091EC0080FF05C080912A +:10058000E80080FF05C023C08091E80082FD1FC005 +:100590008EB3882311F482E008958EB3853011F470 +:1005A00083E008958091EB0085FF02C081E008950B +:1005B0008091E10082FFDFCF8091E1008B7F80930B +:1005C000E100992311F484E008959150D4CF80E0A4 +:1005D00008959C0140912D0250912E024617570715 +:1005E00018F4F90120E038C06115710511F0AB0174 +:1005F000F8CF8091E8008E778093E80040E050E0EB +:10060000F0CF8091E80083FF02C081E008958091DF +:10061000E80082FD2DC08EB3882381F18EB3853032 +:1006200079F18091E80080FF17C09091F20006C038 +:1006300081918093F100415050409F5F41155105D9 +:1006400011F09830A8F320E0983009F421E080916F +:10065000E8008E778093E8004115510591F622233A +:1006600081F606C08EB3882349F08EB3853041F001 +:100670008091E80082FFF6CF80E0089582E008953F +:1006800083E008959C0140912D0250912E0246175F +:10069000570710F490E03BC06115710511F0AB01F4 +:1006A000F9CF8091E8008E778093E80040E050E039 +:1006B000F1CF8091E80083FF02C081E0089580912E +:1006C000E80082FD30C08EB3882399F18EB3853067 +:1006D00091F18091E80080FF1AC08091F20009C07A +:1006E000F9012F5F3F4FE491E093F10041505040FA +:1006F0008F5F4115510511F0883090F390E08830FC +:1007000009F491E08091E8008E778093E80041152C +:10071000510579F6992369F606C08EB3882349F00E +:100720008EB3853041F08091E80082FFF6CF80E003 +:10073000089582E0089583E008959C016115710594 +:1007400029F48091E8008B778093E800F90120C0BC +:100750008091E80083FF02C081E008958EB3882372 +:1007600039F18EB3853031F18091E80082FFF0CF0E +:1007700006C08091F10081936150704021F080911A +:10078000F2008823B1F78091E8008B778093E8002E +:1007900061157105E9F606C08EB3882349F08EB362 +:1007A000853041F08091E80080FFF6CF80E0089529 +:1007B00082E0089583E0089542D044D01EBA10929A +:1007C0002502109224021092230284E089BD89B58B +:1007D000826089BD09B400FEFDCF8091D800982FBA +:1007E0009F779093D80080688093D80080916300B1 +:1007F0008E7F809363008091D8008F7D8093D80096 +:100800008091E0008E7F8093E0008091E1008E7FF8 +:100810008093E1008091E20081608093E20080910A +:10082000E100877F8093E1008091E20088608093FF +:10083000E2000895C1DF81E08093260208951092BE +:10084000E20008951092E10008951F920F920FB6F2 +:100850000F9211241F932F933F934F935F936F93A6 +:100860007F938F939F93AF93BF93EF93FF93E9EEA3 +:10087000F0E0108117701082E0EFF0E08081877F58 +:1008800080837894C3D0F894A9EEB0E01C92E0EF96 +:10089000F0E08081886080831C93FF91EF91BF918D +:1008A000AF919F918F917F916F915F914F913F9108 +:1008B0002F911F910F900FBE0F901F9018951F92B0 +:1008C0000F920FB60F9211242F933F934F935F9384 +:1008D0006F937F938F939F93AF93BF93EF93FF9308 +:1008E0008091E10080FF1BC08091E20080FF17C073 +:1008F0008091E1008E7F8093E1008091E2008E7F05 +:100900008093E2008091E20080618093E200809118 +:10091000D80080628093D80019BC1EBAD1D18091D2 +:10092000E10084FF29C08091E20084FF25C084E0BB +:1009300089BD89B5826089BD09B400FEFDCF809173 +:10094000D8008F7D8093D8008091E1008F7E8093C6 +:10095000E1008091E2008F7E8093E2008091E200CE +:1009600081608093E20080912502882311F481E068 +:1009700001C084E08EBBA4D18091E10083FF27C039 +:100980008091E20083FF23C08091E100877F809304 +:10099000E10082E08EBB109225028091E1008E7F03 +:1009A0008093E1008091E2008E7F8093E20080914D +:1009B000E20080618093E200AADD80E060E042E036 +:1009C00093DD8091F00088608093F00079D1809170 +:1009D000E10082FF0AC08091E20082FF06C08091A0 +:1009E000E1008B7F8093E1006BD1FF91EF91BF918C +:1009F000AF919F918F917F916F915F914F913F91B7 +:100A00002F910F900FBE0F901F9018951F93DF939B +:100A1000CF93CDB7DEB7AC970FB6F894DEBF0FBE5D +:100A2000CDBFE7E2F2E08091F100819322E0EF3266 +:100A3000F207C9F78091270230912802353009F476 +:100A400087C0363040F43130C9F1313070F0333086 +:100A500009F01DC133C0383009F4EFC0393009F452 +:100A6000FEC0363009F013C192C0803821F08238C0 +:100A700009F00DC108C090912302809124028823BF +:100A800099F0926011C080912B0287708093E900E9 +:100A90008091EB0090E025E0969587952A95E1F707 +:100AA000982F91701092E9008091E800877F8093E1 +:100AB000E8009093F1001092F100CAC0882319F069 +:100AC000823009F0E4C090E08F719070009721F0BF +:100AD000029709F0DDC00CC080912902813009F035 +:100AE000D7C010922402333069F5809324022AC0C3 +:100AF00080912902882331F520912B02277009F477 +:100B0000C7C02093E9008091EB0080FFC1C0333063 +:100B100021F48091EB00806213C08091EB00806132 +:100B20008093EB0081E090E002C0880F991F2A9526 +:100B3000E2F78093EA001092EA008091EB0088606F +:100B40008093EB001092E9008091E800877F83C0DA +:100B5000882309F09CC0109129028091E800877FCA +:100B60008093E800E8DC04C08EB3882309F490C0C9 +:100B70008091E80080FFF8CF812F8F7711F492E009 +:100B800001C093E09EBB80688093E30081C08058E1 +:100B9000823008F07CC08091290290912A0223E0E3 +:100BA0008C3D920799F55FB7F894DE0115964EE0FB +:100BB00020E030E061E2E42FF0E0609357008491A0 +:100BC00020FF03C082958F704F5F982F9F70892FF1 +:100BD000805D8A3308F0895F8C9311961C9211977F +:100BE0002F5F3F4F12962431310529F75FBF8AE20C +:100BF0008B8383E08C838091E800877F8093E8007B +:100C0000CE0103966AE270E0E4DC11C060912B0231 +:100C1000AE014F5F5F4F2CDCBC010097C9F18091A2 +:100C2000E800877F8093E80089819A812BDD80919D +:100C3000E8008B778093E8002BC0803841F58091E5 +:100C4000E800877F8093E800809125028093F1007F +:100C50008091E8008E778093E8006DDC19C08823CE +:100C6000B1F490912902923098F48091E800877F46 +:100C70008093E800909325025EDC80912502882312 +:100C800011F483E001C084E08EBB2DDB01C028DBC2 +:100C90008091E80083FF0AC08091EB00806280931E +:100CA000EB008091E800877F8093E800AC960FB658 +:100CB000F894DEBF0FBECDBFCF91DF911F91089595 +:100CC00008951F938EB3882361F01091E90010926C +:100CD000E9008091E80083FF01C098DE177010934F +:100CE000E9001F9108950895FC018EB3843021F529 +:100CF00087859089A189B2890097A105B105E1F0A6 +:100D000085818093E9008091E80082FF15C0809181 +:100D1000F200882319F42FEF3FEF04C08091F10017 +:100D2000282F30E08091F200882341F48091E80080 +:100D30008B778093E80002C02FEF3FEFC901089541 +:100D4000FC018EB3843011F587859089A189B28921 +:100D50000097A105B105D1F081818093E9008091D0 +:100D6000F2008823A9F09091E8008091E8008E7746 +:100D70008093E80095FD0CC0FDDB982F882349F493 +:100D80008091E8008E778093E80003C092E001C074 +:100D900090E0892F0895FC018EB3843051F487854B +:100DA0009089A189B2890097A105B10511F0CF0101 +:100DB000C7CF08951F93FC01162F8EB38430D9F44A +:100DC00087859089A189B2890097A105B10599F01D +:100DD00081818093E9008091E80085FD08C08091C1 +:100DE000E8008E778093E800C5DB882329F4109310 +:100DF000F10080E001C082E01F9108950F931F93DE +:100E0000CF93DF93EC010D96FC0189E0DF011D9289 +:100E10008A95E9F72A813B8109818C81882311F425 +:100E200010E001C014E0C90151DB182B1260802FC3 +:100E300061E8412F59DB882329F12E813F810D8103 +:100E40008885882311F410E001C014E0C9013EDB5D +:100E5000182B1260802F60E8412F46DB882391F029 +:100E60002A853B8509858C85882311F410E001C013 +:100E700014E0C9012BDB182B1260802F61EC412F8D +:100E800033DB01C080E0DF91CF911F910F91089576 +:100E9000CF93DF93EC018091E80083FF60C08881ED +:100EA00090E020912B0230912C022817390709F08D +:100EB00056C080912802813261F0823220F4803263 +:100EC00009F04DC019C0823269F1833209F047C080 +:100ED00038C080912702813A09F041C08091E80032 +:100EE000877F8093E800CE010F9667E070E071DBAA +:100EF0008091E8008B7713C080912702813279F5C9 +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E013DCCE013ED98091E8008E7780939B +:100F2000E8001DC0809127028132C9F48091E80059 +:100F3000877F8093E800809129028D87CE01C8D9F0 +:100F40000DC080912702813251F48091E800877FA3 +:100F50008093E800CE0160912902C5DEECDADF91D2 +:100F6000CF910895A1E21A2EAA1BBB1BFD010DC053 +:100F7000AA1FBB1FEE1FFF1FA217B307E407F50749 +:100F800020F0A21BB30BE40BF50B661F771F881F25 +:100F9000991F1A9469F760957095809590959B01BB +:0C0FA000AC01BD01CF010895F894FFCF13 +:100FAC0000034000000440000002080000000000A4 +:060FBC000000000000002F +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial-mega.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,256 @@ +:10000000A2C00000BBC00000B9C00000B7C0000023 +:10001000B5C00000B3C00000B1C00000AFC0000018 +:10002000ADC00000ABC00000A9C000005AC4000071 +:100030001EC40000A3C00000A1C000009FC00000BB +:100040009DC000009BC0000099C0000097C0000048 +:1000500095C0000093C0000091C0000014C10000D2 +:100060008DC000008BC0000089C0000087C0000068 +:1000700085C0000083C0000081C000007FC0000078 +:100080007DC000007BC0000079C0000077C0000088 +:1000900075C0000073C000001201100102000008CA +:1000A0004123100001000102DC0109023E000201AF +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:100120002403410072006400750069006E006F00D6 +:1001300020004D006500670061002000320035009E +:1001400036003000000011241FBECFEFD2E0DEBF2A +:10015000CDBF11E0A0E0B1E0E0EDFFE002C005900E +:100160000D92A631B107D9F712E0A6E1B1E001C0C6 +:100170001D92AF32B107E1F7F1D028C741CF9C0102 +:10018000DC01AE57BF4FED91FC9111974191119653 +:10019000FC93EE9380589F4FE817F90711F42D93C5 +:1001A0003C939FB7F894F901EC57FF4F8081815041 +:1001B00080839FBF842F0895DF92EF92FF920F9369 +:1001C0001F93FC018489813019F0823021F405C02D +:1001D00040E3D42E04C0DD2402C030E2D32E838954 +:1001E000823011F488E0D82A8589873031F0883050 +:1001F00031F0863031F482E003C084E001C086E053 +:10020000D82A1092C9001092C8001092CA00E78440 +:10021000F0880189128980E0E81681EEF80680E016 +:10022000080780E0180719F420E130E00FC0C8018A +:10023000B701969587957795679560587B47814E6E +:100240009F4FA8019701A0D6215030403093CD0098 +:100250002093CC00D092CA0080E0E81681EEF80628 +:1002600080E0080780E0180711F082E001C080E01C +:100270008093C80088E98093C9001F910F91FF9077 +:10028000EF90DF9008951F920F920FB60F921124F6 +:100290002F938F939F93EF93FF939091CE008EB304 +:1002A0008430F1F4E0919901F0919A019083E0910A +:1002B0009901F0919A01CF01019690939A01809350 +:1002C00099018959914021F489E191E092838183D8 +:1002D0009FB7F89480919D018F5F80939D019FBF90 +:1002E000FF91EF919F918F912F910F900FBE0F90E3 +:1002F0001F901895FC01858580FF02C05F980895C6 +:100300005F9A089580E091E0D5C580E091E088C5CE +:1003100084B7877F84BF28E10FB6F89420936000EC +:10032000109260000FBE87E690E09093CD0080931E +:10033000CC0086E08093CA001092C8002093C900C8 +:10034000539A5A9A8AB180638AB98BB180638BB908 +:1003500083D284E085BD5F9A579A08950F931F93C7 +:10036000CF93DF93D5DF2FB7F8948EE991E0909388 +:100370001F0280931E0290932102809320022FBFC0 +:100380002FB7F89489E191E090939A0180939901B5 +:1003900090939C0180939B012FBF7894CEE9D1E08C +:1003A00003E08FB7F894909122028FBF903809F143 +:1003B00080E091E0ABD497FD1CC0E0911E02F0916B +:1003C0001F028083E0911E02F0911F02CF0101966F +:1003D00090931F0280931E028E51924011F4D2839B +:1003E000C1839FB7F894809122028F5F809322028D +:1003F0009FBF8FB7F89410919D018FBFA89902C03D +:10040000113678F1A89A80919D01882361F05D985A +:100410000093160108C089E191E0B1DE682F80E009 +:1004200091E0DAD411501123B1F78091160188239D +:1004300051F0809116018150809316018091160130 +:10044000882309F45D9A80911701882351F08091E7 +:10045000170181508093170180911701882309F4B7 +:100460005C9A8FB7F894909122028FBF992369F01C +:100470008EE991E084DE982F8091C80085FFFCCF43 +:100480009093CE005C980093170180E091E095D4A2 +:100490002AD487CFDA01923049F0933061F091305D +:1004A000F9F4E8E9F0E022E130E01EC0EAEAF0E029 +:1004B0002EE330E019C0813049F0813018F08230ED +:1004C00079F408C0E8EEF0E0849107C0ECEEF0E0CB +:1004D000849103C0E0E2F1E08491282F30E004C071 +:1004E000E0E0F0E020E030E0ED93FC93C9010895F6 +:1004F00028E030E040E003C04F5F220F331F281791 +:100500003907D0F3842F8295807F08958093E90086 +:100510008091EB0081608093EB001092ED0060937E +:10052000EC004093ED008091EE00881F8827881F23 +:1005300008951092F40090E09093E9001092F0007A +:100540001092E8001092ED008091EB008E7F809376 +:10055000EB009F5F953081F70895809127028823F3 +:100560008CF403C08EB38823B1F08091E80082FF41 +:10057000F9CF8091E8008B778093E80008958EB3DF +:10058000882349F08091E80080FFF9CF8091E8004E +:100590008E778093E800089594E68091EC0080FFC8 +:1005A00005C08091E80080FF05C023C08091E8006D +:1005B00082FD1FC08EB3882311F482E008958EB3AC +:1005C000853011F483E008958091EB0085FF02C02F +:1005D00081E008958091E10082FFDFCF8091E1000A +:1005E0008B7F8093E100992311F484E0089591506A +:1005F000D4CF80E008959C0140912D0250912E02AD +:100600004617570718F4F90120E038C06115710545 +:1006100011F0AB01F8CF8091E8008E778093E8006D +:1006200040E050E0F0CF8091E80083FF02C081E01D +:1006300008958091E80082FD2DC08EB3882381F15A +:100640008EB3853079F18091E80080FF17C09091DA +:10065000F20006C081918093F100415050409F5FAD +:100660004115510511F09830A8F320E0983009F4B5 +:1006700021E08091E8008E778093E80041155105D4 +:1006800091F6222381F606C08EB3882349F08EB3FB +:10069000853041F08091E80082FFF6CF80E0089538 +:1006A00082E0089583E008959C0140912D025091CD +:1006B0002E024617570710F490E03BC061157105F4 +:1006C00011F0AB01F9CF8091E8008E778093E800BC +:1006D00040E050E0F1CF8091E80083FF02C081E06C +:1006E00008958091E80082FD30C08EB3882399F18F +:1006F0008EB3853091F18091E80080FF1AC080911F +:10070000F20009C0F9012F5F3F4FE491E093F1003F +:10071000415050408F5F4115510511F0883090F3E2 +:1007200090E0883009F491E08091E8008E77809322 +:10073000E8004115510579F6992369F606C08EB394 +:10074000882349F08EB3853041F08091E80082FF24 +:10075000F6CF80E0089582E0089583E008959C013B +:100760006115710529F48091E8008B778093E8008A +:10077000F90120C08091E80083FF02C081E0089564 +:100780008EB3882339F18EB3853031F18091E80042 +:1007900082FFF0CF06C08091F100819361507040DC +:1007A00021F08091F2008823B1F78091E8008B77E7 +:1007B0008093E80061157105E9F606C08EB38823C1 +:1007C00049F08EB3853041F08091E80080FFF6CF8C +:1007D00080E0089582E0089583E0089542D044D0F7 +:1007E0001EBA10922502109224021092230284E075 +:1007F00089BD89B5826089BD09B400FEFDCF8091B5 +:10080000D800982F9F779093D80080688093D80065 +:10081000809163008E7F809363008091D8008F7DEC +:100820008093D8008091E0008E7F8093E0008091DB +:10083000E1008E7F8093E1008091E20081608093EF +:10084000E2008091E100877F8093E1008091E200E7 +:1008500088608093E2000895C1DF81E080932602E2 +:1008600008951092E20008951092E10008951F92F9 +:100870000F920FB60F9211241F932F933F934F9314 +:100880005F936F937F938F939F93AF93BF93EF93F8 +:10089000FF93E9EEF0E0108117701082E0EFF0E0D6 +:1008A0008081877F80837894C3D0F894A9EEB0E0EC +:1008B0001C92E0EFF0E08081886080831C93FF91C0 +:1008C000EF91BF91AF919F918F917F916F915F91C8 +:1008D0004F913F912F911F910F900FBE0F901F903E +:1008E00018951F920F920FB60F9211242F933F93DA +:1008F0004F935F936F937F938F939F93AF93BF9328 +:10090000EF93FF938091E10080FF1BC08091E20094 +:1009100080FF17C08091E1008E7F8093E10080917D +:10092000E2008E7F8093E2008091E20080618093FC +:10093000E2008091D80080628093D80019BC1EBA72 +:10094000D1D18091E10084FF29C08091E20084FF31 +:1009500025C084E089BD89B5826089BD09B400FEE7 +:10096000FDCF8091D8008F7D8093D8008091E100E9 +:100970008F7E8093E1008091E2008F7E8093E20081 +:100980008091E20081608093E200809125028823BB +:1009900011F481E001C084E08EBBA4D18091E1001C +:1009A00083FF27C08091E20083FF23C08091E10094 +:1009B000877F8093E10082E08EBB109225028091B8 +:1009C000E1008E7F8093E1008091E2008E7F809332 +:1009D000E2008091E20080618093E200AADD80E085 +:1009E00060E042E093DD8091F00088608093F00049 +:1009F00079D18091E10082FF0AC08091E20082FFFC +:100A000006C08091E1008B7F8093E1006BD1FF9164 +:100A1000EF91BF91AF919F918F917F916F915F9176 +:100A20004F913F912F910F900FBE0F901F901895EF +:100A30001F93DF93CF93CDB7DEB7AC970FB6F89483 +:100A4000DEBF0FBECDBFE7E2F2E08091F1008193FF +:100A500022E0EF32F207C9F7809127023091280295 +:100A6000353009F487C0363040F43130C9F13130C7 +:100A700070F0333009F01DC133C0383009F4EFC0D5 +:100A8000393009F4FEC0363009F013C192C0803805 +:100A900021F0823809F00DC108C0909123028091A5 +:100AA0002402882399F0926011C080912B028770F4 +:100AB0008093E9008091EB0090E025E09695879582 +:100AC0002A95E1F7982F91701092E9008091E80043 +:100AD000877F8093E8009093F1001092F100CAC0E4 +:100AE000882319F0823009F0E4C090E08F71907093 +:100AF000009721F0029709F0DDC00CC08091290217 +:100B0000813009F0D7C010922402333069F5809308 +:100B100024022AC080912902882331F520912B02DA +:100B2000277009F4C7C02093E9008091EB0080FF93 +:100B3000C1C0333021F48091EB00806213C08091FA +:100B4000EB0080618093EB0081E090E002C0880FB1 +:100B5000991F2A95E2F78093EA001092EA008091AB +:100B6000EB0088608093EB001092E9008091E80030 +:100B7000877F83C0882309F09CC01091290280914F +:100B8000E800877F8093E800E8DC04C08EB3882308 +:100B900009F490C08091E80080FFF8CF812F8F7713 +:100BA00011F492E001C093E09EBB80688093E30063 +:100BB00081C08058823008F07CC0809129029091D9 +:100BC0002A0223E08C3D920799F55FB7F894DE0185 +:100BD00015964EE020E030E061E2E42FF0E0609313 +:100BE0005700849120FF03C082958F704F5F982F2C +:100BF0009F70892F805D8A3308F0895F8C931196EE +:100C00001C9211972F5F3F4F12962431310529F71F +:100C10005FBF8AE28B8383E08C838091E800877FCB +:100C20008093E800CE0103966AE270E0E4DC11C034 +:100C300060912B02AE014F5F5F4F2CDCBC0100972F +:100C4000C9F18091E800877F8093E80089819A81CB +:100C50002BDD8091E8008B778093E8002BC08038F3 +:100C600041F58091E800877F8093E800809125021C +:100C70008093F1008091E8008E778093E8006DDC2E +:100C800019C08823B1F490912902923098F4809190 +:100C9000E800877F8093E800909325025EDC8091D6 +:100CA0002502882311F483E001C084E08EBB2DDB94 +:100CB00001C028DB8091E80083FF0AC08091EB002F +:100CC00080628093EB008091E800877F8093E8004A +:100CD000AC960FB6F894DEBF0FBECDBFCF91DF91BB +:100CE0001F91089508951F938EB3882361F010918A +:100CF000E9001092E9008091E80083FF01C098DECE +:100D000017701093E9001F9108950895FC018EB3A8 +:100D1000843021F587859089A189B2890097A10542 +:100D2000B105E1F085818093E9008091E80082FFC0 +:100D300015C08091F200882319F42FEF3FEF04C013 +:100D40008091F100282F30E08091F200882341F457 +:100D50008091E8008B778093E80002C02FEF3FEF8F +:100D6000C9010895FC018EB3843011F587859089FF +:100D7000A189B2890097A105B105D1F08181809345 +:100D8000E9008091F2008823A9F09091E800809119 +:100D9000E8008E778093E80095FD0CC0FDDB982F6E +:100DA000882349F48091E8008E778093E80003C09F +:100DB00092E001C090E0892F0895FC018EB3843049 +:100DC00051F487859089A189B2890097A105B10561 +:100DD00011F0CF01C7CF08951F93FC01162F8EB3DA +:100DE0008430D9F487859089A189B2890097A105BB +:100DF000B10599F081818093E9008091E80085FD3B +:100E000008C08091E8008E778093E800C5DB8823D6 +:100E100029F41093F10080E001C082E01F91089551 +:100E20000F931F93CF93DF93EC010D96FC0189E0A4 +:100E3000DF011D928A95E9F72A813B8109818C8126 +:100E4000882311F410E001C014E0C90151DB182B14 +:100E50001260802F61E8412F59DB882329F12E8110 +:100E60003F810D818885882311F410E001C014E0D2 +:100E7000C9013EDB182B1260802F60E8412F46DB52 +:100E8000882391F02A853B8509858C85882311F478 +:100E900010E001C014E0C9012BDB182B1260802F79 +:100EA00061EC412F33DB01C080E0DF91CF911F91D6 +:100EB0000F910895CF93DF93EC018091E80083FFB9 +:100EC00060C0888190E020912B0230912C0228177D +:100ED000390709F056C080912802813261F08232D0 +:100EE00020F4803209F04DC019C0823269F183329A +:100EF00009F047C038C080912702813A09F041C00B +:100F00008091E800877F8093E800CE010F9667E02C +:100F100070E071DB8091E8008B7713C0809127022D +:100F2000813279F58091E800877F8093E800CE01D7 +:100F30000F9667E070E013DCCE013ED98091E800A7 +:100F40008E778093E8001DC0809127028132C9F41A +:100F50008091E800877F8093E800809129028D8747 +:100F6000CE01C8D90DC080912702813251F4809101 +:100F7000E800877F8093E800CE0160912902C5DEFA +:100F8000ECDADF91CF910895A1E21A2EAA1BBB1BC8 +:100F9000FD010DC0AA1FBB1FEE1FFF1FA217B30745 +:100FA000E407F50720F0A21BB30BE40BF50B661F5B +:100FB000771F881F991F1A9469F76095709580951F +:100FC00090959B01AC01BD01CF010895F894FFCF2E +:100FD0000003400000044000000208000000000080 +:060FE0000000000000000B +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial-uno.hex Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,256 @@ +:100000009CC00000B5C00000B3C00000B1C000003B +:10001000AFC00000ADC00000ABC00000A9C0000030 +:10002000A7C00000A5C00000A3C0000054C4000089 +:1000300018C400009DC000009BC0000099C00000D3 +:1000400097C0000095C0000093C0000091C0000060 +:100050008FC000008DC000008BC000000EC10000EA +:1000600087C0000085C0000083C0000081C0000080 +:100070007FC000007DC000007BC0000079C0000090 +:1000800077C0000075C0000073C0000071C00000A0 +:100090006FC000006DC000001201100102000008D6 +:1000A0004123010001000102DC0109023E000201BE +:1000B00000C0320904000001020201000524000111 +:1000C0001004240206052406000107058203080027 +:1000D000FF09040100020A000000070504024000B5 +:1000E00001070583024000010403090432034100B3 +:1000F00072006400750069006E006F002000280027 +:100100007700770077002E006100720064007500B0 +:1001100069006E006F002E0063006300290000007C +:100120001803410072006400750069006E006F00E2 +:10013000200055006E006F00000011241FBECFEF9D +:10014000D2E0DEBFCDBF11E0A0E0B1E0E4ECFFE023 +:1001500002C005900D92A631B107D9F712E0A6E1D1 +:10016000B1E001C01D92AF32B107E1F7F1D028C76D +:1001700047CF9C01DC01AE57BF4FED91FC91119729 +:1001800041911196FC93EE9380589F4FE817F90721 +:1001900011F42D933C939FB7F894F901EC57FF4F5E +:1001A0008081815080839FBF842F0895DF92EF92DA +:1001B000FF920F931F93FC018489813019F08230E4 +:1001C00021F405C040E3D42E04C0DD2402C030E297 +:1001D000D32E8389823011F488E0D82A858987302C +:1001E00031F0883031F0863031F482E003C084E0B1 +:1001F00001C086E0D82A1092C9001092C80010925F +:10020000CA00E784F0880189128980E0E81681EE4F +:10021000F80680E0080780E0180719F420E130E0D4 +:100220000FC0C801B7019695879577956795605877 +:100230007B47814E9F4FA8019701A0D621503040A7 +:100240003093CD002093CC00D092CA0080E0E81615 +:1002500081EEF80680E0080780E0180711F082E0E0 +:1002600001C080E08093C80088E98093C9001F9195 +:100270000F91FF90EF90DF9008951F920F920FB6AD +:100280000F9211242F938F939F93EF93FF9390914D +:10029000CE008EB38430F1F4E0919901F0919A018F +:1002A0009083E0919901F0919A01CF01019690938A +:1002B0009A01809399018959914021F489E191E053 +:1002C000928381839FB7F89480919D018F5F809383 +:1002D0009D019FBFFF91EF919F918F912F910F9063 +:1002E0000FBE0F901F901895FC01858580FF02C0FE +:1002F0005F9808955F9A089580E091E0D5C580E009 +:1003000091E088C584B7877F84BF28E10FB6F89451 +:1003100020936000109260000FBE87E690E09093FB +:10032000CD008093CC0086E08093CA001092C80074 +:100330002093C900539A5A9A8AB180638AB98BB1C3 +:1003400080638BB983D284E085BD5F9A579A089504 +:100350000F931F93CF93DF93D5DF2FB7F8948EE9D8 +:1003600091E090931F0280931E029093210280934C +:1003700020022FBF2FB7F89489E191E090939A0162 +:100380008093990190939C0180939B012FBF789457 +:10039000CEE9D1E003E08FB7F894909122028FBFAD +:1003A000903809F180E091E0ABD497FD1CC0E0915A +:1003B0001E02F0911F028083E0911E02F0911F0245 +:1003C000CF01019690931F0280931E028E5192409E +:1003D00011F4D283C1839FB7F894809122028F5F7A +:1003E000809322029FBF8FB7F89410919D018FBF19 +:1003F000A89902C0113678F1A89A80919D018823AE +:1004000061F05D980093160108C089E191E0B1DECA +:10041000682F80E091E0DAD411501123B1F7809178 +:100420001601882351F080911601815080931601A6 +:1004300080911601882309F45D9A80911701882321 +:1004400051F080911701815080931701809117011D +:10045000882309F45C9A8FB7F894909122028FBF99 +:10046000992369F08EE991E084DE982F8091C8008D +:1004700085FFFCCF9093CE005C980093170180E03D +:1004800091E095D42AD487CFDA01923049F09330A5 +:1004900061F09130F9F4E8E9F0E022E130E01EC0CB +:1004A000EAEAF0E02EE330E019C0813049F0813013 +:1004B00018F0823079F408C0E8EEF0E0849107C0CB +:1004C000ECEEF0E0849103C0E0E2F1E08491282FAB +:1004D00030E004C0E0E0F0E020E030E0ED93FC9399 +:1004E000C901089528E030E040E003C04F5F220FCB +:1004F000331F28173907D0F3842F8295807F089502 +:100500008093E9008091EB0081608093EB00109272 +:10051000ED006093EC004093ED008091EE00881FA9 +:100520008827881F08951092F40090E09093E900C6 +:100530001092F0001092E8001092ED008091EB0014 +:100540008E7F8093EB009F5F953081F708958091B7 +:10055000270288238CF403C08EB38823B1F08091E6 +:10056000E80082FFF9CF8091E8008B778093E80064 +:1005700008958EB3882349F08091E80080FFF9CF79 +:100580008091E8008E778093E800089594E680914A +:10059000EC0080FF05C08091E80080FF05C023C00B +:1005A0008091E80082FD1FC08EB3882311F482E0A1 +:1005B00008958EB3853011F483E008958091EB00A7 +:1005C00085FF02C081E008958091E10082FFDFCFC6 +:1005D0008091E1008B7F8093E100992311F484E006 +:1005E00008959150D4CF80E008959C0140912D0250 +:1005F00050912E024617570718F4F90120E038C031 +:100600006115710511F0AB01F8CF8091E8008E778C +:100610008093E80040E050E0F0CF8091E80083FF55 +:1006200002C081E008958091E80082FD2DC08EB364 +:10063000882381F18EB3853079F18091E80080FFC5 +:1006400017C09091F20006C081918093F100415053 +:1006500050409F5F4115510511F09830A8F320E0FC +:10066000983009F421E08091E8008E778093E800CB +:100670004115510591F6222381F606C08EB38823D9 +:1006800049F08EB3853041F08091E80082FFF6CFCB +:1006900080E0089582E0089583E008959C014091F0 +:1006A0002D0250912E024617570710F490E03BC0E0 +:1006B0006115710511F0AB01F9CF8091E8008E77DB +:1006C0008093E80040E050E0F1CF8091E80083FFA4 +:1006D00002C081E008958091E80082FD30C08EB3B1 +:1006E000882399F18EB3853091F18091E80080FFE5 +:1006F0001AC08091F20009C0F9012F5F3F4FE491C9 +:10070000E093F100415050408F5F4115510511F0C9 +:10071000883090F390E0883009F491E08091E8000F +:100720008E778093E8004115510579F6992369F693 +:1007300006C08EB3882349F08EB3853041F0809196 +:10074000E80082FFF6CF80E0089582E0089583E01C +:1007500008959C016115710529F48091E8008B775B +:100760008093E800F90120C08091E80083FF02C077 +:1007700081E008958EB3882339F18EB3853031F14D +:100780008091E80082FFF0CF06C08091F100819354 +:100790006150704021F08091F2008823B1F7809180 +:1007A000E8008B778093E80061157105E9F606C0D3 +:1007B0008EB3882349F08EB3853041F08091E800F4 +:1007C00080FFF6CF80E0089582E0089583E00895E9 +:1007D00042D044D01EBA10922502109224021092E8 +:1007E000230284E089BD89B5826089BD09B400FE19 +:1007F000FDCF8091D800982F9F779093D800806884 +:100800008093D800809163008E7F809363008091F5 +:10081000D8008F7D8093D8008091E0008E7F8093F8 +:10082000E0008091E1008E7F8093E1008091E20002 +:1008300081608093E2008091E100877F8093E100F6 +:100840008091E20088608093E2000895C1DF81E03A +:100850008093260208951092E20008951092E1001C +:1008600008951F920F920FB60F9211241F932F938A +:100870003F934F935F936F937F938F939F93AF9328 +:10088000BF93EF93FF93E9EEF0E0108117701082B1 +:10089000E0EFF0E08081877F80837894C3D0F89484 +:1008A000A9EEB0E01C92E0EFF0E0808188608083E8 +:1008B0001C93FF91EF91BF91AF919F918F917F9189 +:1008C0006F915F914F913F912F911F910F900FBEAC +:1008D0000F901F9018951F920F920FB60F92112430 +:1008E0002F933F934F935F936F937F938F939F9338 +:1008F000AF93BF93EF93FF938091E10080FF1BC004 +:100900008091E20080FF17C08091E1008E7F80938C +:10091000E1008091E2008E7F8093E2008091E2000E +:1009200080618093E2008091D80080628093D8003B +:1009300019BC1EBAD1D18091E10084FF29C08091F9 +:10094000E20084FF25C084E089BD89B5826089BD4D +:1009500009B400FEFDCF8091D8008F7D8093D80030 +:100960008091E1008F7E8093E1008091E2008F7E94 +:100970008093E2008091E20081608093E2008091A8 +:100980002502882311F481E001C084E08EBBA4D14C +:100990008091E10083FF27C08091E20083FF23C0A4 +:1009A0008091E100877F8093E10082E08EBB10920E +:1009B00025028091E1008E7F8093E1008091E2002A +:1009C0008E7F8093E2008091E20080618093E2005C +:1009D000AADD80E060E042E093DD8091F000886075 +:1009E0008093F00079D18091E10082FF0AC080916C +:1009F000E20082FF06C08091E1008B7F8093E100DE +:100A00006BD1FF91EF91BF91AF919F918F917F91AA +:100A10006F915F914F913F912F910F900FBE0F906B +:100A20001F9018951F93DF93CF93CDB7DEB7AC9788 +:100A30000FB6F894DEBF0FBECDBFE7E2F2E08091C3 +:100A4000F100819322E0EF32F207C9F7809127028B +:100A500030912802353009F487C0363040F4313007 +:100A6000C9F1313070F0333009F01DC133C0383076 +:100A700009F4EFC0393009F4FEC0363009F013C173 +:100A800092C0803821F0823809F00DC108C09091E1 +:100A9000230280912402882399F0926011C08091F2 +:100AA0002B0287708093E9008091EB0090E025E0B5 +:100AB000969587952A95E1F7982F91701092E90005 +:100AC0008091E800877F8093E8009093F100109276 +:100AD000F100CAC0882319F0823009F0E4C090E028 +:100AE0008F719070009721F0029709F0DDC00CC063 +:100AF00080912902813009F0D7C01092240233304E +:100B000069F5809324022AC080912902882331F557 +:100B100020912B02277009F4C7C02093E90080912F +:100B2000EB0080FFC1C0333021F48091EB00806284 +:100B300013C08091EB0080618093EB0081E090E036 +:100B400002C0880F991F2A95E2F78093EA0010925D +:100B5000EA008091EB0088608093EB001092E9003E +:100B60008091E800877F83C0882309F09CC01091A2 +:100B700029028091E800877F8093E800E8DC04C0C8 +:100B80008EB3882309F490C08091E80080FFF8CFED +:100B9000812F8F7711F492E001C093E09EBB8068B3 +:100BA0008093E30081C08058823008F07CC080913F +:100BB000290290912A0223E08C3D920799F55FB7B4 +:100BC000F894DE0115964EE020E030E061E2E42F7B +:100BD000F0E060935700849120FF03C082958F70EE +:100BE0004F5F982F9F70892F805D8A3308F0895F4F +:100BF0008C9311961C9211972F5F3F4F12962431C0 +:100C0000310529F75FBF8AE28B8383E08C83809173 +:100C1000E800877F8093E800CE0103966AE270E0E7 +:100C2000E4DC11C060912B02AE014F5F5F4F2CDC02 +:100C3000BC010097C9F18091E800877F8093E800AC +:100C400089819A812BDD8091E8008B778093E80081 +:100C50002BC0803841F58091E800877F8093E800C1 +:100C6000809125028093F1008091E8008E77809337 +:100C7000E8006DDC19C08823B1F49091290292300C +:100C800098F48091E800877F8093E8009093250294 +:100C90005EDC80912502882311F483E001C084E0AA +:100CA0008EBB2DDB01C028DB8091E80083FF0AC0EA +:100CB0008091EB0080628093EB008091E800877F59 +:100CC0008093E800AC960FB6F894DEBF0FBECDBFA0 +:100CD000CF91DF911F91089508951F938EB38823BC +:100CE00061F01091E9001092E9008091E80083FF23 +:100CF00001C098DE17701093E9001F9108950895C0 +:100D0000FC018EB3843021F587859089A189B28951 +:100D10000097A105B105E1F085818093E9008091FC +:100D2000E80082FF15C08091F200882319F42FEFAC +:100D30003FEF04C08091F100282F30E08091F20055 +:100D4000882341F48091E8008B778093E80002C00B +:100D50002FEF3FEFC9010895FC018EB3843011F5E8 +:100D600087859089A189B2890097A105B105D1F045 +:100D700081818093E9008091F2008823A9F090910D +:100D8000E8008091E8008E778093E80095FD0CC024 +:100D9000FDDB982F882349F48091E8008E778093BB +:100DA000E80003C092E001C090E0892F0895FC01A3 +:100DB0008EB3843051F487859089A189B2890097D8 +:100DC000A105B10511F0CF01C7CF08951F93FC0114 +:100DD000162F8EB38430D9F487859089A189B28982 +:100DE0000097A105B10599F081818093E900809178 +:100DF000E80085FD08C08091E8008E778093E800C8 +:100E0000C5DB882329F41093F10080E001C082E063 +:100E10001F9108950F931F93CF93DF93EC010D96CD +:100E2000FC0189E0DF011D928A95E9F72A813B8167 +:100E300009818C81882311F410E001C014E0C901FC +:100E400051DB182B1260802F61E8412F59DB88237A +:100E500029F12E813F810D818885882311F410E0CE +:100E600001C014E0C9013EDB182B1260802F60E83E +:100E7000412F46DB882391F02A853B8509858C85A7 +:100E8000882311F410E001C014E0C9012BDB182BFA +:100E90001260802F61EC412F33DB01C080E0DF91D5 +:100EA000CF911F910F910895CF93DF93EC01809123 +:100EB000E80083FF60C0888190E020912B02309190 +:100EC0002C022817390709F056C080912802813278 +:100ED00061F0823220F4803209F04DC019C08232B4 +:100EE00069F1833209F047C038C080912702813A06 +:100EF00009F041C08091E800877F8093E800CE012F +:100F00000F9667E070E071DB8091E8008B7713C08B +:100F100080912702813279F58091E800877F809364 +:100F2000E800CE010F9667E070E013DCCE013ED9F9 +:100F30008091E8008E778093E8001DC080912702A1 +:100F40008132C9F48091E800877F8093E800809126 +:100F500029028D87CE01C8D90DC080912702813228 +:100F600051F48091E800877F8093E800CE01609182 +:100F70002902C5DEECDADF91CF910895A1E21A2EA5 +:100F8000AA1BBB1BFD010DC0AA1FBB1FEE1FFF1F2D +:100F9000A217B307E407F50720F0A21BB30BE40B7D +:100FA000F50B661F771F881F991F1A9469F76095C4 +:100FB0007095809590959B01AC01BD01CF0108957E +:040FC000F894FFCFD3 +:100FC400000340000004400000020800000000008C +:060FD40000000000000017 +:00000001FF
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,242 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Main source file for the Arduino-usbserial project. This file contains the main tasks of + * the project and is responsible for the initial application hardware configuration. + */ + +#include "Arduino-usbserial.h" + +/** Circular buffer to hold data from the host before it is sent to the device via the serial port. */ +RingBuff_t USBtoUSART_Buffer; + +/** Circular buffer to hold data from the serial port before it is sent to the host. */ +RingBuff_t USARTtoUSB_Buffer; + +/** Pulse generation counters to keep track of the number of milliseconds remaining for each pulse type */ +volatile struct +{ + uint8_t TxLEDPulse; /**< Milliseconds remaining for data Tx LED pulse */ + uint8_t RxLEDPulse; /**< Milliseconds remaining for data Rx LED pulse */ + uint8_t PingPongLEDPulse; /**< Milliseconds remaining for enumeration Tx/Rx ping-pong LED pulse */ +} PulseMSRemaining; + +/** LUFA CDC Class driver interface configuration and state information. This structure is + * passed to all CDC Class driver functions, so that multiple instances of the same class + * within a device can be differentiated from one another. + */ +USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface = + { + .Config = + { + .ControlInterfaceNumber = 0, + + .DataINEndpointNumber = CDC_TX_EPNUM, + .DataINEndpointSize = CDC_TXRX_EPSIZE, + .DataINEndpointDoubleBank = false, + + .DataOUTEndpointNumber = CDC_RX_EPNUM, + .DataOUTEndpointSize = CDC_TXRX_EPSIZE, + .DataOUTEndpointDoubleBank = false, + + .NotificationEndpointNumber = CDC_NOTIFICATION_EPNUM, + .NotificationEndpointSize = CDC_NOTIFICATION_EPSIZE, + .NotificationEndpointDoubleBank = false, + }, + }; + +/** Main program entry point. This routine contains the overall program flow, including initial + * setup of all components and the main program loop. + */ +int main(void) +{ + SetupHardware(); + + RingBuffer_InitBuffer(&USBtoUSART_Buffer); + RingBuffer_InitBuffer(&USARTtoUSB_Buffer); + + sei(); + + for (;;) + { + /* Only try to read in bytes from the CDC interface if the transmit buffer is not full */ + if (!(RingBuffer_IsFull(&USBtoUSART_Buffer))) + { + int16_t ReceivedByte = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface); + + /* Read bytes from the USB OUT endpoint into the USART transmit buffer */ + if (!(ReceivedByte < 0)) + RingBuffer_Insert(&USBtoUSART_Buffer, ReceivedByte); + } + + /* Check if the UART receive buffer flush timer has expired or the buffer is nearly full */ + RingBuff_Count_t BufferCount = RingBuffer_GetCount(&USARTtoUSB_Buffer); + if ((TIFR0 & (1 << TOV0)) || (BufferCount > BUFFER_NEARLY_FULL)) + { + TIFR0 |= (1 << TOV0); + + if (USARTtoUSB_Buffer.Count) { + LEDs_TurnOnLEDs(LEDMASK_TX); + PulseMSRemaining.TxLEDPulse = TX_RX_LED_PULSE_MS; + } + + /* Read bytes from the USART receive buffer into the USB IN endpoint */ + while (BufferCount--) + CDC_Device_SendByte(&VirtualSerial_CDC_Interface, RingBuffer_Remove(&USARTtoUSB_Buffer)); + + /* Turn off TX LED(s) once the TX pulse period has elapsed */ + if (PulseMSRemaining.TxLEDPulse && !(--PulseMSRemaining.TxLEDPulse)) + LEDs_TurnOffLEDs(LEDMASK_TX); + + /* Turn off RX LED(s) once the RX pulse period has elapsed */ + if (PulseMSRemaining.RxLEDPulse && !(--PulseMSRemaining.RxLEDPulse)) + LEDs_TurnOffLEDs(LEDMASK_RX); + } + + /* Load the next byte from the USART transmit buffer into the USART */ + if (!(RingBuffer_IsEmpty(&USBtoUSART_Buffer))) { + Serial_TxByte(RingBuffer_Remove(&USBtoUSART_Buffer)); + + LEDs_TurnOnLEDs(LEDMASK_RX); + PulseMSRemaining.RxLEDPulse = TX_RX_LED_PULSE_MS; + } + + CDC_Device_USBTask(&VirtualSerial_CDC_Interface); + USB_USBTask(); + } +} + +/** Configures the board hardware and chip peripherals for the demo's functionality. */ +void SetupHardware(void) +{ + /* Disable watchdog if enabled by bootloader/fuses */ + MCUSR &= ~(1 << WDRF); + wdt_disable(); + + /* Hardware Initialization */ + Serial_Init(9600, false); + LEDs_Init(); + USB_Init(); + + /* Start the flush timer so that overflows occur rapidly to push received bytes to the USB interface */ + TCCR0B = (1 << CS02); + + /* Pull target /RESET line high */ + AVR_RESET_LINE_PORT |= AVR_RESET_LINE_MASK; + AVR_RESET_LINE_DDR |= AVR_RESET_LINE_MASK; +} + +/** Event handler for the library USB Configuration Changed event. */ +void EVENT_USB_Device_ConfigurationChanged(void) +{ + CDC_Device_ConfigureEndpoints(&VirtualSerial_CDC_Interface); +} + +/** Event handler for the library USB Unhandled Control Request event. */ +void EVENT_USB_Device_UnhandledControlRequest(void) +{ + CDC_Device_ProcessControlRequest(&VirtualSerial_CDC_Interface); +} + +/** Event handler for the CDC Class driver Line Encoding Changed event. + * + * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced + */ +void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + uint8_t ConfigMask = 0; + + switch (CDCInterfaceInfo->State.LineEncoding.ParityType) + { + case CDC_PARITY_Odd: + ConfigMask = ((1 << UPM11) | (1 << UPM10)); + break; + case CDC_PARITY_Even: + ConfigMask = (1 << UPM11); + break; + } + + if (CDCInterfaceInfo->State.LineEncoding.CharFormat == CDC_LINEENCODING_TwoStopBits) + ConfigMask |= (1 << USBS1); + + switch (CDCInterfaceInfo->State.LineEncoding.DataBits) + { + case 6: + ConfigMask |= (1 << UCSZ10); + break; + case 7: + ConfigMask |= (1 << UCSZ11); + break; + case 8: + ConfigMask |= ((1 << UCSZ11) | (1 << UCSZ10)); + break; + } + + /* Must turn off USART before reconfiguring it, otherwise incorrect operation may occur */ + UCSR1B = 0; + UCSR1A = 0; + UCSR1C = 0; + + /* Special case 57600 baud for compatibility with the ATmega328 bootloader. */ + UBRR1 = (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 57600) + ? SERIAL_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS) + : SERIAL_2X_UBBRVAL(CDCInterfaceInfo->State.LineEncoding.BaudRateBPS); + + UCSR1C = ConfigMask; + UCSR1A = (CDCInterfaceInfo->State.LineEncoding.BaudRateBPS == 57600) ? 0 : (1 << U2X1); + UCSR1B = ((1 << RXCIE1) | (1 << TXEN1) | (1 << RXEN1)); +} + +/** ISR to manage the reception of data from the serial port, placing received bytes into a circular buffer + * for later transmission to the host. + */ +ISR(USART1_RX_vect, ISR_BLOCK) +{ + uint8_t ReceivedByte = UDR1; + + if (USB_DeviceState == DEVICE_STATE_Configured) + RingBuffer_Insert(&USARTtoUSB_Buffer, ReceivedByte); +} + +/** Event handler for the CDC Class driver Host-to-Device Line Encoding Changed event. + * + * \param[in] CDCInterfaceInfo Pointer to the CDC class interface configuration structure being referenced + */ +void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo) +{ + bool CurrentDTRState = (CDCInterfaceInfo->State.ControlLineStates.HostToDevice & CDC_CONTROL_LINE_OUT_DTR); + + if (CurrentDTRState) + AVR_RESET_LINE_PORT &= ~AVR_RESET_LINE_MASK; + else + AVR_RESET_LINE_PORT |= AVR_RESET_LINE_MASK; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Arduino-usbserial.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,79 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Header file for Arduino-usbserial.c. + */ + +#ifndef _ARDUINO_USBSERIAL_H_ +#define _ARDUINO_USBSERIAL_H_ + + /* Includes: */ + #include <avr/io.h> + #include <avr/wdt.h> + #include <avr/interrupt.h> + #include <avr/power.h> + + #include "Descriptors.h" + + #include "Lib/LightweightRingBuff.h" + + #include <LUFA/Version.h> + #include <LUFA/Drivers/Board/LEDs.h> + #include <LUFA/Drivers/Peripheral/Serial.h> + #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Drivers/USB/Class/CDC.h> + + /* Macros: */ + /** LED mask for the library LED driver, to indicate TX activity. */ + #define LEDMASK_TX LEDS_LED1 + + /** LED mask for the library LED driver, to indicate RX activity. */ + #define LEDMASK_RX LEDS_LED2 + + /** LED mask for the library LED driver, to indicate that an error has occurred in the USB interface. */ + #define LEDMASK_ERROR (LEDS_LED1 | LEDS_LED2) + + /** LED mask for the library LED driver, to indicate that the USB interface is busy. */ + #define LEDMASK_BUSY (LEDS_LED1 | LEDS_LED2) + + /* Function Prototypes: */ + void SetupHardware(void); + + void EVENT_USB_Device_Connect(void); + void EVENT_USB_Device_Disconnect(void); + void EVENT_USB_Device_ConfigurationChanged(void); + void EVENT_USB_Device_UnhandledControlRequest(void); + + void EVENT_CDC_Device_LineEncodingChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); + void EVENT_CDC_Device_ControLineStateChanged(USB_ClassInfo_CDC_Device_t* const CDCInterfaceInfo); + +#endif /* _ARDUINO_USBSERIAL_H_ */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Board/LEDs.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,110 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/* + Board LEDs driver for the Benito board, from www.dorkbotpdx.org. +*/ + +#ifndef __LEDS_ARDUINOUNO_H__ +#define __LEDS_ARDUINOUNO_H__ + + /* Includes: */ + #include <avr/io.h> + +/* Enable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + extern "C" { + #endif + + /* Preprocessor Checks: */ + #if !defined(INCLUDE_FROM_LEDS_H) + #error Do not include this file directly. Include LUFA/Drivers/Board/LEDS.h instead. + #endif + + /* Public Interface - May be used in end-application: */ + /* Macros: */ + /** LED mask for the first LED on the board. */ + #define LEDS_LED1 (1 << 5) + + /** LED mask for the second LED on the board. */ + #define LEDS_LED2 (1 << 4) + + /** LED mask for all the LEDs on the board. */ + #define LEDS_ALL_LEDS (LEDS_LED1 | LEDS_LED2) + + /** LED mask for the none of the board LEDs */ + #define LEDS_NO_LEDS 0 + + /* Inline Functions: */ + #if !defined(__DOXYGEN__) + static inline void LEDs_Init(void) + { + DDRD |= LEDS_ALL_LEDS; + PORTD |= LEDS_ALL_LEDS; + } + + static inline void LEDs_TurnOnLEDs(const uint8_t LEDMask) + { + PORTD &= ~LEDMask; + } + + static inline void LEDs_TurnOffLEDs(const uint8_t LEDMask) + { + PORTD |= LEDMask; + } + + static inline void LEDs_SetAllLEDs(const uint8_t LEDMask) + { + PORTD = ((PORTD | LEDS_ALL_LEDS) & ~LEDMask); + } + + static inline void LEDs_ChangeLEDs(const uint8_t LEDMask, const uint8_t ActiveMask) + { + PORTD = ((PORTD | ActiveMask) & ~LEDMask); + } + + static inline void LEDs_ToggleLEDs(const uint8_t LEDMask) + { + PORTD ^= LEDMask; + } + + static inline uint8_t LEDs_GetLEDs(void) ATTR_WARN_UNUSED_RESULT; + static inline uint8_t LEDs_GetLEDs(void) + { + return (PORTD & LEDS_ALL_LEDS); + } + #endif + + /* Disable C linkage for C++ Compilers: */ + #if defined(__cplusplus) + } + #endif + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Descriptors.c Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,277 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * USB Device Descriptors, for library use when in USB device mode. Descriptors are special + * computer-readable structures which the host requests upon device enumeration, to determine + * the device's capabilities and functions. + */ + +#include "Descriptors.h" + +/* On some devices, there is a factory set internal serial number which can be automatically sent to the host as + * the device's serial number when the Device Descriptor's .SerialNumStrIndex entry is set to USE_INTERNAL_SERIAL. + * This allows the host to track a device across insertions on different ports, allowing them to retain allocated + * resources like COM port numbers and drivers. On demos using this feature, give a warning on unsupported devices + * so that the user can supply their own serial number descriptor instead or remove the USE_INTERNAL_SERIAL value + * from the Device Descriptor (forcing the host to generate a serial number for each device from the VID, PID and + * port location). + */ +#if (USE_INTERNAL_SERIAL == NO_DESCRIPTOR) + #warning USE_INTERNAL_SERIAL is not available on this AVR - please manually construct a device serial descriptor. +#endif + +/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall + * device characteristics, including the supported USB version, control endpoint size and the + * number of device configurations. The descriptor is read out by the USB host when the enumeration + * process begins. + */ +USB_Descriptor_Device_t PROGMEM DeviceDescriptor = +{ + .Header = {.Size = sizeof(USB_Descriptor_Device_t), .Type = DTYPE_Device}, + + .USBSpecification = VERSION_BCD(01.10), + .Class = 0x02, + .SubClass = 0x00, + .Protocol = 0x00, + + .Endpoint0Size = FIXED_CONTROL_ENDPOINT_SIZE, + + .VendorID = 0x03EB, // Atmel + + .ProductID = 0x204B, // LUFA USB to Serial Demo Application + .ReleaseNumber = 0x0001, + + .ManufacturerStrIndex = 0x01, + .ProductStrIndex = 0x02, + .SerialNumStrIndex = USE_INTERNAL_SERIAL, + + .NumberOfConfigurations = FIXED_NUM_CONFIGURATIONS +}; + +/** Configuration descriptor structure. This descriptor, located in FLASH memory, describes the usage + * of the device in one of its supported configurations, including information about any device interfaces + * and endpoints. The descriptor is read out by the USB host during the enumeration process when selecting + * a configuration so that the host may correctly communicate with the USB device. + */ +USB_Descriptor_Configuration_t PROGMEM ConfigurationDescriptor = +{ + .Config = + { + .Header = {.Size = sizeof(USB_Descriptor_Configuration_Header_t), .Type = DTYPE_Configuration}, + + .TotalConfigurationSize = sizeof(USB_Descriptor_Configuration_t), + .TotalInterfaces = 2, + + .ConfigurationNumber = 1, + .ConfigurationStrIndex = NO_DESCRIPTOR, + + .ConfigAttributes = (USB_CONFIG_ATTR_BUSPOWERED | USB_CONFIG_ATTR_SELFPOWERED), + + .MaxPowerConsumption = USB_CONFIG_POWER_MA(100) + }, + + .CDC_CCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 0, + .AlternateSetting = 0, + + .TotalEndpoints = 1, + + .Class = 0x02, + .SubClass = 0x02, + .Protocol = 0x01, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_Functional_IntHeader = + { + .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24}, + .SubType = 0x00, + + .Data = {0x01, 0x10} + }, + + .CDC_Functional_AbstractControlManagement = + { + .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(1)), .Type = 0x24}, + .SubType = 0x02, + + .Data = {0x06} + }, + + .CDC_Functional_Union = + { + .Header = {.Size = sizeof(CDC_FUNCTIONAL_DESCRIPTOR(2)), .Type = 0x24}, + .SubType = 0x06, + + .Data = {0x00, 0x01} + }, + + .CDC_NotificationEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_NOTIFICATION_EPNUM), + .Attributes = (EP_TYPE_INTERRUPT | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_NOTIFICATION_EPSIZE, + .PollingIntervalMS = 0xFF + }, + + .CDC_DCI_Interface = + { + .Header = {.Size = sizeof(USB_Descriptor_Interface_t), .Type = DTYPE_Interface}, + + .InterfaceNumber = 1, + .AlternateSetting = 0, + + .TotalEndpoints = 2, + + .Class = 0x0A, + .SubClass = 0x00, + .Protocol = 0x00, + + .InterfaceStrIndex = NO_DESCRIPTOR + }, + + .CDC_DataOutEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_OUT | CDC_RX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + }, + + .CDC_DataInEndpoint = + { + .Header = {.Size = sizeof(USB_Descriptor_Endpoint_t), .Type = DTYPE_Endpoint}, + + .EndpointAddress = (ENDPOINT_DESCRIPTOR_DIR_IN | CDC_TX_EPNUM), + .Attributes = (EP_TYPE_BULK | ENDPOINT_ATTR_NO_SYNC | ENDPOINT_USAGE_DATA), + .EndpointSize = CDC_TXRX_EPSIZE, + .PollingIntervalMS = 0x01 + } +}; + +/** Language descriptor structure. This descriptor, located in FLASH memory, is returned when the host requests + * the string descriptor with index 0 (the first index). It is actually an array of 16-bit integers, which indicate + * via the language ID table available at USB.org what languages the device supports for its string descriptors. + */ +USB_Descriptor_String_t PROGMEM LanguageString = +{ + .Header = {.Size = USB_STRING_LEN(1), .Type = DTYPE_String}, + + .UnicodeString = {LANGUAGE_ID_ENG} +}; + +/** Manufacturer descriptor string. This is a Unicode string containing the manufacturer's details in human readable + * form, and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +USB_Descriptor_String_t PROGMEM ManufacturerString = +{ + .Header = {.Size = USB_STRING_LEN(24), .Type = DTYPE_String}, + + .UnicodeString = L"Arduino (www.arduino.cc)" +}; + +/** Product descriptor string. This is a Unicode string containing the product's details in human readable form, + * and is read out upon request by the host when the appropriate string ID is requested, listed in the Device + * Descriptor. + */ +USB_Descriptor_String_t PROGMEM ProductString = +{ + #if (ARDUINO_MODEL_PID == ARDUINO_UNO_PID) + .Header = {.Size = USB_STRING_LEN(11), .Type = DTYPE_String}, + + .UnicodeString = L"Arduino Uno" + #elif (ARDUINO_MODEL_PID == ARDUINO_MEGA2560_PID) + .Header = {.Size = USB_STRING_LEN(17), .Type = DTYPE_String}, + + .UnicodeString = L"Arduino Mega 2560" + #endif + +}; + +/** This function is called by the library when in device mode, and must be overridden (see library "USB Descriptors" + * documentation) by the application code so that the address and size of a requested descriptor can be given + * to the USB library. When the device receives a Get Descriptor request on the control endpoint, this function + * is called so that the descriptor details can be passed back and the appropriate descriptor sent back to the + * USB host. + */ +uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + void** const DescriptorAddress) +{ + const uint8_t DescriptorType = (wValue >> 8); + const uint8_t DescriptorNumber = (wValue & 0xFF); + + void* Address = NULL; + uint16_t Size = NO_DESCRIPTOR; + + switch (DescriptorType) + { + case DTYPE_Device: + Address = (void*)&DeviceDescriptor; + Size = sizeof(USB_Descriptor_Device_t); + break; + case DTYPE_Configuration: + Address = (void*)&ConfigurationDescriptor; + Size = sizeof(USB_Descriptor_Configuration_t); + break; + case DTYPE_String: + switch (DescriptorNumber) + { + case 0x00: + Address = (void*)&LanguageString; + Size = pgm_read_byte(&LanguageString.Header.Size); + break; + case 0x01: + Address = (void*)&ManufacturerString; + Size = pgm_read_byte(&ManufacturerString.Header.Size); + break; + case 0x02: + Address = (void*)&ProductString; + Size = pgm_read_byte(&ProductString.Header.Size); + break; + } + + break; + } + + *DescriptorAddress = Address; + return Size; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Descriptors.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,88 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Header file for Descriptors.c. + */ + +#ifndef _DESCRIPTORS_H_ +#define _DESCRIPTORS_H_ + + /* Includes: */ + #include <avr/pgmspace.h> + + #include <LUFA/Drivers/USB/USB.h> + #include <LUFA/Drivers/USB/Class/CDC.h> + + /* Product-specific definitions: */ + #define ARDUINO_UNO_PID 0x0001 + #define ARDUINO_MEGA2560_PID 0x0010 + + /* Macros: */ + /** Endpoint number of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPNUM 2 + + /** Endpoint number of the CDC device-to-host data IN endpoint. */ + #define CDC_TX_EPNUM 3 + + /** Endpoint number of the CDC host-to-device data OUT endpoint. */ + #define CDC_RX_EPNUM 4 + + /** Size in bytes of the CDC device-to-host notification IN endpoint. */ + #define CDC_NOTIFICATION_EPSIZE 8 + + /** Size in bytes of the CDC data IN and OUT endpoints. */ + #define CDC_TXRX_EPSIZE 64 + + /* Type Defines: */ + /** Type define for the device configuration descriptor structure. This must be defined in the + * application code, as the configuration descriptor contains several sub-descriptors which + * vary between devices, and which describe the device's usage to the host. + */ + typedef struct + { + USB_Descriptor_Configuration_Header_t Config; + USB_Descriptor_Interface_t CDC_CCI_Interface; + CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_IntHeader; + CDC_FUNCTIONAL_DESCRIPTOR(1) CDC_Functional_AbstractControlManagement; + CDC_FUNCTIONAL_DESCRIPTOR(2) CDC_Functional_Union; + USB_Descriptor_Endpoint_t CDC_NotificationEndpoint; + USB_Descriptor_Interface_t CDC_DCI_Interface; + USB_Descriptor_Endpoint_t CDC_DataOutEndpoint; + USB_Descriptor_Endpoint_t CDC_DataInEndpoint; + } USB_Descriptor_Configuration_t; + + /* Function Prototypes: */ + uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, + const uint8_t wIndex, + void** const DescriptorAddress) ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3); + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/Lib/LightweightRingBuff.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,197 @@ +/* + LUFA Library + Copyright (C) Dean Camera, 2010. + + dean [at] fourwalledcubicle [dot] com + www.fourwalledcubicle.com +*/ + +/* + Copyright 2010 Dean Camera (dean [at] fourwalledcubicle [dot] com) + + Permission to use, copy, modify, distribute, and sell this + software and its documentation for any purpose is hereby granted + without fee, provided that the above copyright notice appear in + all copies and that both that the copyright notice and this + permission notice and warranty disclaimer appear in supporting + documentation, and that the name of the author not be used in + advertising or publicity pertaining to distribution of the + software without specific, written prior permission. + + The author disclaim 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, 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. +*/ + +/** \file + * + * Ultra lightweight ring buffer, for fast insertion/deletion. + */ + +#ifndef _ULW_RING_BUFF_H_ +#define _ULW_RING_BUFF_H_ + + /* Includes: */ + #include <util/atomic.h> + + #include <stdint.h> + #include <stdbool.h> + + /* Defines: */ + /** Size of each ring buffer, in data elements - must be between 1 and 255. */ + #define BUFFER_SIZE 128 + + /** Maximum number of data elements to buffer before forcing a flush. + * Must be less than BUFFER_SIZE + */ + #define BUFFER_NEARLY_FULL 96 + + /** Type of data to store into the buffer. */ + #define RingBuff_Data_t uint8_t + + /** Datatype which may be used to store the count of data stored in a buffer, retrieved + * via a call to \ref RingBuffer_GetCount(). + */ + #if (BUFFER_SIZE <= 0xFF) + #define RingBuff_Count_t uint8_t + #else + #define RingBuff_Count_t uint16_t + #endif + + /* Type Defines: */ + /** Type define for a new ring buffer object. Buffers should be initialized via a call to + * \ref RingBuffer_InitBuffer() before use. + */ + typedef struct + { + RingBuff_Data_t Buffer[BUFFER_SIZE]; /**< Internal ring buffer data, referenced by the buffer pointers. */ + RingBuff_Data_t* In; /**< Current storage location in the circular buffer */ + RingBuff_Data_t* Out; /**< Current retrieval location in the circular buffer */ + RingBuff_Count_t Count; + } RingBuff_t; + + /* Inline Functions: */ + /** Initializes a ring buffer ready for use. Buffers must be initialized via this function + * before any operations are called upon them. Already initialized buffers may be reset + * by re-initializing them using this function. + * + * \param[out] Buffer Pointer to a ring buffer structure to initialize + */ + static inline void RingBuffer_InitBuffer(RingBuff_t* const Buffer) + { + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->In = Buffer->Buffer; + Buffer->Out = Buffer->Buffer; + } + } + + /** Retrieves the minimum number of bytes stored in a particular buffer. This value is computed + * by entering an atomic lock on the buffer while the IN and OUT locations are fetched, so that + * the buffer cannot be modified while the computation takes place. This value should be cached + * when reading out the contents of the buffer, so that as small a time as possible is spent + * in an atomic lock. + * + * \note The value returned by this function is guaranteed to only be the minimum number of bytes + * stored in the given buffer; this value may change as other threads write new data and so + * the returned number should be used only to determine how many successive reads may safely + * be performed on the buffer. + * + * \param[in] Buffer Pointer to a ring buffer structure whose count is to be computed + */ + static inline RingBuff_Count_t RingBuffer_GetCount(RingBuff_t* const Buffer) + { + RingBuff_Count_t Count; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Count = Buffer->Count; + } + + return Count; + } + + /** Atomically determines if the specified ring buffer contains any free space. This should + * be tested before storing data to the buffer, to ensure that no data is lost due to a + * buffer overrun. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * + * \return Boolean true if the buffer contains no free space, false otherwise + */ + static inline bool RingBuffer_IsFull(RingBuff_t* const Buffer) + { + return (RingBuffer_GetCount(Buffer) == BUFFER_SIZE); + } + + /** Atomically determines if the specified ring buffer contains any data. This should + * be tested before removing data from the buffer, to ensure that the buffer does not + * underflow. + * + * If the data is to be removed in a loop, store the total number of bytes stored in the + * buffer (via a call to the \ref RingBuffer_GetCount() function) in a temporary variable + * to reduce the time spent in atomicity locks. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * + * \return Boolean true if the buffer contains no free space, false otherwise + */ + static inline bool RingBuffer_IsEmpty(RingBuff_t* const Buffer) + { + return (RingBuffer_GetCount(Buffer) == 0); + } + + /** Inserts an element into the ring buffer. + * + * \note Only one execution thread (main program thread or an ISR) may insert into a single buffer + * otherwise data corruption may occur. Insertion and removal may occur from different execution + * threads. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to insert into + * \param[in] Data Data element to insert into the buffer + */ + static inline void RingBuffer_Insert(RingBuff_t* const Buffer, + const RingBuff_Data_t Data) + { + *Buffer->In = Data; + + if (++Buffer->In == &Buffer->Buffer[BUFFER_SIZE]) + Buffer->In = Buffer->Buffer; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->Count++; + } + } + + /** Removes an element from the ring buffer. + * + * \note Only one execution thread (main program thread or an ISR) may remove from a single buffer + * otherwise data corruption may occur. Insertion and removal may occur from different execution + * threads. + * + * \param[in,out] Buffer Pointer to a ring buffer structure to retrieve from + * + * \return Next data element stored in the buffer + */ + static inline RingBuff_Data_t RingBuffer_Remove(RingBuff_t* const Buffer) + { + RingBuff_Data_t Data = *Buffer->Out; + + if (++Buffer->Out == &Buffer->Buffer[BUFFER_SIZE]) + Buffer->Out = Buffer->Buffer; + + ATOMIC_BLOCK(ATOMIC_RESTORESTATE) + { + Buffer->Count--; + } + + return Data; + } + +#endif
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/makefile Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,776 @@ +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# >> Modified for use with the LUFA project. << +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# Carlos Lamas +# Dean Camera +# Opendous Inc. +# Denver Gingerich +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). +# +# make doxygen = Generate DoxyGen documentation for the project (must have +# DoxyGen installed) +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + +# MCU name(s) +# Since the ATMEGA8U2 part is not directly supported by the current +# versions of either avrdude or dfu-programmer, we specify a dummy +# part; AT90USB82 which is close enough in memory size and organization +MCU = atmega8u2 +MCU_AVRDUDE = at90usb82 +MCU_DFU = at90usb82 + +# Specify the Arduino model using the assigned PID. This is used by Descriptors.c +# to set PID and product descriptor string +# Uno PID: +ARDUINO_MODEL_PID = 0x0001 +# Mega 2560 PID: +#ARDUINO_MODEL_PID = 0x0010 + + +# Target board (see library "Board Types" documentation, NONE for projects not requiring +# LUFA board drivers). If USER is selected, put custom board drivers in a directory called +# "Board" inside the application directory. +BOARD = USER + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency in Hz. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +# +# This will be an integer division of F_CLOCK below, as it is sourced by +# F_CLOCK after it has run through any CPU prescalers. Note that this value +# does not *change* the processor frequency - it should merely be updated to +# reflect the processor speed set externally so that the code can use accurate +# software delays. +F_CPU = 16000000 + + +# Input clock frequency. +# This will define a symbol, F_CLOCK, in all source code files equal to the +# input clock frequency (before any prescaling is performed) in Hz. This value may +# differ from F_CPU if prescaling is used on the latter, and is required as the +# raw input clock is fed directly to the PLL sections of the AVR for high speed +# clock generation for the USB and other AVR subsections. Do NOT tack on a 'UL' +# at the end, this will be done automatically to create a 32-bit value in your +# source code. +# +# If no clock division is performed on the input clock inside the AVR (via the +# CPU clock adjust registers or the clock division fuses), this will be equal to F_CPU. +F_CLOCK = $(F_CPU) + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Target file name (without extension). +TARGET = Arduino-usbserial + + +# Object files directory +# To put object files in current directory, use a dot (.), do NOT make +# this an empty or blank macro! +OBJDIR = . + + +# Path to the LUFA library +LUFA_PATH = ../.. + + +# LUFA library compile-time options +LUFA_OPTS = -D USB_DEVICE_ONLY +LUFA_OPTS += -D FIXED_CONTROL_ENDPOINT_SIZE=8 +LUFA_OPTS += -D FIXED_NUM_CONFIGURATIONS=1 +LUFA_OPTS += -D USE_FLASH_DESCRIPTORS +LUFA_OPTS += -D INTERRUPT_CONTROL_ENDPOINT +LUFA_OPTS += -D DEVICE_STATE_AS_GPIOR=0 +LUFA_OPTS += -D USE_STATIC_OPTIONS="(USB_DEVICE_OPT_FULLSPEED | USB_OPT_REG_ENABLED | USB_OPT_AUTO_PLL)" + + +# Create the LUFA source path variables by including the LUFA root makefile +include $(LUFA_PATH)/LUFA/makefile + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c \ + Descriptors.c \ + $(LUFA_SRC_USB) \ + $(LUFA_SRC_USBCLASS) \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Device.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Endpoint.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/HostStandardReq.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Host.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/Pipe.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBController.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/Events.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/LowLevel/USBInterrupt.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/USBTask.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/DeviceStandardReq.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/HighLevel/ConfigDescriptor.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/Class/Device/CDC.c \ + $(LUFA_PATH)/LUFA/Drivers/USB/Class/Host/CDC.c + + +# List C++ source files here. (C dependencies are automatically generated.) +CPPSRC = + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = $(LUFA_PATH)/ + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=gnu99 + + +# Place -D or -U options here for C sources +CDEFS = -DF_CPU=$(F_CPU)UL +CDEFS += -DF_CLOCK=$(F_CLOCK)UL +CDEFS += -DARDUINO_MODEL_PID=$(ARDUINO_MODEL_PID) +CDEFS += -DBOARD=BOARD_$(BOARD) +CDEFS += $(LUFA_OPTS) +CDEFS += -DAVR_RESET_LINE_PORT="PORTD" +CDEFS += -DAVR_RESET_LINE_DDR="DDRD" +CDEFS += -DAVR_RESET_LINE_MASK="(1 << 7)" +CDEFS += -DTX_RX_LED_PULSE_MS=3 +CDEFS += -DPING_PONG_LED_PULSE_MS=100 + +# Place -D or -U options here for ASM sources +ADEFS = -DF_CPU=$(F_CPU) +ADEFS += -DF_CLOCK=$(F_CLOCK)UL +ADEFS += -DBOARD=BOARD_$(BOARD) +ADEFS += $(LUFA_OPTS) + +# Place -D or -U options here for C++ sources +CPPDEFS = -DF_CPU=$(F_CPU)UL +CPPDEFS += -DF_CLOCK=$(F_CLOCK)UL +CPPDEFS += -DBOARD=BOARD_$(BOARD) +CPPDEFS += $(LUFA_OPTS) +#CPPDEFS += -D__STDC_LIMIT_MACROS +#CPPDEFS += -D__STDC_CONSTANT_MACROS + + + +#---------------- Compiler Options C ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char +CFLAGS += -funsigned-bitfields +CFLAGS += -ffunction-sections +CFLAGS += -fno-inline-small-functions +CFLAGS += -fpack-struct +CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing +CFLAGS += -Wall +CFLAGS += -Wstrict-prototypes +#CFLAGS += -mshort-calls +#CFLAGS += -fno-unit-at-a-time +#CFLAGS += -Wundef +#CFLAGS += -Wunreachable-code +#CFLAGS += -Wsign-compare +CFLAGS += -Wa,-adhlns=$(<:%.c=$(OBJDIR)/%.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + + +#---------------- Compiler Options C++ ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CPPFLAGS = -g$(DEBUG) +CPPFLAGS += $(CPPDEFS) +CPPFLAGS += -O$(OPT) +CPPFLAGS += -funsigned-char +CPPFLAGS += -funsigned-bitfields +CPPFLAGS += -fpack-struct +CPPFLAGS += -fshort-enums +CPPFLAGS += -fno-exceptions +CPPFLAGS += -Wall +CPPFLAGS += -Wundef +CFLAGS += -Wundef +#CPPFLAGS += -mshort-calls +#CPPFLAGS += -fno-unit-at-a-time +#CPPFLAGS += -Wstrict-prototypes +#CPPFLAGS += -Wunreachable-code +#CPPFLAGS += -Wsign-compare +CPPFLAGS += -Wa,-adhlns=$(<:%.cpp=$(OBJDIR)/%.lst) +CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +#CPPFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +# -listing-cont-lines: Sets the maximum number of continuation lines of hex +# dump that will be displayed for a given single line of source input. +ASFLAGS = $(ADEFS) -Wa,-adhlns=$(<:%.S=$(OBJDIR)/%.lst),-gstabs,--listing-cont-lines=100 + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + +# List any extra directories to look for libraries here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRALIBDIRS = + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--section-start,.data=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += -Wl,--relax +LDFLAGS += -Wl,--gc-sections +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) +#LDFLAGS += -T linker_script.x + + + +#---------------- Programming Options (avrdude) ---------------- + +# Programming hardware +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = avrispmkii + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See <http://savannah.nongnu.org/projects/avrdude> +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FORCE = -F + +AVRDUDE_FLAGS = -p $(MCU_AVRDUDE) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) +AVRDUDE_FLAGS += $(AVRDUDE_FORCE) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +AR = avr-ar rcs +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +REMOVEDIR = rm -rf +COPY = cp +WINSHELL = cmd + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling C: +MSG_COMPILING_CPP = Compiling C++: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: +MSG_CREATING_LIBRARY = Creating library: + + + + +# Define all object files. +OBJ = $(SRC:%.c=$(OBJDIR)/%.o) $(CPPSRC:%.cpp=$(OBJDIR)/%.o) $(ASRC:%.S=$(OBJDIR)/%.o) + +# Define all listing files. +LST = $(SRC:%.c=$(OBJDIR)/%.lst) $(CPPSRC:%.cpp=$(OBJDIR)/%.lst) $(ASRC:%.S=$(OBJDIR)/%.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build checkinvalidevents showliboptions showtarget sizeafter end +all: begin gccversion sizebefore build showliboptions showtarget sizeafter end + +# Change the build target to build a HEX file or a library. +build: elf hex eep lss sym asm +#build: lib + + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym +asm: $(TARGET).s +LIBNAME=lib$(TARGET).a +lib: $(LIBNAME) + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) $(MCU_FLAG) $(FORMAT_FLAG) $(TARGET).elf +MCU_FLAG = $(shell $(SIZE) --help | grep -- --mcu > /dev/null && echo --mcu=$(MCU) ) +FORMAT_FLAG = $(shell $(SIZE) --help | grep -- --format=.*avr > /dev/null && echo --format=avr ) + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + 2>/dev/null; echo; fi + +#$(LUFA_PATH)/LUFA/LUFA_Events.lst: +# @make -C $(LUFA_PATH)/LUFA/ LUFA_Events.lst + +#checkinvalidevents: $(LUFA_PATH)/LUFA/LUFA_Events.lst +# @echo +# @echo Checking for invalid events... +# @$(shell) avr-nm $(OBJ) | sed -n -e 's/^.*EVENT_/EVENT_/p' | \ +# grep -F -v --file=$(LUFA_PATH)/LUFA/LUFA_Events.lst > InvalidEvents.tmp || true +# @sed -n -e 's/^/ WARNING - INVALID EVENT NAME: /p' InvalidEvents.tmp +# @if test -s InvalidEvents.tmp; then exit 1; fi + +showliboptions: + @echo + @echo ---- Compile Time Library Options ---- + @for i in $(LUFA_OPTS:-D%=%); do \ + echo $$i; \ + done + @echo -------------------------------------- + +showtarget: + @echo + @echo --------- Target Information --------- + @echo AVR Model: $(MCU) + @echo Board: $(BOARD) + @echo Clock: $(F_CPU)Hz CPU, $(F_CLOCK)Hz Master + @echo -------------------------------------- + + +# Display compiler version information. +gccversion : + @$(CC) --version + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + +flip: $(TARGET).hex + batchisp -hardware usb -device $(MCU_DFU) -operation erase f + batchisp -hardware usb -device $(MCU_DFU) -operation loadbuffer $(TARGET).hex program + batchisp -hardware usb -device $(MCU_DFU) -operation start reset 0 + +dfu: $(TARGET).hex + dfu-programmer $(MCU_DFU) erase + dfu-programmer $(MCU_DFU) flash --debug 1 $(TARGET).hex + dfu-programmer $(MCU_DFU) reset + + +flip-ee: $(TARGET).hex $(TARGET).eep + $(COPY) $(TARGET).eep $(TARGET)eep.hex + batchisp -hardware usb -device $(MCU_DFU) -operation memory EEPROM erase + batchisp -hardware usb -device $(MCU_DFU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program + batchisp -hardware usb -device $(MCU_DFU) -operation start reset 0 + $(REMOVE) $(TARGET)eep.hex + +dfu-ee: $(TARGET).hex $(TARGET).eep + dfu-programmer $(MCU_DFU) flash-eeprom --debug 1 --suppress-bootloader-mem $(TARGET).eep + dfu-programmer $(MCU_DFU) reset + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT = $(OBJCOPY) --debugging +COFFCONVERT += --change-section-address .data-0x800000 +COFFCONVERT += --change-section-address .bss-0x800000 +COFFCONVERT += --change-section-address .noinit-0x800000 +COFFCONVERT += --change-section-address .eeprom-0x810000 + + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT) $< $@ || exit 0 + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S -z $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Create library from object files. +.SECONDARY : $(TARGET).a +.PRECIOUS : $(OBJ) +%.a: $(OBJ) + @echo + @echo $(MSG_CREATING_LIBRARY) $@ + $(AR) $@ $(OBJ) + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +$(OBJDIR)/%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create object files from C++ source files. +$(OBJDIR)/%.o : %.cpp + @echo + @echo $(MSG_COMPILING_CPP) $< + $(CC) -c $(ALL_CPPFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C++ source files. +%.s : %.cpp + $(CC) -S $(ALL_CPPFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +$(OBJDIR)/%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list clean_binary end + +clean_binary: + $(REMOVE) $(TARGET).hex + +clean_list: + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.o) + $(REMOVE) $(SRC:%.c=$(OBJDIR)/%.lst) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) $(SRC:.c=.i) + $(REMOVEDIR) .dep + +doxygen: + @echo Generating Project Documentation... + @doxygen Doxygen.conf + @echo Documentation Generation Complete. + +clean_doxygen: + rm -rf Documentation + +# Create object files directory +$(shell mkdir $(OBJDIR) 2>/dev/null) + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff doxygen clean \ +clean_list clean_doxygen program dfu flip flip-ee dfu-ee \ +debug gdb-config
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/firmwares/arduino-usbserial/readme.txt Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,13 @@ +To setup the project and upload the Arduino usbserial application firmware to an ATMEGA8U2 using the Arduino USB DFU bootloader: +1. unpack the source into LUFA's Projects directory +2. set ARDUINO_MODEL_PID in the makefile as appropriate +3. do "make clean; make" +4. put the 8U2 into USB DFU mode: +4.a. assert and hold the 8U2's RESET line +4.b. assert and hold the 8U2's HWB line +4.c. release the 8U2's RESET line +4.d. release the 8U2's HWB line +5. confirm that the board enumerates as either "Arduino Uno DFU" or "Arduino Mega 2560 DFU" +6. do "make dfu" (OS X or Linux - dfu-programmer must be installed first) or "make flip" (Windows - Flip must be installed first) + +Check that the board enumerates as either "Arduino Uno" or "Arduino Mega 2560". Test by uploading a new Arduino sketch from the Arduino IDE.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/programmers.txt Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,31 @@ +# See: http://code.google.com/p/arduino/wiki/Platforms + +avrisp.name=AVR ISP +avrisp.communication=serial +avrisp.protocol=stk500v1 + +avrispmkii.name=AVRISP mkII +avrispmkii.communication=usb +avrispmkii.protocol=stk500v2 + +usbtinyisp.name=USBtinyISP +usbtinyisp.protocol=usbtiny + +usbasp.name=USBasp +usbasp.communication=usb +usbasp.protocol=usbasp + +parallel.name=Parallel Programmer +parallel.protocol=dapa +parallel.force=true +# parallel.delay=200 + +arduinoisp.name=Arduino as ISP +arduinoisp.communication=serial +arduinoisp.protocol=stk500v1 +arduinoisp.speed=19200 + +avrispv2.name=AVR ISP v2 +avrispv2.communication=serial +avrispv2.protocol=avrispv2 +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/sanguino/variants/standard/pins_arduino.h Thu Jul 07 12:23:34 2016 +0200 @@ -0,0 +1,264 @@ +/* + pins_arduino.h - Pin definition functions for Arduino + Part of Arduino - http://www.arduino.cc/ + + Copyright (c) 2007 David A. Mellis + + 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., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + + $Id: wiring.h 249 2007-02-03 16:52:51Z mellis $ + + Changelog + ----------- + 11/25/11 - ryan@ryanmsutton.com - Add pins for Sanguino 644P and 1284P + 07/15/12 - ryan@ryanmsutton.com - Updated for arduino0101 +*/ + +#ifndef Pins_Arduino_h +#define Pins_Arduino_h + +#include <avr/pgmspace.h> + +#define NOT_A_PIN 0 +#define NOT_A_PORT 0 + +#define NOT_ON_TIMER 0 +#define TIMER0A 1 +#define TIMER0B 2 +#define TIMER1A 3 +#define TIMER1B 4 +#define TIMER2 5 +#define TIMER2A 6 +#define TIMER2B 7 + +#define TIMER3A 8 +#define TIMER3B 9 +#define TIMER3C 10 +#define TIMER4A 11 +#define TIMER4B 12 +#define TIMER4C 13 +#define TIMER5A 14 +#define TIMER5B 15 +#define TIMER5C 16 + +const static uint8_t SS = 4; +const static uint8_t MOSI = 5; +const static uint8_t MISO = 6; +const static uint8_t SCK = 7; + +static const uint8_t SDA = 17; +static const uint8_t SCL = 16; +static const uint8_t LED_BUILTIN = 13; + +static const uint8_t A0 = 31; +static const uint8_t A1 = 30; +static const uint8_t A2 = 29; +static const uint8_t A3 = 28; +static const uint8_t A4 = 27; +static const uint8_t A5 = 26; +static const uint8_t A6 = 25; +static const uint8_t A7 = 24; + +// On the ATmega1280, the addresses of some of the port registers are +// greater than 255, so we can't store them in uint8_t's. +// extern const uint16_t PROGMEM port_to_mode_PGM[]; +// extern const uint16_t PROGMEM port_to_input_PGM[]; +// extern const uint16_t PROGMEM port_to_output_PGM[]; + +// extern const uint8_t PROGMEM digital_pin_to_port_PGM[]; +// extern const uint8_t PROGMEM digital_pin_to_bit_PGM[]; +// extern const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[]; +// extern const uint8_t PROGMEM digital_pin_to_timer_PGM[]; + +// ATMEL ATMEGA644P / SANGUINO +// +// +---\/---+ +// INT0 (D 0) PB0 1| |40 PA0 (AI 0 / D31) +// INT1 (D 1) PB1 2| |39 PA1 (AI 1 / D30) +// INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29) +// PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28) +// PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27) +// MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26) +// MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25) +// SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24) +// RST 9| |32 AREF +// VCC 10| |31 GND +// GND 11| |30 AVCC +// XTAL2 12| |29 PC7 (D 23) +// XTAL1 13| |28 PC6 (D 22) +// RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI +// TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO +// RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS +// TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK +// PWM (D 12) PD4 18| |23 PC1 (D 17) SDA +// PWM (D 13) PD5 19| |22 PC0 (D 16) SCL +// PWM (D 14) PD6 20| |21 PD7 (D 15) PWM +// +--------+ +// +#define NUM_DIGITAL_PINS 24 +#define NUM_ANALOG_INPUTS 8 +#define analogInputToDigitalPin(p) ((p < 7) ? (p) + 24 : -1) + +#define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15 ) + +#define PA 1 +#define PB 2 +#define PC 3 +#define PD 4 +#define PE 5 +#define PF 6 +#define PG 7 +#define PH 8 +#define PJ 10 +#define PK 11 +#define PL 12 + +#ifdef ARDUINO_MAIN +// these arrays map port names (e.g. port B) to the +// appropriate addresses for various functions (e.g. reading +// and writing) +const uint16_t PROGMEM port_to_mode_PGM[] = +{ + NOT_A_PORT, + (uint16_t) &DDRA, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, +}; + +const uint16_t PROGMEM port_to_output_PGM[] = +{ + NOT_A_PORT, + (uint16_t) &PORTA, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, +}; +const uint16_t PROGMEM port_to_input_PGM[] = +{ + NOT_A_PORT, + (uint16_t) &PINA, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, +}; +const uint8_t PROGMEM digital_pin_to_port_PGM[] = +{ + PB, /* 0 */ + PB, + PB, + PB, + PB, + PB, + PB, + PB, + PD, /* 8 */ + PD, + PD, + PD, + PD, + PD, + PD, + PD, + PC, /* 16 */ + PC, + PC, + PC, + PC, + PC, + PC, + PC, + PA, /* 24 */ + PA, + PA, + PA, + PA, + PA, + PA, + PA /* 31 */ +}; +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = +{ + _BV(0), /* 0, port B */ + _BV(1), + _BV(2), + _BV(3), + _BV(4), + _BV(5), + _BV(6), + _BV(7), + _BV(0), /* 8, port D */ + _BV(1), + _BV(2), + _BV(3), + _BV(4), + _BV(5), + _BV(6), + _BV(7), + _BV(0), /* 16, port C */ + _BV(1), + _BV(2), + _BV(3), + _BV(4), + _BV(5), + _BV(6), + _BV(7), + _BV(7), /* 24, port A */ + _BV(6), + _BV(5), + _BV(4), + _BV(3), + _BV(2), + _BV(1), + _BV(0) +}; +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = +{ + NOT_ON_TIMER, /* 0 - PB0 */ + NOT_ON_TIMER, /* 1 - PB1 */ + NOT_ON_TIMER, /* 2 - PB2 */ + TIMER0A, /* 3 - PB3 */ + TIMER0B, /* 4 - PB4 */ + NOT_ON_TIMER, /* 5 - PB5 */ + NOT_ON_TIMER, /* 6 - PB6 */ + NOT_ON_TIMER, /* 7 - PB7 */ + NOT_ON_TIMER, /* 8 - PD0 */ + NOT_ON_TIMER, /* 9 - PD1 */ + NOT_ON_TIMER, /* 10 - PD2 */ + NOT_ON_TIMER, /* 11 - PD3 */ + TIMER1B, /* 12 - PD4 */ + TIMER1A, /* 13 - PD5 */ + TIMER2B, /* 14 - PD6 */ + TIMER2A, /* 15 - PD7 */ + NOT_ON_TIMER, /* 16 - PC0 */ + NOT_ON_TIMER, /* 17 - PC1 */ + NOT_ON_TIMER, /* 18 - PC2 */ + NOT_ON_TIMER, /* 19 - PC3 */ + NOT_ON_TIMER, /* 20 - PC4 */ + NOT_ON_TIMER, /* 21 - PC5 */ + NOT_ON_TIMER, /* 22 - PC6 */ + NOT_ON_TIMER, /* 23 - PC7 */ + NOT_ON_TIMER, /* 24 - PA0 */ + NOT_ON_TIMER, /* 25 - PA1 */ + NOT_ON_TIMER, /* 26 - PA2 */ + NOT_ON_TIMER, /* 27 - PA3 */ + NOT_ON_TIMER, /* 28 - PA4 */ + NOT_ON_TIMER, /* 29 - PA5 */ + NOT_ON_TIMER, /* 30 - PA6 */ + NOT_ON_TIMER /* 31 - PA7 */ +}; +#endif +#endif