diff --git a/build/build.xml b/build/build.xml index 1e5f0259b..d6e00e2bd 100644 --- a/build/build.xml +++ b/build/build.xml @@ -1,17 +1,23 @@ + + + + + value="linux"> + @@ -317,13 +323,23 @@ + + + + + + description="Run Linux (32-bit) version"> - + + + + diff --git a/build/linux/dist/lib/librxtxSerial64.so b/build/linux/dist/lib/librxtxSerial64.so new file mode 100755 index 000000000..853b87a22 Binary files /dev/null and b/build/linux/dist/lib/librxtxSerial64.so differ diff --git a/build/linux/dist/tools/avrdude64 b/build/linux/dist/tools/avrdude64 new file mode 100755 index 000000000..f13912adc Binary files /dev/null and b/build/linux/dist/tools/avrdude64 differ diff --git a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde b/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde index 3678836b3..c92b0d023 100644 --- a/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde +++ b/build/shared/examples/4.Communication/ASCIITable/ASCIITable.pde @@ -38,7 +38,7 @@ void loop() // prints value unaltered, i.e. the raw binary version of the // byte. The serial monitor interprets all bytes as // ASCII, so 33, the first number, will show up as '!' - Serial.print(thisByte, BYTE); + Serial.write(thisByte); Serial.print(", dec: "); // prints value as string as an ASCII-encoded decimal (base 10). diff --git a/build/shared/examples/4.Communication/MIDI/Midi.pde b/build/shared/examples/4.Communication/MIDI/Midi.pde index 7a25c852c..cdeaeea11 100644 --- a/build/shared/examples/4.Communication/MIDI/Midi.pde +++ b/build/shared/examples/4.Communication/MIDI/Midi.pde @@ -29,7 +29,7 @@ void setup() { void loop() { // play notes from F#-0 (0x1E) to F#-5 (0x5A): - for (intnote = 0x1E; note < 0x5A; note ++) { + for (int note = 0x1E; note < 0x5A; note ++) { //Note on channel 1 (0x90), some note value (note), middle velocity (0x45): noteOn(0x90, note, 0x45); delay(100); @@ -42,8 +42,8 @@ void loop() { // plays a MIDI note. Doesn't check to see that // cmd is greater than 127, or that data values are less than 127: void noteOn(int cmd, int pitch, int velocity) { - Serial.print(cmd, BYTE); - Serial.print(pitch, BYTE); - Serial.print(velocity, BYTE); + Serial.write(cmd); + Serial.write(pitch); + Serial.write(velocity); } diff --git a/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde b/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde index 788bc908e..684e305bb 100644 --- a/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde +++ b/build/shared/examples/4.Communication/MultiSerialMega/MultiSerialMega.pde @@ -28,6 +28,6 @@ void loop() { // read from port 1, send to port 0: if (Serial1.available()) { int inByte = Serial1.read(); - Serial.print(inByte, BYTE); + Serial.write(inByte); } } diff --git a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde index 6f56d9891..e3565152a 100644 --- a/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde +++ b/build/shared/examples/4.Communication/SerialCallResponse/SerialCallResponse.pde @@ -52,15 +52,15 @@ void loop() // read switch, map it to 0 or 255L thirdSensor = map(digitalRead(2), 0, 1, 0, 255); // send sensor values: - Serial.print(firstSensor, BYTE); - Serial.print(secondSensor, BYTE); - Serial.print(thirdSensor, BYTE); + Serial.write(firstSensor); + Serial.write(secondSensor); + Serial.write(thirdSensor); } } void establishContact() { while (Serial.available() <= 0) { - Serial.print('A', BYTE); // send a capital A + Serial.print('A'); // send a capital A delay(300); } } diff --git a/hardware/arduino/cores/arduino/HardwareSerial.cpp b/hardware/arduino/cores/arduino/HardwareSerial.cpp index 4397efb7e..38e87c49f 100644 --- a/hardware/arduino/cores/arduino/HardwareSerial.cpp +++ b/hardware/arduino/cores/arduino/HardwareSerial.cpp @@ -191,7 +191,7 @@ HardwareSerial::HardwareSerial(ring_buffer *rx_buffer, // Public Methods ////////////////////////////////////////////////////////////// -void HardwareSerial::begin(long baud) +void HardwareSerial::begin(unsigned long baud) { uint16_t baud_setting; bool use_u2x = true; diff --git a/hardware/arduino/cores/arduino/HardwareSerial.h b/hardware/arduino/cores/arduino/HardwareSerial.h index 22ea9b0ed..4d506bf63 100644 --- a/hardware/arduino/cores/arduino/HardwareSerial.h +++ b/hardware/arduino/cores/arduino/HardwareSerial.h @@ -50,7 +50,7 @@ class HardwareSerial : public Stream volatile uint8_t *ucsra, volatile uint8_t *ucsrb, volatile uint8_t *udr, uint8_t rxen, uint8_t txen, uint8_t rxcie, uint8_t udre, uint8_t u2x); - void begin(long); + void begin(unsigned long); void end(); virtual int available(void); virtual int peek(void); diff --git a/hardware/arduino/cores/arduino/Print.cpp b/hardware/arduino/cores/arduino/Print.cpp index 4ee556dd8..fd689423a 100755 --- a/hardware/arduino/cores/arduino/Print.cpp +++ b/hardware/arduino/cores/arduino/Print.cpp @@ -45,7 +45,7 @@ void Print::write(const uint8_t *buffer, size_t size) void Print::print(const String &s) { - for (int i = 0; i < s.length(); i++) { + for (unsigned int i = 0; i < s.length(); i++) { write(s[i]); } } diff --git a/hardware/arduino/cores/arduino/WString.h b/hardware/arduino/cores/arduino/WString.h index cadddb947..56faf9a48 100644 --- a/hardware/arduino/cores/arduino/WString.h +++ b/hardware/arduino/cores/arduino/WString.h @@ -67,7 +67,7 @@ class String int lastIndexOf( char ch, unsigned int fromIndex ) const; int lastIndexOf( const String &str ) const; int lastIndexOf( const String &str, unsigned int fromIndex ) const; - const unsigned int length( ) const { return _length; } + unsigned int length( ) const { return _length; } void setCharAt(unsigned int index, const char ch); unsigned char startsWith( const String &prefix ) const; unsigned char startsWith( const String &prefix, unsigned int toffset ) const; diff --git a/hardware/arduino/cores/arduino/pins_arduino.c b/hardware/arduino/cores/arduino/pins_arduino.c index 0c816e94d..62e10ad15 100755 --- a/hardware/arduino/cores/arduino/pins_arduino.c +++ b/hardware/arduino/cores/arduino/pins_arduino.c @@ -81,50 +81,50 @@ #if defined(__AVR_ATmega1280__) || defined(__AVR_ATmega2560__) const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, - &DDRA, - &DDRB, - &DDRC, - &DDRD, - &DDRE, - &DDRF, - &DDRG, - &DDRH, + (uint16_t) &DDRA, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, + (uint16_t) &DDRE, + (uint16_t) &DDRF, + (uint16_t) &DDRG, + (uint16_t) &DDRH, NOT_A_PORT, - &DDRJ, - &DDRK, - &DDRL, + (uint16_t) &DDRJ, + (uint16_t) &DDRK, + (uint16_t) &DDRL, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT, - &PORTA, - &PORTB, - &PORTC, - &PORTD, - &PORTE, - &PORTF, - &PORTG, - &PORTH, + (uint16_t) &PORTA, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, + (uint16_t) &PORTE, + (uint16_t) &PORTF, + (uint16_t) &PORTG, + (uint16_t) &PORTH, NOT_A_PORT, - &PORTJ, - &PORTK, - &PORTL, + (uint16_t) &PORTJ, + (uint16_t) &PORTK, + (uint16_t) &PORTL, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PIN, - &PINA, - &PINB, - &PINC, - &PIND, - &PINE, - &PINF, - &PING, - &PINH, + (uint16_t) &PINA, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, + (uint16_t) &PINE, + (uint16_t) &PINF, + (uint16_t) &PING, + (uint16_t) &PINH, NOT_A_PIN, - &PINJ, - &PINK, - &PINL, + (uint16_t) &PINJ, + (uint16_t) &PINK, + (uint16_t) &PINL, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { @@ -358,25 +358,25 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = { const uint16_t PROGMEM port_to_mode_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &DDRB, - &DDRC, - &DDRD, + (uint16_t) &DDRB, + (uint16_t) &DDRC, + (uint16_t) &DDRD, }; const uint16_t PROGMEM port_to_output_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &PORTB, - &PORTC, - &PORTD, + (uint16_t) &PORTB, + (uint16_t) &PORTC, + (uint16_t) &PORTD, }; const uint16_t PROGMEM port_to_input_PGM[] = { NOT_A_PORT, NOT_A_PORT, - &PINB, - &PINC, - &PIND, + (uint16_t) &PINB, + (uint16_t) &PINC, + (uint16_t) &PIND, }; const uint8_t PROGMEM digital_pin_to_port_PGM[] = { diff --git a/libraries/Ethernet/examples/PachubeClient/PachubeClient.pde b/libraries/Ethernet/examples/PachubeClient/PachubeClient.pde index fe94541e1..406c7d17f 100644 --- a/libraries/Ethernet/examples/PachubeClient/PachubeClient.pde +++ b/libraries/Ethernet/examples/PachubeClient/PachubeClient.pde @@ -28,7 +28,7 @@ byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // assign an IP address for the controller: byte ip[] = { - 192,169,1,20 }; + 192,168,1,20 }; byte gateway[] = { 192,168,1,1}; byte subnet[] = { @@ -36,7 +36,7 @@ byte subnet[] = { // The address of the server you want to connect to (pachube.com): byte server[] = { - 209,40,205,190 }; + 173,203,98,29 }; // initialize the library instance: Client client(server, 80); diff --git a/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.pde b/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.pde index 225823ac1..d49301620 100644 --- a/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.pde +++ b/libraries/Ethernet/examples/PachubeClientString/PachubeClientString.pde @@ -30,7 +30,7 @@ byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED}; // assign an IP address for the controller: byte ip[] = { - 192,169,1,20 }; + 192,168,1,20 }; byte gateway[] = { 192,168,1,1}; byte subnet[] = { @@ -38,7 +38,7 @@ byte subnet[] = { // The address of the server you want to connect to (pachube.com): byte server[] = { - 209,40,205,190 }; + 173,203,98,29 }; // initialize the library instance: Client client(server, 80); diff --git a/libraries/Ethernet/utility/socket.cpp b/libraries/Ethernet/utility/socket.cpp index cad54a5e3..f9f4bb190 100644 --- a/libraries/Ethernet/utility/socket.cpp +++ b/libraries/Ethernet/utility/socket.cpp @@ -9,7 +9,6 @@ static uint16_t local_port; */ uint8_t socket(SOCKET s, uint8_t protocol, uint16_t port, uint8_t flag) { - uint8_t ret; if ((protocol == SnMR::TCP) || (protocol == SnMR::UDP) || (protocol == SnMR::IPRAW) || (protocol == SnMR::MACRAW) || (protocol == SnMR::PPPOE)) { close(s); diff --git a/libraries/Ethernet/utility/w5100.cpp b/libraries/Ethernet/utility/w5100.cpp index aaf3071f7..03aca0846 100644 --- a/libraries/Ethernet/utility/w5100.cpp +++ b/libraries/Ethernet/utility/w5100.cpp @@ -134,7 +134,7 @@ uint8_t W5100Class::write(uint16_t _addr, uint8_t _data) uint16_t W5100Class::write(uint16_t _addr, uint8_t *_buf, uint16_t _len) { - for (int i=0; i<_len; i++) + for (uint16_t i=0; i<_len; i++) { setSS(); SPI.transfer(0xF0); @@ -160,7 +160,7 @@ uint8_t W5100Class::read(uint16_t _addr) uint16_t W5100Class::read(uint16_t _addr, uint8_t *_buf, uint16_t _len) { - for (int i=0; i<_len; i++) + for (uint16_t i=0; i<_len; i++) { setSS(); SPI.transfer(0x0F); diff --git a/libraries/Firmata/examples/EchoString/EchoString.pde b/libraries/Firmata/examples/EchoString/EchoString.pde index 6559ae1c6..e5c4e6fe5 100644 --- a/libraries/Firmata/examples/EchoString/EchoString.pde +++ b/libraries/Firmata/examples/EchoString/EchoString.pde @@ -14,12 +14,12 @@ void stringCallback(char *myString) void sysexCallback(byte command, byte argc, byte*argv) { - Serial.print(START_SYSEX, BYTE); - Serial.print(command, BYTE); + Serial.write(START_SYSEX); + Serial.write(command); for(byte i=0; i #define FILE_READ O_READ -#define FILE_WRITE (O_READ | O_WRITE | O_CREAT | O_SYNC) +#define FILE_WRITE (O_READ | O_WRITE | O_CREAT) class File : public Stream { public: diff --git a/libraries/SD/examples/CardInfo/CardInfo.pde b/libraries/SD/examples/CardInfo/CardInfo.pde new file mode 100644 index 000000000..f81e21d17 --- /dev/null +++ b/libraries/SD/examples/CardInfo/CardInfo.pde @@ -0,0 +1,108 @@ +/* + SD card test + + This example shows how use the utility libraries on which the' + SD library is based in order to get info about your SD card. + Very useful for testing a card when you're not sure whether its working or not. + + The circuit: + * SD card attached to SPI bus as follows: + ** MOSI - pin 11 on Arduino Uno/Duemilanove/Diecimila + ** MISO - pin 12 on Arduino Uno/Duemilanove/Diecimila + ** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila + ** CS - depends on your SD card shield or module + + + created 28 Mar 2011 + by Limor Fried + */ + // include the SD library: +#include + +// set up variables using the SD utility library functions: +Sd2Card card; +SdVolume volume; +SdFile root; + +// change this to match your SD shield or module; +// Arduino Ethernet shield: pin 4 +// Adafruit SD shields and modules: pin 10 +// Sparkfun SD shield: pin 8 +const int chipSelect = 8; + +void setup() +{ + Serial.begin(9600); + Serial.print("\nInitializing SD card..."); + // On the Ethernet Shield, CS is pin 4. It's set as an output by default. + // Note that even if it's not used as the CS pin, the hardware SS pin + // (10 on most Arduino boards, 53 on the Mega) must be left as an output + // or the SD library functions will not work. + pinMode(10, OUTPUT); // change this to 53 on a mega + + + // we'll use the initialization code from the utility libraries + // since we're just testing if the card is working! + if (!card.init(SPI_HALF_SPEED, chipSelect)) { + Serial.println("initialization failed. Things to check:"); + Serial.println("* is a card is inserted?"); + Serial.println("* Is your wiring correct?"); + Serial.println("* did you change the chipSelect pin to match your shield or module?"); + return; + } else { + Serial.println("Wiring is correct and a card is present."); + } + + // print the type of card + Serial.print("\nCard type: "); + switch(card.type()) { + case SD_CARD_TYPE_SD1: + Serial.println("SD1"); + break; + case SD_CARD_TYPE_SD2: + Serial.println("SD2"); + break; + case SD_CARD_TYPE_SDHC: + Serial.println("SDHC"); + break; + default: + Serial.println("Unknown"); + } + + // Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32 + if (!volume.init(card)) { + Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card"); + return; + } + + + // print the type and size of the first FAT-type volume + long volumesize; + Serial.print("\nVolume type is FAT"); + Serial.println(volume.fatType(), DEC); + Serial.println(); + + volumesize = volume.blocksPerCluster(); // clusters are collections of blocks + volumesize *= volume.clusterCount(); // we'll have a lot of clusters + volumesize *= 512; // SD card blocks are always 512 bytes + Serial.print("Volume size (bytes): "); + Serial.println(volumesize); + Serial.print("Volume size (Kbytes): "); + volumesize /= 1024; + Serial.println(volumesize); + Serial.print("Volume size (Mbytes): "); + volumesize /= 1024; + Serial.println(volumesize); + + + Serial.println("\nFiles found on the card (name, date and size in bytes): "); + root.openRoot(volume); + + // list all files in the card with date and size + root.ls(LS_R | LS_DATE | LS_SIZE); +} + + +void loop(void) { + +} diff --git a/libraries/Wire/utility/twi.c b/libraries/Wire/utility/twi.c index 236878c4a..9d7280743 100644 --- a/libraries/Wire/utility/twi.c +++ b/libraries/Wire/utility/twi.c @@ -79,7 +79,7 @@ void twi_init(void) // initialize twi prescaler and bit rate cbi(TWSR, TWPS0); cbi(TWSR, TWPS1); - TWBR = ((CPU_FREQ / TWI_FREQ) - 16) / 2; + TWBR = ((F_CPU / TWI_FREQ) - 16) / 2; /* twi bit rate formula from atmega128 manual pg 204 SCL Frequency = CPU Clock Frequency / (16 + (2 * TWBR)) diff --git a/libraries/Wire/utility/twi.h b/libraries/Wire/utility/twi.h index 1258d8d38..71471c6ae 100755 --- a/libraries/Wire/utility/twi.h +++ b/libraries/Wire/utility/twi.h @@ -24,10 +24,6 @@ //#define ATMEGA8 - #ifndef CPU_FREQ - #define CPU_FREQ 16000000L - #endif - #ifndef TWI_FREQ #define TWI_FREQ 100000L #endif