diff -r -w -u Arduino-Original/app/src/processing/app/Base.java Arduino-Gator/app/src/processing/app/Base.java --- Arduino-Original/app/src/processing/app/Base.java 2010-11-16 13:35:50.000000000 -0500 +++ Arduino-Gator/app/src/processing/app/Base.java 2010-11-16 16:09:13.000000000 -0500 @@ -43,7 +43,7 @@ public class Base { public static final int REVISION = 22; /** This might be replaced by main() if there's a lib/version.txt file. */ - static String VERSION_NAME = "0022"; + static String VERSION_NAME = "0022-gator"; /** Set true if this a proper release rather than a numbered revision. */ static public boolean RELEASE = false; diff -r -w -u Arduino-Original/app/src/processing/app/Sketch.java Arduino-Gator/app/src/processing/app/Sketch.java --- Arduino-Original/app/src/processing/app/Sketch.java 2010-11-16 13:35:50.000000000 -0500 +++ Arduino-Gator/app/src/processing/app/Sketch.java 2010-11-16 16:10:32.000000000 -0500 @@ -1565,6 +1565,13 @@ // return false; // } + // GATOR: Give the user a chance to bring up the bootloader on + // boards that aren't automatically waiting for code. + if (Preferences.getBoolean("upload.reset_dialog")) { + Base.showMessage("Compilation complete", "Press the reset button on your board then click OK"); + } + + upload(appletFolder.getPath(), foundName, verbose); return true; diff -r -w -u Arduino-Original/build/shared/lib/preferences.txt Arduino-Gator/build/shared/lib/preferences.txt --- Arduino-Original/build/shared/lib/preferences.txt 2010-11-16 13:35:52.000000000 -0500 +++ Arduino-Gator/build/shared/lib/preferences.txt 2010-11-16 16:12:07.000000000 -0500 @@ -247,3 +247,8 @@ serial.stopbits=1 serial.parity=N serial.debug_rate=9600 + +# If true, pop up a dialog box asking the user to reset their board prior to +# uploading a new sketch (GATOR). +upload.reset_dialog=true + diff -r -w -u Arduino-Original/hardware/arduino/boards.txt Arduino-Gator/hardware/arduino/boards.txt --- Arduino-Original/hardware/arduino/boards.txt 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/hardware/arduino/boards.txt 2010-11-16 16:13:53.000000000 -0500 @@ -1,3 +1,24 @@ +gator.name=Rugged Circuits Gator Board + +# You can set the protocol to 'arduino' for AVRDUDE version +# 5.6 or later +gator.upload.protocol=stk500v1 +gator.upload.maximum_size=30720 +gator.upload.speed=38400 + +gator.bootloader.low_fuses=0xF7 +gator.bootloader.high_fuses=0xD2 +gator.bootloader.extended_fuses=0x05 +gator.bootloader.path=gator +gator.bootloader.file=GATORBOOT.hex +gator.bootloader.unlock_bits=0xFF +gator.bootloader.lock_bits=0xEF + +gator.build.mcu=atmega324p +gator.build.f_cpu=20000000L +gator.build.core=arduino + + ############################################################## uno.name=Arduino Uno diff -r -w -u Arduino-Original/hardware/arduino/cores/arduino/pins_arduino.c Arduino-Gator/hardware/arduino/cores/arduino/pins_arduino.c --- Arduino-Original/hardware/arduino/cores/arduino/pins_arduino.c 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/hardware/arduino/cores/arduino/pins_arduino.c 2010-11-16 16:44:21.000000000 -0500 @@ -351,6 +351,173 @@ NOT_ON_TIMER , // PK 6 ** 68 ** A14 NOT_ON_TIMER , // PK 7 ** 69 ** A15 }; +#elif defined(__AVR_ATmega324P__) // GATOR +/* On an ATmega324P, the pin mappings are as shown below. The + * first 20 pins (D0-D19) are for compatibility with ATmega8 + * and ATmega168 Arduinos. Specifically, the timer pins + * correspond as do the analog pin numbers to their digital + * pin counterparts (e.g., AI0-->D14, etc.) + * + * Analog Digital PWM Pin + * -------+-------+-------+------- + * | D 0 | | PC0 + * | D 1 | | PC1 + * | D 2 | | PC2 + * | D 3 |TIMER2B| PD6 + * | D 4 | | PC3 + * | D 5 |TIMER0B| PB4 !SS + * | D 6 |TIMER0A| PB3 + * | D 7 | | PD2 + * | D 8 | | PD3 + * | D 9 |TIMER1A| PD5 + * | D 10 |TIMER1B| PD4 + * | D 11 |TIMER2A| PD7 + * | D 12 | | PC4 + * | D 13 | | PC6 + * AI 0 | D 14 | | PA0 + * AI 1 | D 15 | | PA1 + * AI 2 | D 16 | | PA2 + * AI 3 | D 17 | | PA3 + * AI 4 | D 18 | | PA4 + * AI 5 | D 19 | | PA5 + * AI 6 | D 20 | | PA6 + * AI 7 | D 21 | | PA7 + * | D 22 | | PC5 + * | D 23 | | PB0 + * | D 24 | | PB1 + * | D 25 | | PB2 + * | D 26 | | PB5 MOSI + * | D 27 | | PB6 MISO + * | D 28 | | PB7 SCK + */ + +#define PA 1 +#define PB 2 +#define PC 3 +#define PD 4 + +// 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, + &DDRA, + &DDRB, + &DDRC, + &DDRD, +}; + +const uint16_t PROGMEM port_to_output_PGM[] = { + NOT_A_PORT, + &PORTA, + &PORTB, + &PORTC, + &PORTD, +}; + +const uint16_t PROGMEM port_to_input_PGM[] = { + NOT_A_PORT, + &PINA, + &PINB, + &PINC, + &PIND, +}; + +const uint8_t PROGMEM digital_pin_to_port_PGM[] = { + PC, /* D0 : PC0 */ + PC, /* D1 : PC1 */ + PC, /* D2 : PC2 */ + PD, /* D3 : PD6 */ + PC, /* D4 : PC3 */ + PB, /* D5 : PB4 */ + PB, /* D6 : PB3 */ + PD, /* D7 : PD2 */ + PD, /* D8 : PD3 */ + PD, /* D9 : PD5 */ + PD, /* D10 : PD4 */ + PD, /* D11 : PD7 */ + PC, /* D12 : PC4 */ + PC, /* D13 : PC6 */ + PA, /* D14 : PA0 */ + PA, /* D15 : PA1 */ + PA, /* D16 : PA2 */ + PA, /* D17 : PA3 */ + PA, /* D18 : PA4 */ + PA, /* D19 : PA5 */ + PA, /* D20 : PA6 */ + PA, /* D21 : PA7 */ + PC, /* D22 : PC5 */ + PB, /* D23 : PB0 */ + PB, /* D24 : PB1 */ + PB, /* D25 : PB2 */ + PB, /* D26 : PB5 */ + PB, /* D27 : PB6 */ + PB /* D28 : PB7 */ +}; + +const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] = { + _BV(0), /* D0 : PC0 */ + _BV(1), /* D1 : PC1 */ + _BV(2), /* D2 : PC2 */ + _BV(6), /* D3 : PD6 */ + _BV(3), /* D4 : PC3 */ + _BV(4), /* D5 : PB4 */ + _BV(3), /* D6 : PB3 */ + _BV(2), /* D7 : PD2 */ + _BV(3), /* D8 : PD3 */ + _BV(5), /* D9 : PD5 */ + _BV(4), /* D10 : PD4 */ + _BV(7), /* D11 : PD7 */ + _BV(4), /* D12 : PC4 */ + _BV(6), /* D13 : PC6 */ + _BV(0), /* D14 : PA0 */ + _BV(1), /* D15 : PA1 */ + _BV(2), /* D16 : PA2 */ + _BV(3), /* D17 : PA3 */ + _BV(4), /* D18 : PA4 */ + _BV(5), /* D19 : PA5 */ + _BV(6), /* D20 : PA6 */ + _BV(7), /* D21 : PA7 */ + _BV(5), /* D22 : PC5 */ + _BV(0), /* D23 : PB0 */ + _BV(1), /* D24 : PB1 */ + _BV(2), /* D25 : PB2 */ + _BV(5), /* D26 : PB5 */ + _BV(6), /* D27 : PB6 */ + _BV(7) /* D28 : PB7 */ +}; + +const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { + NOT_ON_TIMER, /* D0 : PC0 */ + NOT_ON_TIMER, /* D1 : PC1 */ + NOT_ON_TIMER, /* D2 : PC2 */ + TIMER2B, /* D3 : PD6 (TIMER2B) */ + NOT_ON_TIMER, /* D4 : PC3 */ + TIMER0B, /* D5 : PB4 (TIMER0B) */ + TIMER0A, /* D6 : PB3 (TIMER0A) */ + NOT_ON_TIMER, /* D7 : PD2 */ + NOT_ON_TIMER, /* D8 : PD3 */ + TIMER1A, /* D9 : PD5 (TIMER1A) */ + TIMER1B, /* D10 : PD4 (TIMER1B) */ + TIMER2A, /* D11 : PD7 (TIMER2A) */ + NOT_ON_TIMER, /* D12 : PC4 */ + NOT_ON_TIMER, /* D13 : PC6 */ + NOT_ON_TIMER, /* D14 : PA0 */ + NOT_ON_TIMER, /* D15 : PA1 */ + NOT_ON_TIMER, /* D16 : PA2 */ + NOT_ON_TIMER, /* D17 : PA3 */ + NOT_ON_TIMER, /* D18 : PA4 */ + NOT_ON_TIMER, /* D19 : PA5 */ + NOT_ON_TIMER, /* D20 : PA6 */ + NOT_ON_TIMER, /* D21 : PA7 */ + NOT_ON_TIMER, /* D22 : PC5 */ + NOT_ON_TIMER, /* D23 : PB0 */ + NOT_ON_TIMER, /* D24 : PB1 */ + NOT_ON_TIMER, /* D25 : PB2 */ + NOT_ON_TIMER, /* D26 : PB5 */ + NOT_ON_TIMER, /* D27 : PB6 */ + NOT_ON_TIMER, /* D28 : PB7 */ +}; #else // these arrays map port names (e.g. port B) to the // appropriate addresses for various functions (e.g. reading diff -r -w -u Arduino-Original/hardware/arduino/cores/arduino/pins_arduino.h Arduino-Gator/hardware/arduino/cores/arduino/pins_arduino.h --- Arduino-Original/hardware/arduino/cores/arduino/pins_arduino.h 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/hardware/arduino/cores/arduino/pins_arduino.h 2010-11-16 16:46:12.000000000 -0500 @@ -54,6 +54,11 @@ const static uint8_t MOSI = 51; const static uint8_t MISO = 50; const static uint8_t SCK = 52; +#elif defined(__AVR_ATmega324P__) // GATOR +const static uint8_t SS = 5; // D5-->PB4 +const static uint8_t MOSI = 26; // D26-->PB5 +const static uint8_t MISO = 27; // D27-->PB6 +const static uint8_t SCK = 28; // D28-->PB7 #else const static uint8_t SS = 10; const static uint8_t MOSI = 11; diff -r -w -u Arduino-Original/hardware/arduino/cores/arduino/wiring.c Arduino-Gator/hardware/arduino/cores/arduino/wiring.c --- Arduino-Original/hardware/arduino/cores/arduino/wiring.c 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/hardware/arduino/cores/arduino/wiring.c 2010-11-16 16:25:20.000000000 -0500 @@ -24,6 +24,17 @@ #include "wiring_private.h" +#ifdef __AVR_ATmega324P__ // 20 MHz Gator board...standard code is off by a factor of 255/256 + // so we use a 16-bit timer0_fract for higher resolution. +# if F_CPU != 20000000L +# error "This code is only configured for 20 MHz operation" +# endif +# define MILLIS_INC 0 +# define FRACT_INC 8192 // 819.2us per timer tick given 20e6/64/256==1220.703125 Hz==1/819.2us +# define FRACT_MAX 10000 // 1000.0us per millisecond + static unsigned short timer0_fract = 0; +#else // Arduinos <= 16 MHz + // 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)) @@ -36,18 +47,22 @@ // about - 8 and 16 MHz - this doesn't lose precision.) #define FRACT_INC ((MICROSECONDS_PER_TIMER0_OVERFLOW % 1000) >> 3) #define FRACT_MAX (1000 >> 3) + static unsigned char timer0_fract = 0; +#endif volatile unsigned long timer0_overflow_count = 0; volatile unsigned long timer0_millis = 0; -static unsigned char timer0_fract = 0; SIGNAL(TIMER0_OVF_vect) { // 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; +#ifdef __AVR_ATmega324P__ // 20 MHz Gator board + unsigned short f = timer0_fract; +#else unsigned char f = timer0_fract; - +#endif m += MILLIS_INC; f += FRACT_INC; if (f >= FRACT_MAX) { diff -r -w -u Arduino-Original/hardware/arduino/cores/arduino/wiring.h Arduino-Gator/hardware/arduino/cores/arduino/wiring.h --- Arduino-Original/hardware/arduino/cores/arduino/wiring.h 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/hardware/arduino/cores/arduino/wiring.h 2010-11-16 16:27:38.000000000 -0500 @@ -58,7 +58,7 @@ #define FALLING 2 #define RISING 3 -#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) +#if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) || defined(__AVR_ATmega324P__) // GATOR #define INTERNAL1V1 2 #define INTERNAL2V56 3 #else diff -r -w -u Arduino-Original/libraries/Wire/utility/twi.c Arduino-Gator/libraries/Wire/utility/twi.c --- Arduino-Original/libraries/Wire/utility/twi.c 2010-11-16 13:35:54.000000000 -0500 +++ Arduino-Gator/libraries/Wire/utility/twi.c 2010-11-16 16:37:41.000000000 -0500 @@ -69,6 +69,9 @@ // as per note from atmega8 manual pg167 sbi(PORTC, 4); sbi(PORTC, 5); + #elif defined(__AVR_ATmega324P__) // GATOR + sbi(PORTC, 0); + sbi(PORTC, 1); #else // activate internal pull-ups for twi // as per note from atmega128 manual pg204