diff -w -r -u arduino-read-only/app/Base.java arduino-gator-mods/app/Base.java --- arduino-read-only/app/Base.java 2009-04-28 23:44:01.000000000 -0400 +++ arduino-gator-mods/app/Base.java 2009-04-29 01:14:22.656250000 -0400 @@ -54,7 +54,7 @@ */ public class Base { static final int VERSION = 15; - static final String VERSION_NAME = "0015"; + static final String VERSION_NAME = "0015-gator"; /** * Path of filename opened on the command line, diff -w -r -u arduino-read-only/app/Sketch.java arduino-gator-mods/app/Sketch.java --- arduino-read-only/app/Sketch.java 2009-04-28 23:22:21.000000000 -0400 +++ arduino-gator-mods/app/Sketch.java 2009-04-29 01:08:11.156250000 -0400 @@ -1698,6 +1698,11 @@ // build the sketch String foundName = build(target, appletFolder.getPath(), name); size(appletFolder.getPath(), name); + // 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"); + } foundName = upload(appletFolder.getPath(), name); // (already reported) error during export, exit this function if (foundName == null) return false; diff -w -r -u arduino-read-only/build/shared/lib/preferences.txt arduino-gator-mods/build/shared/lib/preferences.txt --- arduino-read-only/build/shared/lib/preferences.txt 2009-04-28 23:03:42.000000000 -0400 +++ arduino-gator-mods/build/shared/lib/preferences.txt 2009-04-29 01:09:22.187500000 -0400 @@ -271,6 +271,9 @@ upload.verbose=false upload.using=bootloader +# If true, pop up a dialog box asking the user to reset their board prior to uploading a new sketch +upload.reset_dialog=false + # set the parallel port defaults (used if upload.programmer=dapa) parallel.port=0x378 @@ -285,3 +288,4 @@ build.verbose=false board=diecimila \ No newline at end of file + diff -w -r -u arduino-read-only/hardware/boards.txt arduino-gator-mods/hardware/boards.txt --- arduino-read-only/hardware/boards.txt 2009-04-28 23:22:38.000000000 -0400 +++ arduino-gator-mods/hardware/boards.txt 2009-04-29 00:59:43.328125000 -0400 @@ -1,5 +1,26 @@ ############################################################## +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.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 + +############################################################## + atmega8.name=Arduino NG or older w/ ATmega8 atmega8.upload.protocol=stk500 diff -w -r -u arduino-read-only/hardware/cores/arduino/HardwareSerial.cpp arduino-gator-mods/hardware/cores/arduino/HardwareSerial.cpp --- arduino-read-only/hardware/cores/arduino/HardwareSerial.cpp 2009-04-28 23:22:25.000000000 -0400 +++ arduino-gator-mods/hardware/cores/arduino/HardwareSerial.cpp 2009-04-29 00:59:43.343750000 -0400 @@ -91,6 +91,8 @@ #if defined(__AVR_ATmega8__) SIGNAL(SIG_UART_RECV) +#elif defined(__AVR_ATmega324P__) +SIGNAL(USART0_RX_vect) #else SIGNAL(USART_RX_vect) #endif @@ -130,6 +132,7 @@ void HardwareSerial::begin(long speed) { *_ubrrh = ((F_CPU / 16 + speed / 2) / speed - 1) >> 8; + *_ucsra = 0; // Clear U2X bit in case it is set, in which case baud rate will be wrong *_ubrrl = ((F_CPU / 16 + speed / 2) / speed - 1); sbi(*_ucsrb, _rxen); sbi(*_ucsrb, _txen); diff -w -r -u arduino-read-only/hardware/cores/arduino/pins_arduino.c arduino-gator-mods/hardware/cores/arduino/pins_arduino.c --- arduino-read-only/hardware/cores/arduino/pins_arduino.c 2009-04-28 23:22:25.000000000 -0400 +++ arduino-gator-mods/hardware/cores/arduino/pins_arduino.c 2009-04-29 00:59:43.359375000 -0400 @@ -355,6 +355,173 @@ NOT_ON_TIMER , // PK 6 ** 68 ** A14 NOT_ON_TIMER , // PK 7 ** 69 ** A15 }; +#elif defined(__AVR_ATmega324P__) +/* 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 + * | 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 + * | D 27 | | PB6 + * | D 28 | | PB7 + */ + +#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 -w -r -u arduino-read-only/hardware/cores/arduino/wiring_serial.c arduino-gator-mods/hardware/cores/arduino/wiring_serial.c --- arduino-read-only/hardware/cores/arduino/wiring_serial.c 2009-04-28 23:22:25.000000000 -0400 +++ arduino-gator-mods/hardware/cores/arduino/wiring_serial.c 2009-04-29 00:59:43.375000000 -0400 @@ -52,6 +52,7 @@ UBRR0L = ((F_CPU / 16 + baud / 2) / baud - 1); // enable rx and tx + UCSR0A=0; // Need to clear U2X bit in case it was set, else baud rate may be wrong sbi(UCSR0B, RXEN0); sbi(UCSR0B, TXEN0); @@ -106,6 +107,8 @@ #if defined(__AVR_ATmega8__) SIGNAL(SIG_UART_RECV) +#elif defined(__AVR_ATmega324P__) +SIGNAL(USART0_RX_vect) #else SIGNAL(USART_RX_vect) #endif diff -w -r -u arduino-read-only/hardware/libraries/Firmata/Firmata.h arduino-gator-mods/hardware/libraries/Firmata/Firmata.h --- arduino-read-only/hardware/libraries/Firmata/Firmata.h 2009-04-28 23:22:29.000000000 -0400 +++ arduino-gator-mods/hardware/libraries/Firmata/Firmata.h 2009-04-29 00:59:43.375000000 -0400 @@ -156,6 +156,11 @@ #define TOTAL_DIGITAL_PINS 51 #define TOTAL_PORTS 6 // total number of ports for the board #define ANALOG_PORT 2 // port# of analog used as digital +#elif defined(__AVR_ATmega324P__) +#define TOTAL_ANALOG_PINS 8 +#define TOTAL_DIGITAL_PINS 28 +#define TOTAL_PORTS 4 +#define ANALOG_PORT 1 #else // anything else #define TOTAL_ANALOG_PINS 6 #define TOTAL_DIGITAL_PINS 14 diff -w -r -u arduino-read-only/hardware/libraries/Wire/utility/twi.c arduino-gator-mods/hardware/libraries/Wire/utility/twi.c --- arduino-read-only/hardware/libraries/Wire/utility/twi.c 2009-04-28 23:22:30.000000000 -0400 +++ arduino-gator-mods/hardware/libraries/Wire/utility/twi.c 2009-04-29 00:59:43.390625000 -0400 @@ -69,6 +69,9 @@ // as per note from atmega8 manual pg167 sbi(PORTC, 4); sbi(PORTC, 5); + #elif defined(__AVR_ATmega324P__) + sbi(PORTC, 0); + sbi(PORTC, 1); #else // activate internal pull-ups for twi // as per note from atmega128 manual pg204