Skip to content

Commit 989f672

Browse files
committed
Merge branch 'master' of github.com:arduino/Arduino into new-extension
2 parents 28e9e12 + dd5bae5 commit 989f672

File tree

10 files changed

+87
-72
lines changed

10 files changed

+87
-72
lines changed

boards.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
13
##############################################################
24

35
uno.name=Arduino Uno

cores/arduino/Arduino.h

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ extern "C"{
2020

2121
#define INPUT 0x0
2222
#define OUTPUT 0x1
23+
#define INPUT_PULLUP 0x2
2324

2425
#define true 0x1
2526
#define false 0x0

cores/arduino/Stream.cpp

+11-9
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,27 @@ bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t
9999
size_t index = 0; // maximum target string length is 64k bytes!
100100
size_t termIndex = 0;
101101
int c;
102-
102+
103103
if( *target == 0)
104-
return true; // return true if target is a null string
104+
return true; // return true if target is a null string
105105
while( (c = timedRead()) > 0){
106+
107+
if(c != target[index])
108+
index = 0; // reset index if any char does not match
109+
106110
if( c == target[index]){
107-
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
111+
//////Serial.print("found "); Serial.write(c); Serial.print("index now"); Serial.println(index+1);
108112
if(++index >= targetLen){ // return true if all chars in the target match
109113
return true;
110114
}
111115
}
112-
else{
113-
index = 0; // reset index if any char does not match
114-
}
116+
115117
if(termLen > 0 && c == terminator[termIndex]){
116-
if(++termIndex >= termLen)
117-
return false; // return false if terminate string found before target string
118+
if(++termIndex >= termLen)
119+
return false; // return false if terminate string found before target string
118120
}
119121
else
120-
termIndex = 0;
122+
termIndex = 0;
121123
}
122124
return false;
123125
}

cores/arduino/WInterrupts.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232

3333
#include "wiring_private.h"
3434

35-
volatile static voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
35+
static volatile voidFuncPtr intFunc[EXTERNAL_NUM_INTERRUPTS];
3636
// volatile static voidFuncPtr twiIntFunc;
3737

3838
void attachInterrupt(uint8_t interruptNum, void (*userFunc)(void), int mode) {

cores/arduino/WString.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ int String::lastIndexOf( char theChar ) const
500500

501501
int String::lastIndexOf(char ch, unsigned int fromIndex) const
502502
{
503-
if (fromIndex >= len || fromIndex < 0) return -1;
503+
if (fromIndex >= len) return -1;
504504
char tempchar = buffer[fromIndex + 1];
505505
buffer[fromIndex + 1] = '\0';
506506
char* temp = strrchr( buffer, ch );
@@ -516,7 +516,7 @@ int String::lastIndexOf(const String &s2) const
516516

517517
int String::lastIndexOf(const String &s2, unsigned int fromIndex) const
518518
{
519-
if (s2.len == 0 || len == 0 || s2.len > len || fromIndex < 0) return -1;
519+
if (s2.len == 0 || len == 0 || s2.len > len) return -1;
520520
if (fromIndex >= len) fromIndex = len - 1;
521521
int found = -1;
522522
for (char *p = buffer; p <= buffer + fromIndex; p++) {

cores/arduino/wiring_digital.c

+9-1
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,25 @@ void pinMode(uint8_t pin, uint8_t mode)
3232
{
3333
uint8_t bit = digitalPinToBitMask(pin);
3434
uint8_t port = digitalPinToPort(pin);
35-
volatile uint8_t *reg;
35+
volatile uint8_t *reg, *out;
3636

3737
if (port == NOT_A_PIN) return;
3838

3939
// JWS: can I let the optimizer do this?
4040
reg = portModeRegister(port);
41+
out = portOutputRegister(port);
4142

4243
if (mode == INPUT) {
4344
uint8_t oldSREG = SREG;
4445
cli();
4546
*reg &= ~bit;
47+
*out &= ~bit;
48+
SREG = oldSREG;
49+
} else if (mode == INPUT_PULLUP) {
50+
uint8_t oldSREG = SREG;
51+
cli();
52+
*reg &= ~bit;
53+
*out |= bit;
4654
SREG = oldSREG;
4755
} else {
4856
uint8_t oldSREG = SREG;

programmers.txt

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# See: http://code.google.com/p/arduino/wiki/Platforms
2+
13
avrisp.name=AVR ISP
24
avrisp.communication=serial
35
avrisp.protocol=stk500v1

variants/leonardo/pins_arduino.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -35,29 +35,29 @@
3535
#define RXLED0 PORTB |= (1<<0)
3636
#define RXLED1 PORTB &= ~(1<<0)
3737

38-
const static uint8_t SDA = 2;
39-
const static uint8_t SCL = 3;
38+
static const uint8_t SDA = 2;
39+
static const uint8_t SCL = 3;
4040

4141
// Map SPI port to 'new' pins D14..D17
42-
const static uint8_t SS = 17;
43-
const static uint8_t MOSI = 16;
44-
const static uint8_t MISO = 14;
45-
const static uint8_t SCK = 15;
42+
static const uint8_t SS = 17;
43+
static const uint8_t MOSI = 16;
44+
static const uint8_t MISO = 14;
45+
static const uint8_t SCK = 15;
4646

4747
// Mapping of analog pins as digital I/O
4848
// A6-A11 share with digital pins
49-
const static uint8_t A0 = 18;
50-
const static uint8_t A1 = 19;
51-
const static uint8_t A2 = 20;
52-
const static uint8_t A3 = 21;
53-
const static uint8_t A4 = 22;
54-
const static uint8_t A5 = 23;
55-
const static uint8_t A6 = 24; // D4
56-
const static uint8_t A7 = 25; // D6
57-
const static uint8_t A8 = 26; // D8
58-
const static uint8_t A9 = 27; // D9
59-
const static uint8_t A10 = 28; // D10
60-
const static uint8_t A11 = 29; // D12
49+
static const uint8_t A0 = 18;
50+
static const uint8_t A1 = 19;
51+
static const uint8_t A2 = 20;
52+
static const uint8_t A3 = 21;
53+
static const uint8_t A4 = 22;
54+
static const uint8_t A5 = 23;
55+
static const uint8_t A6 = 24; // D4
56+
static const uint8_t A7 = 25; // D6
57+
static const uint8_t A8 = 26; // D8
58+
static const uint8_t A9 = 27; // D9
59+
static const uint8_t A10 = 28; // D10
60+
static const uint8_t A11 = 29; // D12
6161

6262
// __AVR_ATmega32U4__ has an unusual mapping of pins to channels
6363
extern const uint8_t PROGMEM analog_pin_to_channel_PGM[];

variants/mega/pins_arduino.h

+23-23
Original file line numberDiff line numberDiff line change
@@ -32,31 +32,31 @@
3232
#define analogInputToDigitalPin(p) ((p < 16) ? (p) + 54 : -1)
3333
#define digitalPinHasPWM(p) (((p) >= 2 && (p) <= 13) || ((p) >= 44 && (p)<= 46))
3434

35-
const static uint8_t SS = 53;
36-
const static uint8_t MOSI = 51;
37-
const static uint8_t MISO = 50;
38-
const static uint8_t SCK = 52;
35+
static const uint8_t SS = 53;
36+
static const uint8_t MOSI = 51;
37+
static const uint8_t MISO = 50;
38+
static const uint8_t SCK = 52;
3939

40-
const static uint8_t SDA = 20;
41-
const static uint8_t SCL = 21;
42-
const static uint8_t LED_BUILTIN = 13;
40+
static const uint8_t SDA = 20;
41+
static const uint8_t SCL = 21;
42+
static const uint8_t LED_BUILTIN = 13;
4343

44-
const static uint8_t A0 = 54;
45-
const static uint8_t A1 = 55;
46-
const static uint8_t A2 = 56;
47-
const static uint8_t A3 = 57;
48-
const static uint8_t A4 = 58;
49-
const static uint8_t A5 = 59;
50-
const static uint8_t A6 = 60;
51-
const static uint8_t A7 = 61;
52-
const static uint8_t A8 = 62;
53-
const static uint8_t A9 = 63;
54-
const static uint8_t A10 = 64;
55-
const static uint8_t A11 = 65;
56-
const static uint8_t A12 = 66;
57-
const static uint8_t A13 = 67;
58-
const static uint8_t A14 = 68;
59-
const static uint8_t A15 = 69;
44+
static const uint8_t A0 = 54;
45+
static const uint8_t A1 = 55;
46+
static const uint8_t A2 = 56;
47+
static const uint8_t A3 = 57;
48+
static const uint8_t A4 = 58;
49+
static const uint8_t A5 = 59;
50+
static const uint8_t A6 = 60;
51+
static const uint8_t A7 = 61;
52+
static const uint8_t A8 = 62;
53+
static const uint8_t A9 = 63;
54+
static const uint8_t A10 = 64;
55+
static const uint8_t A11 = 65;
56+
static const uint8_t A12 = 66;
57+
static const uint8_t A13 = 67;
58+
static const uint8_t A14 = 68;
59+
static const uint8_t A15 = 69;
6060

6161
// A majority of the pins are NOT PCINTs, SO BE WARNED (i.e. you cannot use them as receive pins)
6262
// Only pins available for RECEIVE (TRANSMIT can be on any pin):

variants/standard/pins_arduino.h

+18-18
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@
3737
#define digitalPinHasPWM(p) ((p) == 3 || (p) == 5 || (p) == 6 || (p) == 9 || (p) == 10 || (p) == 11)
3838
#endif
3939

40-
const static uint8_t SS = 10;
41-
const static uint8_t MOSI = 11;
42-
const static uint8_t MISO = 12;
43-
const static uint8_t SCK = 13;
44-
45-
const static uint8_t SDA = 18;
46-
const static uint8_t SCL = 19;
47-
const static uint8_t LED_BUILTIN = 13;
48-
49-
const static uint8_t A0 = 14;
50-
const static uint8_t A1 = 15;
51-
const static uint8_t A2 = 16;
52-
const static uint8_t A3 = 17;
53-
const static uint8_t A4 = 18;
54-
const static uint8_t A5 = 19;
55-
const static uint8_t A6 = 20;
56-
const static uint8_t A7 = 21;
40+
static const uint8_t SS = 10;
41+
static const uint8_t MOSI = 11;
42+
static const uint8_t MISO = 12;
43+
static const uint8_t SCK = 13;
44+
45+
static const uint8_t SDA = 18;
46+
static const uint8_t SCL = 19;
47+
static const uint8_t LED_BUILTIN = 13;
48+
49+
static const uint8_t A0 = 14;
50+
static const uint8_t A1 = 15;
51+
static const uint8_t A2 = 16;
52+
static const uint8_t A3 = 17;
53+
static const uint8_t A4 = 18;
54+
static const uint8_t A5 = 19;
55+
static const uint8_t A6 = 20;
56+
static const uint8_t A7 = 21;
5757

5858
#define digitalPinToPCICR(p) (((p) >= 0 && (p) <= 21) ? (&PCICR) : ((uint8_t *)0))
5959
#define digitalPinToPCICRbit(p) (((p) <= 7) ? 2 : (((p) <= 13) ? 0 : 1))
@@ -215,4 +215,4 @@ const uint8_t PROGMEM digital_pin_to_timer_PGM[] = {
215215

216216
#endif
217217

218-
#endif
218+
#endif

0 commit comments

Comments
 (0)