Commit 8b327d7b authored by per1234's avatar per1234

Correct typos in comments and documentation

parent 5ec42f90
...@@ -219,7 +219,7 @@ void HardwareSerial::flush() ...@@ -219,7 +219,7 @@ void HardwareSerial::flush()
_tx_udr_empty_irq(); _tx_udr_empty_irq();
} }
// If we get here, nothing is queued anymore (DRIE is disabled) and // If we get here, nothing is queued anymore (DRIE is disabled) and
// the hardware finished tranmission (TXC is set). // the hardware finished transmission (TXC is set).
} }
size_t HardwareSerial::write(uint8_t c) size_t HardwareSerial::write(uint8_t c)
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
// using a ring buffer (I think), in which head is the index of the location // 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 // to which to write the next incoming character and tail is the index of the
// location from which to read. // location from which to read.
// NOTE: a "power of 2" buffer size is reccomended to dramatically // NOTE: a "power of 2" buffer size is recommended to dramatically
// optimize all the modulo operations for ring buffers. // optimize all the modulo operations for ring buffers.
// WARNING: When buffer sizes are increased to > 256, the buffer index // WARNING: When buffer sizes are increased to > 256, the buffer index
// variables are automatically increased in size, but the extra // variables are automatically increased in size, but the extra
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
#endif #endif
#endif // !defined TXC0 #endif // !defined TXC0
// Check at compiletime that it is really ok to use the bit positions of // Check at compile time that it is really ok to use the bit positions of
// UART0 for the other UARTs as well, in case these values ever get // UART0 for the other UARTs as well, in case these values ever get
// changed for future hardware. // changed for future hardware.
#if defined(TXC1) && (TXC1 != TXC0 || RXEN1 != RXEN0 || RXCIE1 != RXCIE0 || \ #if defined(TXC1) && (TXC1 != TXC0 || RXEN1 != RXEN0 || RXCIE1 != RXCIE0 || \
......
...@@ -59,7 +59,7 @@ class Print ...@@ -59,7 +59,7 @@ class Print
} }
// default to zero, meaning "a single write may block" // default to zero, meaning "a single write may block"
// should be overriden by subclasses with buffering // should be overridden by subclasses with buffering
virtual int availableForWrite() { return 0; } virtual int availableForWrite() { return 0; }
size_t print(const __FlashStringHelper *); size_t print(const __FlashStringHelper *);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <inttypes.h> #include <inttypes.h>
#include "Print.h" #include "Print.h"
// compatability macros for testing // compatibility macros for testing
/* /*
#define getInt() parseInt() #define getInt() parseInt()
#define getInt(ignore) parseInt(ignore) #define getInt(ignore) parseInt(ignore)
......
...@@ -32,7 +32,7 @@ typedef unsigned long u32; ...@@ -32,7 +32,7 @@ typedef unsigned long u32;
#include "Arduino.h" #include "Arduino.h"
// This definitions is usefull if you want to reduce the EP_SIZE to 16 // This definitions is useful if you want to reduce the EP_SIZE to 16
// at the moment only 64 and 16 as EP_SIZE for all EPs are supported except the control endpoint // at the moment only 64 and 16 as EP_SIZE for all EPs are supported except the control endpoint
#ifndef USB_EP_SIZE #ifndef USB_EP_SIZE
#define USB_EP_SIZE 64 #define USB_EP_SIZE 64
......
...@@ -95,7 +95,7 @@ public: ...@@ -95,7 +95,7 @@ public:
// returns true on success, false on failure (in which case, the string // returns true on success, false on failure (in which case, the string
// is left unchanged). if the argument is null or invalid, the // is left unchanged). if the argument is null or invalid, the
// concatenation is considered unsucessful. // concatenation is considered unsuccessful.
unsigned char concat(const String &str); unsigned char concat(const String &str);
unsigned char concat(const char *cstr); unsigned char concat(const char *cstr);
unsigned char concat(char c); unsigned char concat(char c);
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
unsigned char startsWith(const String &prefix, unsigned int offset) const; unsigned char startsWith(const String &prefix, unsigned int offset) const;
unsigned char endsWith(const String &suffix) const; unsigned char endsWith(const String &suffix) const;
// character acccess // character access
char charAt(unsigned int index) const; char charAt(unsigned int index) const;
void setCharAt(unsigned int index, char c); void setCharAt(unsigned int index, char c);
char operator [] (unsigned int index) const; char operator [] (unsigned int index) const;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include "new.h" #include "new.h"
// The C++ spec dicates that allocation failure should cause the // The C++ spec dictates that allocation failure should cause the
// (non-nothrow version of the) operator new to throw an exception. // (non-nothrow version of the) operator new to throw an exception.
// Since we expect to have exceptions disabled, it would be more // Since we expect to have exceptions disabled, it would be more
// appropriate (and probably standards-compliant) to terminate instead. // appropriate (and probably standards-compliant) to terminate instead.
......
...@@ -125,7 +125,7 @@ void delayMicroseconds(unsigned int us) ...@@ -125,7 +125,7 @@ void delayMicroseconds(unsigned int us)
// 2 microseconds) gives delays longer than desired. // 2 microseconds) gives delays longer than desired.
//delay_us(us); //delay_us(us);
#if F_CPU >= 24000000L #if F_CPU >= 24000000L
// for the 24 MHz clock for the aventurous ones, trying to overclock // for the 24 MHz clock for the adventurous ones trying to overclock
// zero delay fix // zero delay fix
if (!us) return; // = 3 cycles, (4 when true) if (!us) return; // = 3 cycles, (4 when true)
...@@ -135,9 +135,9 @@ void delayMicroseconds(unsigned int us) ...@@ -135,9 +135,9 @@ void delayMicroseconds(unsigned int us)
// delay requested. // delay requested.
us *= 6; // x6 us, = 7 cycles us *= 6; // x6 us, = 7 cycles
// account for the time taken in the preceeding commands. // account for the time taken in the preceding commands.
// we just burned 22 (24) cycles above, remove 5, (5*4=20) // we just burned 22 (24) cycles above, remove 5, (5*4=20)
// us is at least 6 so we can substract 5 // us is at least 6 so we can subtract 5
us -= 5; //=2 cycles us -= 5; //=2 cycles
#elif F_CPU >= 20000000L #elif F_CPU >= 20000000L
...@@ -157,9 +157,9 @@ void delayMicroseconds(unsigned int us) ...@@ -157,9 +157,9 @@ void delayMicroseconds(unsigned int us)
// delay requested. // delay requested.
us = (us << 2) + us; // x5 us, = 7 cycles us = (us << 2) + us; // x5 us, = 7 cycles
// account for the time taken in the preceeding commands. // account for the time taken in the preceding commands.
// we just burned 26 (28) cycles above, remove 7, (7*4=28) // we just burned 26 (28) cycles above, remove 7, (7*4=28)
// us is at least 10 so we can substract 7 // us is at least 10 so we can subtract 7
us -= 7; // 2 cycles us -= 7; // 2 cycles
#elif F_CPU >= 16000000L #elif F_CPU >= 16000000L
...@@ -174,9 +174,9 @@ void delayMicroseconds(unsigned int us) ...@@ -174,9 +174,9 @@ void delayMicroseconds(unsigned int us)
// delay requested. // delay requested.
us <<= 2; // x4 us, = 4 cycles us <<= 2; // x4 us, = 4 cycles
// account for the time taken in the preceeding commands. // account for the time taken in the preceding commands.
// we just burned 19 (21) cycles above, remove 5, (5*4=20) // we just burned 19 (21) cycles above, remove 5, (5*4=20)
// us is at least 8 so we can substract 5 // us is at least 8 so we can subtract 5
us -= 5; // = 2 cycles, us -= 5; // = 2 cycles,
#elif F_CPU >= 12000000L #elif F_CPU >= 12000000L
...@@ -191,9 +191,9 @@ void delayMicroseconds(unsigned int us) ...@@ -191,9 +191,9 @@ void delayMicroseconds(unsigned int us)
// delay requested. // delay requested.
us = (us << 1) + us; // x3 us, = 5 cycles us = (us << 1) + us; // x3 us, = 5 cycles
// account for the time taken in the preceeding commands. // account for the time taken in the preceding commands.
// we just burned 20 (22) cycles above, remove 5, (5*4=20) // we just burned 20 (22) cycles above, remove 5, (5*4=20)
// us is at least 6 so we can substract 5 // us is at least 6 so we can subtract 5
us -= 5; //2 cycles us -= 5; //2 cycles
#elif F_CPU >= 8000000L #elif F_CPU >= 8000000L
...@@ -208,9 +208,9 @@ void delayMicroseconds(unsigned int us) ...@@ -208,9 +208,9 @@ void delayMicroseconds(unsigned int us)
// delay requested. // delay requested.
us <<= 1; //x2 us, = 2 cycles us <<= 1; //x2 us, = 2 cycles
// account for the time taken in the preceeding commands. // account for the time taken in the preceding commands.
// we just burned 17 (19) cycles above, remove 4, (4*4=16) // we just burned 17 (19) cycles above, remove 4, (4*4=16)
// us is at least 6 so we can substract 4 // us is at least 6 so we can subtract 4
us -= 4; // = 2 cycles us -= 4; // = 2 cycles
#else #else
...@@ -218,9 +218,9 @@ void delayMicroseconds(unsigned int us) ...@@ -218,9 +218,9 @@ void delayMicroseconds(unsigned int us)
// the overhead of the function calls is 14 (16) cycles // the overhead of the function calls is 14 (16) cycles
if (us <= 16) return; //= 3 cycles, (4 when true) if (us <= 16) return; //= 3 cycles, (4 when true)
if (us <= 25) return; //= 3 cycles, (4 when true), (must be at least 25 if we want to substract 22) if (us <= 25) return; //= 3 cycles, (4 when true), (must be at least 25 if we want to subtract 22)
// compensate for the time taken by the preceeding and next commands (about 22 cycles) // compensate for the time taken by the preceding and next commands (about 22 cycles)
us -= 22; // = 2 cycles us -= 22; // = 2 cycles
// the following loop takes 4 microseconds (4 cycles) // the following loop takes 4 microseconds (4 cycles)
// per iteration, so execute it us/4 times // per iteration, so execute it us/4 times
......
...@@ -67,7 +67,7 @@ void pinMode(uint8_t pin, uint8_t mode) ...@@ -67,7 +67,7 @@ void pinMode(uint8_t pin, uint8_t mode)
// //
// Mark Sproul: // Mark Sproul:
// - Removed inline. Save 170 bytes on atmega1280 // - Removed inline. Save 170 bytes on atmega1280
// - changed to a switch statment; added 32 bytes but much easier to read and maintain. // - changed to a switch statement; added 32 bytes but much easier to read and maintain.
// - Added more #ifdefs, now compiles for atmega645 // - Added more #ifdefs, now compiles for atmega645
// //
//static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline)); //static inline void turnOffPWM(uint8_t timer) __attribute__ ((always_inline));
......
...@@ -53,7 +53,7 @@ This function does not return any value. ...@@ -53,7 +53,7 @@ This function does not return any value.
This function will retrieve any object from the EEPROM. This function will retrieve any object from the EEPROM.
Two parameters are needed to call this function. The first is an `int` containing the address that is to be written, and the second is the object you would like to read. Two parameters are needed to call this function. The first is an `int` containing the address that is to be written, and the second is the object you would like to read.
This function returns a reference to the `object` passed in. It does not need to be used and is only returned for conveience. This function returns a reference to the `object` passed in. It does not need to be used and is only returned for convenience.
#### **`EEPROM.put( address, object )`** [[_example_]](examples/eeprom_put/eeprom_put.ino) #### **`EEPROM.put( address, object )`** [[_example_]](examples/eeprom_put/eeprom_put.ino)
...@@ -62,7 +62,7 @@ Two parameters are needed to call this function. The first is an `int` containin ...@@ -62,7 +62,7 @@ Two parameters are needed to call this function. The first is an `int` containin
This function uses the _update_ method to write its data, and therefore only rewrites changed cells. This function uses the _update_ method to write its data, and therefore only rewrites changed cells.
This function returns a reference to the `object` passed in. It does not need to be used and is only returned for conveience. This function returns a reference to the `object` passed in. It does not need to be used and is only returned for convenience.
#### **Subscript operator: `EEPROM[address]`** [[_example_]](examples/eeprom_crc/eeprom_crc.ino) #### **Subscript operator: `EEPROM[address]`** [[_example_]](examples/eeprom_crc/eeprom_crc.ino)
...@@ -136,4 +136,4 @@ This is useful for STL objects, custom iteration and C++11 style ranged for loop ...@@ -136,4 +136,4 @@ This is useful for STL objects, custom iteration and C++11 style ranged for loop
This function returns an `EEPtr` pointing at the location after the last EEPROM cell. This function returns an `EEPtr` pointing at the location after the last EEPROM cell.
Used with `begin()` to provide custom iteration. Used with `begin()` to provide custom iteration.
**Note:** The `EEPtr` returned is invalid as it is out of range. Infact the hardware causes wrapping of the address (overflow) and `EEPROM.end()` actually references the first EEPROM cell. **Note:** The `EEPtr` returned is invalid as it is out of range. In fact the hardware causes wrapping of the address (overflow) and `EEPROM.end()` actually references the first EEPROM cell.
...@@ -18,9 +18,9 @@ void setup() { ...@@ -18,9 +18,9 @@ void setup() {
Iterate through each byte of the EEPROM storage. Iterate through each byte of the EEPROM storage.
Larger AVR processors have larger EEPROM sizes, E.g: Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage. - Arduino Duemilanove: 512 B EEPROM storage.
- Arduino Uno: 1kb EEPROM storage. - Arduino Uno: 1 kB EEPROM storage.
- Arduino Mega: 4kb EEPROM storage. - Arduino Mega: 4 kB EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function. Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors. This will make your code portable to all AVR processors.
......
...@@ -54,4 +54,4 @@ void setup() { ...@@ -54,4 +54,4 @@ void setup() {
} //End of setup function. } //End of setup function.
void loop() {} void loop() {}
\ No newline at end of file
...@@ -33,9 +33,9 @@ void loop() { ...@@ -33,9 +33,9 @@ void loop() {
Advance to the next address, when at the end restart at the beginning. Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g: Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage. - Arduino Duemilanove: 512 B EEPROM storage.
- Arduino Uno: 1kb EEPROM storage. - Arduino Uno: 1 kB EEPROM storage.
- Arduino Mega: 4kb EEPROM storage. - Arduino Mega: 4 kB EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function. Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors. This will make your code portable to all AVR processors.
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
int address = 0; int address = 0;
void setup() { void setup() {
/** EMpty setup **/ /** Empty setup **/
} }
void loop() { void loop() {
...@@ -48,9 +48,9 @@ void loop() { ...@@ -48,9 +48,9 @@ void loop() {
Advance to the next address, when at the end restart at the beginning. Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g: Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage. - Arduino Duemilanove: 512 B EEPROM storage.
- Arduino Uno: 1kb EEPROM storage. - Arduino Uno: 1 kB EEPROM storage.
- Arduino Mega: 4kb EEPROM storage. - Arduino Mega: 4 kB EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function. Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors. This will make your code portable to all AVR processors.
......
...@@ -36,9 +36,9 @@ void loop() { ...@@ -36,9 +36,9 @@ void loop() {
Advance to the next address, when at the end restart at the beginning. Advance to the next address, when at the end restart at the beginning.
Larger AVR processors have larger EEPROM sizes, E.g: Larger AVR processors have larger EEPROM sizes, E.g:
- Arduno Duemilanove: 512b EEPROM storage. - Arduino Duemilanove: 512 B EEPROM storage.
- Arduino Uno: 1kb EEPROM storage. - Arduino Uno: 1 kB EEPROM storage.
- Arduino Mega: 4kb EEPROM storage. - Arduino Mega: 4 kB EEPROM storage.
Rather than hard-coding the length, you should use the pre-provided length function. Rather than hard-coding the length, you should use the pre-provided length function.
This will make your code portable to all AVR processors. This will make your code portable to all AVR processors.
......
...@@ -43,7 +43,7 @@ int HID_::getDescriptor(USBSetup& setup) ...@@ -43,7 +43,7 @@ int HID_::getDescriptor(USBSetup& setup)
if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; } if (setup.bmRequestType != REQUEST_DEVICETOHOST_STANDARD_INTERFACE) { return 0; }
if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; } if (setup.wValueH != HID_REPORT_DESCRIPTOR_TYPE) { return 0; }
// In a HID Class Descriptor wIndex cointains the interface number // In a HID Class Descriptor wIndex contains the interface number
if (setup.wIndex != pluggedInterface) { return 0; } if (setup.wIndex != pluggedInterface) { return 0; }
int total = 0; int total = 0;
......
...@@ -43,7 +43,7 @@ void setup() { ...@@ -43,7 +43,7 @@ void setup() {
// start the SPI library: // start the SPI library:
SPI.begin(); SPI.begin();
// initalize the data ready and chip select pins: // initialize the data ready and chip select pins:
pinMode(dataReadyPin, INPUT); pinMode(dataReadyPin, INPUT);
pinMode(chipSelectPin, OUTPUT); pinMode(chipSelectPin, OUTPUT);
...@@ -140,4 +140,3 @@ void writeRegister(byte thisRegister, byte thisValue) { ...@@ -140,4 +140,3 @@ void writeRegister(byte thisRegister, byte thisValue) {
// take the chip select high to de-select: // take the chip select high to de-select:
digitalWrite(chipSelectPin, HIGH); digitalWrite(chipSelectPin, HIGH);
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
The circuit: The circuit:
* All A pins of AD5206 connected to +5V * All A pins of AD5206 connected to +5V
* All B pins of AD5206 connected to ground * All B pins of AD5206 connected to ground
* An LED and a 220-ohm resisor in series connected from each W pin to ground * An LED and a 220-ohm resistor in series connected from each W pin to ground
* CS - to digital pin 10 (SS pin) * CS - to digital pin 10 (SS pin)
* SDI - to digital pin 11 (MOSI pin) * SDI - to digital pin 11 (MOSI pin)
* CLK - to digital pin 13 (SCK pin) * CLK - to digital pin 13 (SCK pin)
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
*/ */
// inslude the SPI library: // include the SPI library:
#include <SPI.h> #include <SPI.h>
...@@ -64,7 +64,7 @@ void digitalPotWrite(int address, int value) { ...@@ -64,7 +64,7 @@ void digitalPotWrite(int address, int value) {
// take the SS pin low to select the chip: // take the SS pin low to select the chip:
digitalWrite(slaveSelectPin, LOW); digitalWrite(slaveSelectPin, LOW);
delay(100); delay(100);
// send in the address and value via SPI: // send in the address and value via SPI:
SPI.transfer(address); SPI.transfer(address);
SPI.transfer(value); SPI.transfer(value);
delay(100); delay(100);
......
...@@ -106,7 +106,7 @@ private: ...@@ -106,7 +106,7 @@ private:
// slowest (128 == 2 ^^ 7, so clock_div = 6). // slowest (128 == 2 ^^ 7, so clock_div = 6).
uint8_t clockDiv; uint8_t clockDiv;
// When the clock is known at compiletime, use this if-then-else // When the clock is known at compile time, use this if-then-else
// cascade, which the compiler knows how to completely optimize // cascade, which the compiler knows how to completely optimize
// away. When clock is not known, use a loop instead, which generates // away. When clock is not known, use a loop instead, which generates
// shorter code. // shorter code.
......
/* /*
Software serial multple serial test Software serial multiple serial test
Receives from the hardware serial, sends to software serial. Receives from the hardware serial, sends to software serial.
Receives from software serial, sends to hardware serial. Receives from software serial, sends to hardware serial.
...@@ -52,4 +52,3 @@ void loop() { // run over and over ...@@ -52,4 +52,3 @@ void loop() { // run over and over
mySerial.write(Serial.read()); mySerial.write(Serial.read());
} }
} }
/* /*
Software serial multple serial test Software serial multiple serial test
Receives from the two software serial ports, Receives from the two software serial ports,
sends to the hardware serial port. sends to the hardware serial port.
...@@ -56,7 +56,7 @@ void setup() { ...@@ -56,7 +56,7 @@ void setup() {
} }
void loop() { void loop() {
// By default, the last intialized port is listening. // By default, the last initialized port is listening.
// when you want to listen on a port, explicitly select it: // when you want to listen on a port, explicitly select it:
portOne.listen(); portOne.listen();
Serial.println("Data from port one:"); Serial.println("Data from port one:");
...@@ -83,9 +83,3 @@ void loop() { ...@@ -83,9 +83,3 @@ void loop() {
// blank line to separate data from the two ports: // blank line to separate data from the two ports:
Serial.println(); Serial.println();
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// and James Tichenor <http://www.jamestichenor.net> // and James Tichenor <http://www.jamestichenor.net>
// Demonstrates use of the Wire library reading data from the // Demonstrates use of the Wire library reading data from the
// Devantech Utrasonic Rangers SFR08 and SFR10 // Devantech Ultrasonic Rangers SFR08 and SFR10
// Created 29 April 2006 // Created 29 April 2006
...@@ -13,8 +13,8 @@ ...@@ -13,8 +13,8 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(); // join i2c bus (address optional for master) Wire.begin(); // join I2C bus (address optional for master)
Serial.begin(9600); // start serial communication at 9600bps Serial.begin(9600); // start serial communication at 9600 bps
} }
int reading = 0; int reading = 0;
...@@ -23,7 +23,7 @@ void loop() { ...@@ -23,7 +23,7 @@ void loop() {
// step 1: instruct sensor to read echoes // step 1: instruct sensor to read echoes
Wire.beginTransmission(112); // transmit to device #112 (0x70) Wire.beginTransmission(112); // transmit to device #112 (0x70)
// the address specified in the datasheet is 224 (0xE0) // the address specified in the datasheet is 224 (0xE0)
// but i2c adressing uses the high 7 bits so it's 112 // but I2C addressing uses the high 7 bits so it's 112
Wire.write(byte(0x00)); // sets register pointer to the command register (0x00) Wire.write(byte(0x00)); // sets register pointer to the command register (0x00)
Wire.write(byte(0x50)); // command sensor to measure in "inches" (0x50) Wire.write(byte(0x50)); // command sensor to measure in "inches" (0x50)
// use 0x51 for centimeters // use 0x51 for centimeters
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(); // join i2c bus (address optional for master) Wire.begin(); // join I2C bus (address optional for master)
} }
byte val = 0; byte val = 0;
...@@ -31,4 +31,3 @@ void loop() { ...@@ -31,4 +31,3 @@ void loop() {
} }
delay(500); delay(500);
} }
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// This program (or code that looks like it) // This program (or code that looks like it)
// can be found in many places. // can be found in many places.
// For example on the Arduino.cc forum. // For example on the Arduino.cc forum.
// The original author is not know. // The original author is not known.
// Version 2, Juni 2012, Using Arduino 1.0.1 // Version 2, Juni 2012, Using Arduino 1.0.1
// Adapted to be as simple as possible by Arduino.cc user Krodal // Adapted to be as simple as possible by Arduino.cc user Krodal
// Version 3, Feb 26 2013 // Version 3, Feb 26 2013
...@@ -33,7 +33,7 @@ void setup() { ...@@ -33,7 +33,7 @@ void setup() {
Wire.begin(); Wire.begin();
Serial.begin(9600); Serial.begin(9600);
while (!Serial); // Leonardo: wait for serial monitor while (!Serial); // Leonardo: wait for Serial Monitor
Serial.println("\nI2C Scanner"); Serial.println("\nI2C Scanner");
} }
...@@ -44,7 +44,7 @@ void loop() { ...@@ -44,7 +44,7 @@ void loop() {
for (byte address = 1; address < 127; ++address) { for (byte address = 1; address < 127; ++address) {
// The i2c_scanner uses the return value of // The i2c_scanner uses the return value of
// the Write.endTransmisstion to see if // the Wire.endTransmission to see if
// a device did acknowledge to the address. // a device did acknowledge to the address.
Wire.beginTransmission(address); Wire.beginTransmission(address);
byte error = Wire.endTransmission(); byte error = Wire.endTransmission();
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(); // join i2c bus (address optional for master) Wire.begin(); // join I2C bus (address optional for master)
Serial.begin(9600); // start serial for output Serial.begin(9600); // start serial for output
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(); // join i2c bus (address optional for master) Wire.begin(); // join I2C bus (address optional for master)
} }
byte x = 0; byte x = 0;
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(8); // join i2c bus with address #8 Wire.begin(8); // join I2C bus with address #8
Wire.onReceive(receiveEvent); // register event Wire.onReceive(receiveEvent); // register event
Serial.begin(9600); // start serial for output Serial.begin(9600); // start serial for output
} }
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include <Wire.h> #include <Wire.h>
void setup() { void setup() {
Wire.begin(8); // join i2c bus with address #8 Wire.begin(8); // join I2C bus with address #8
Wire.onRequest(requestEvent); // register event Wire.onRequest(requestEvent); // register event
} }
......
...@@ -100,7 +100,7 @@ void TwoWire::setClock(uint32_t clock) ...@@ -100,7 +100,7 @@ void TwoWire::setClock(uint32_t clock)
* when `clearWireTimeoutFlag()` or `setWireTimeoutUs()` is called. * when `clearWireTimeoutFlag()` or `setWireTimeoutUs()` is called.
* *
* Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master * Note that this timeout can also trigger while waiting for clock stretching or waiting for a second master
* to complete its transaction. So make sure to adapt the timeout to accomodate for those cases if needed. * to complete its transaction. So make sure to adapt the timeout to accommodate for those cases if needed.
* A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol), * A typical timeout would be 25ms (which is the maximum clock stretching allowed by the SMBus protocol),
* but (much) shorter values will usually also work. * but (much) shorter values will usually also work.
* *
...@@ -120,7 +120,7 @@ void TwoWire::setWireTimeout(uint32_t timeout, bool reset_with_timeout){ ...@@ -120,7 +120,7 @@ void TwoWire::setWireTimeout(uint32_t timeout, bool reset_with_timeout){
/*** /***
* Returns the TWI timeout flag. * Returns the TWI timeout flag.
* *
* @return true if timeout has occured since the flag was last cleared. * @return true if timeout has occurred since the flag was last cleared.
*/ */
bool TwoWire::getWireTimeoutFlag(void){ bool TwoWire::getWireTimeoutFlag(void){
return(twi_manageTimeoutFlag(false)); return(twi_manageTimeoutFlag(false));
......
...@@ -175,7 +175,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen ...@@ -175,7 +175,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen
} }
twi_state = TWI_MRX; twi_state = TWI_MRX;
twi_sendStop = sendStop; twi_sendStop = sendStop;
// reset error state (0xFF.. no error occured) // reset error state (0xFF.. no error occurred)
twi_error = 0xFF; twi_error = 0xFF;
// initialize buffer iteration vars // initialize buffer iteration vars
...@@ -183,7 +183,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen ...@@ -183,7 +183,7 @@ uint8_t twi_readFrom(uint8_t address, uint8_t* data, uint8_t length, uint8_t sen
twi_masterBufferLength = length-1; // This is not intuitive, read on... twi_masterBufferLength = length-1; // This is not intuitive, read on...
// On receive, the previously configured ACK/NACK setting is transmitted in // On receive, the previously configured ACK/NACK setting is transmitted in
// response to the received byte before the interrupt is signalled. // response to the received byte before the interrupt is signalled.
// Therefor we must actually set NACK when the _next_ to last byte is // Therefore we must actually set NACK when the _next_ to last byte is
// received, causing that NACK to be sent in response to receiving the last // received, causing that NACK to be sent in response to receiving the last
// expected byte of data. // expected byte of data.
...@@ -269,7 +269,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait ...@@ -269,7 +269,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait
} }
twi_state = TWI_MTX; twi_state = TWI_MTX;
twi_sendStop = sendStop; twi_sendStop = sendStop;
// reset error state (0xFF.. no error occured) // reset error state (0xFF.. no error occurred)
twi_error = 0xFF; twi_error = 0xFF;
// initialize buffer iteration vars // initialize buffer iteration vars
...@@ -294,7 +294,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait ...@@ -294,7 +294,7 @@ uint8_t twi_writeTo(uint8_t address, uint8_t* data, uint8_t length, uint8_t wait
// We need to remove ourselves from the repeated start state before we enable interrupts, // We need to remove ourselves from the repeated start state before we enable interrupts,
// since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning // since the ISR is ASYNC, and we could get confused if we hit the ISR before cleaning
// up. Also, don't enable the START interrupt. There may be one pending from the // up. Also, don't enable the START interrupt. There may be one pending from the
// repeated start that we sent outselves, and that would really confuse things. // repeated start that we sent ourselves, and that would really confuse things.
twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR twi_inRepStart = false; // remember, we're dealing with an ASYNC ISR
startMicros = micros(); startMicros = micros();
do { do {
...@@ -411,7 +411,7 @@ void twi_stop(void) ...@@ -411,7 +411,7 @@ void twi_stop(void)
// send stop condition // send stop condition
TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO); TWCR = _BV(TWEN) | _BV(TWIE) | _BV(TWEA) | _BV(TWINT) | _BV(TWSTO);
// wait for stop condition to be exectued on bus // wait for stop condition to be executed on bus
// TWINT is not set after a stop condition! // TWINT is not set after a stop condition!
// We cannot use micros() from an ISR, so approximate the timeout with cycle-counted delays // We cannot use micros() from an ISR, so approximate the timeout with cycle-counted delays
const uint8_t us_per_loop = 8; const uint8_t us_per_loop = 8;
......
...@@ -81,7 +81,7 @@ buspirate.program.extra_params=-P{serial.port} ...@@ -81,7 +81,7 @@ buspirate.program.extra_params=-P{serial.port}
# STK500 firmware version v1 and v2 use different serial protocols. # STK500 firmware version v1 and v2 use different serial protocols.
# Using the 'stk500' protocol tells avrdude to try and autodetect the # Using the 'stk500' protocol tells avrdude to try and autodetect the
# firmware version. If this leads to problems, we might need to add # firmware version. If this leads to problems, we might need to add
# stk500v1 and stk500v2 entries to allow explicitely selecting the # stk500v1 and stk500v2 entries to allow explicitly selecting the
# firmware version. # firmware version.
stk500.name=Atmel STK500 development board stk500.name=Atmel STK500 development board
stk500.communication=serial stk500.communication=serial
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment