Skip to content

Commit ea8a4ec

Browse files
author
Federico Fissore
committed
Merge branch 'ide-1.5.x' into ide-1.5.x-jssc
2 parents 9c618ff + fe6295e commit ea8a4ec

File tree

29 files changed

+142
-91
lines changed

29 files changed

+142
-91
lines changed

app/src/processing/app/Base.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@
6161
* files and images, etc) that comes from that.
6262
*/
6363
public class Base {
64-
public static final int REVISION = 154;
64+
public static final int REVISION = 155;
6565
/** This might be replaced by main() if there's a lib/version.txt file. */
66-
static String VERSION_NAME = "0154";
66+
static String VERSION_NAME = "0155";
6767
/** Set true if this a proper release rather than a numbered revision. */
6868
static public boolean RELEASE = false;
6969

app/src/processing/app/packages/Library.java

+7-16
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package processing.app.packages;
22

3-
import processing.app.helpers.FileUtils;
4-
import processing.app.helpers.PreferencesMap;
3+
import static processing.app.helpers.StringUtils.wildcardMatch;
54

65
import java.io.File;
76
import java.io.IOException;
@@ -10,7 +9,8 @@
109
import java.util.Comparator;
1110
import java.util.List;
1211

13-
import static processing.app.helpers.StringUtils.wildcardMatch;
12+
import processing.app.helpers.FileUtils;
13+
import processing.app.helpers.PreferencesMap;
1414

1515
public class Library {
1616

@@ -31,17 +31,12 @@ public class Library {
3131
.asList(new String[] { "architectures", "author", "core-dependencies",
3232
"dependencies", "email", "name", "paragraph", "sentence", "url",
3333
"version" });
34-
private static final List<String> OPTIONAL_FOLDERS = Arrays
35-
.asList(new String[] { "arch", "examples", "extras", "src" });
36-
private static final List<String> OPTIONAL_FILES = Arrays
37-
.asList(new String[] { "keywords.txt", "library.properties" });
38-
3934

4035
/**
4136
* Scans inside a folder and create a Library object out of it. Automatically
4237
* detects pre-1.5 libraries. Automatically fills metadata from
4338
* library.properties file if found.
44-
*
39+
*
4540
* @param libFolder
4641
* @return
4742
*/
@@ -74,18 +69,14 @@ private static Library createLibrary(File libFolder) throws IOException {
7469
if (!srcFolder.exists() || !srcFolder.isDirectory())
7570
throw new IOException("Missing 'src' folder");
7671

77-
// 3. check if root folder contains prohibited stuff
72+
// 3. Warn if root folder contains development leftovers
7873
for (File file : libFolder.listFiles()) {
7974
if (file.isDirectory()) {
8075
if (FileUtils.isSCCSOrHiddenFile(file)) {
81-
System.out.println("WARNING: Ignoring spurious " + file.getName() + " folder in '" + properties.get("name") + "' library");
76+
System.out.println("WARNING: Spurious " + file.getName() +
77+
" folder in '" + properties.get("name") + "' library");
8278
continue;
8379
}
84-
if (!OPTIONAL_FOLDERS.contains(file.getName()))
85-
throw new IOException("Invalid folder '" + file.getName() + "'.");
86-
} else {
87-
if (!OPTIONAL_FILES.contains(file.getName()))
88-
throw new IOException("Invalid file '" + file.getName() + "'.");
8980
}
9081
}
9182

build/build.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,8 @@
664664
</copy>
665665

666666
<!-- Unzip AVR tools -->
667-
<unzip dest="windows/work/hardware" src="windows/avr_tools.zip" overwrite="false"/>
667+
<get src="http://downloads.arduino.cc/WinAVR-20081205-arduino-2.zip" dest="windows" usetimestamp="true" skipexisting="true" verbose="true" />
668+
<unzip dest="windows/work/hardware" src="windows/WinAVR-20081205-arduino-2.zip" overwrite="false"/>
668669

669670
<copy todir="windows/work/hardware/tools/avr/avr/include/avr">
670671
<fileset file="windows/eeprom.h" />

build/shared/revisions.txt

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
ARDUINO 1.5.5 BETA
33

4+
NOTICE:
5+
The 1.5 library format is under heavy review on the Arduino Developers mailing list.
6+
We suggest to delay the adoption of the new format until a stable 1.5.x is released.
7+
48
[ide]
59
* Added missing keywords: YunServer, YunClient, pow
610
* Improved folder ignore: now hidden, starting with a dot, and SCCS folders are ignored
@@ -11,6 +15,7 @@ ARDUINO 1.5.5 BETA
1115
* (windows) Upgraded embedded Java runtime to version 7: much faster startup
1216
* Improved files open/save dialogs
1317
* Added line numbers, can be enabled/disabled from preferences (Cayci Gorlitsky)
18+
* Removed check on forbidden file in 1.5 formatted libraries (#1692)
1419

1520
[libraries]
1621
* avr: Fixed buffer overflow in File::doBuffer() (dreggy)

build/windows/avr_tools.zip

-40.7 MB
Binary file not shown.

libraries/SPI/arch/avr/SPI.cpp renamed to hardware/arduino/avr/libraries/SPI/SPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*/
1010

1111
#include "pins_arduino.h"
12-
#include "SPI_Class.h"
12+
#include "SPI.h"
1313

1414
SPIClass SPI;
1515

libraries/SPI/arch/sam/SPI.cpp renamed to hardware/arduino/sam/libraries/SPI/SPI.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* published by the Free Software Foundation.
99
*/
1010

11-
#include "SPI_Class.h"
11+
#include "SPI.h"
1212

1313
SPIClass::SPIClass(Spi *_spi, uint32_t _id, void(*_initCb)(void)) :
1414
spi(_spi), id(_id), initCb(_initCb), initialized(false)
+8-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
SCP1000 Barometric Pressure Sensor Display
2+
SCP1000 Barometric Pressure Sensor Display
33
44
Shows the output of a Barometric Pressure Sensor on a
55
Uses the SPI library. For details on the sensor, see:
@@ -29,8 +29,9 @@
2929
const int PRESSURE = 0x1F; //3 most significant bits of pressure
3030
const int PRESSURE_LSB = 0x20; //16 least significant bits of pressure
3131
const int TEMPERATURE = 0x21; //16 bit temperature reading
32-
cont byte READ = 0b00000000; // SCP1000's read command
32+
const byte READ = 0b11111100; // SCP1000's read command
3333
const byte WRITE = 0b00000010; // SCP1000's write command
34+
3435
// pins used for the connection with the sensor
3536
// the other you need are controlled by the SPI library):
3637
const int dataReadyPin = 6;
@@ -87,13 +88,14 @@ void loop() {
8788
unsigned int readRegister(byte thisRegister, int bytesToRead ) {
8889
byte inByte = 0; // incoming byte from the SPI
8990
unsigned int result = 0; // result to return
90-
91+
Serial.print(thisRegister, BIN);
92+
Serial.print("\t");
9193
// SCP1000 expects the register name in the upper 6 bits
9294
// of the byte. So shift the bits left by two bits:
9395
thisRegister = thisRegister << 2;
9496
// now combine the address and the command into one byte
95-
dataToSend = thisRegister & READ;
96-
97+
byte dataToSend = thisRegister & READ;
98+
Serial.println(thisRegister, BIN);
9799
// take the chip select low to select the device:
98100
digitalWrite(chipSelectPin, LOW);
99101
// send the device the register you want to read:
@@ -127,7 +129,7 @@ void writeRegister(byte thisRegister, byte thisValue) {
127129
// of the byte. So shift the bits left by two bits:
128130
thisRegister = thisRegister << 2;
129131
// now combine the register address and the command into one byte:
130-
dataToSend = thisRegister | WRITE;
132+
byte dataToSend = thisRegister | WRITE;
131133

132134
// take the chip select low to select the device:
133135
digitalWrite(chipSelectPin, LOW);
@@ -139,5 +141,3 @@ void writeRegister(byte thisRegister, byte thisValue) {
139141
digitalWrite(chipSelectPin, HIGH);
140142
}
141143

142-
143-
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
/*
2+
Digital Pot Control
3+
4+
This example controls an Analog Devices AD5206 digital potentiometer.
5+
The AD5206 has 6 potentiometer channels. Each channel's pins are labeled
6+
A - connect this to voltage
7+
W - this is the pot's wiper, which changes when you set it
8+
B - connect this to ground.
9+
10+
The AD5206 is SPI-compatible,and to command it, you send two bytes,
11+
one with the channel number (0 - 5) and one with the resistance value for the
12+
channel (0 - 255).
13+
14+
The circuit:
15+
* All A pins of AD5206 connected to +5V
16+
* All B pins of AD5206 connected to ground
17+
* An LED and a 220-ohm resisor in series connected from each W pin to ground
18+
* CS - to digital pin 10 (SS pin)
19+
* SDI - to digital pin 11 (MOSI pin)
20+
* CLK - to digital pin 13 (SCK pin)
21+
22+
created 10 Aug 2010
23+
by Tom Igoe
24+
25+
Thanks to Heather Dewey-Hagborg for the original tutorial, 2005
26+
27+
*/
28+
29+
30+
// inslude the SPI library:
31+
#include <SPI.h>
32+
33+
34+
// set pin 10 as the slave select for the digital pot:
35+
const int slaveSelectPin = 10;
36+
37+
void setup() {
38+
// set the slaveSelectPin as an output:
39+
pinMode (slaveSelectPin, OUTPUT);
40+
// initialize SPI:
41+
SPI.begin();
42+
}
43+
44+
void loop() {
45+
// go through the six channels of the digital pot:
46+
for (int channel = 0; channel < 6; channel++) {
47+
// change the resistance on this channel from min to max:
48+
for (int level = 0; level < 255; level++) {
49+
digitalPotWrite(channel, level);
50+
delay(10);
51+
}
52+
// wait a second at the top:
53+
delay(100);
54+
// change the resistance on this channel from max to min:
55+
for (int level = 0; level < 255; level++) {
56+
digitalPotWrite(channel, 255 - level);
57+
delay(10);
58+
}
59+
}
60+
61+
}
62+
63+
void digitalPotWrite(int address, int value) {
64+
// take the SS pin low to select the chip:
65+
digitalWrite(slaveSelectPin, LOW);
66+
// send in the address and value via SPI:
67+
SPI.transfer(address);
68+
SPI.transfer(value);
69+
// take the SS pin high to de-select the chip:
70+
digitalWrite(slaveSelectPin, HIGH);
71+
}

libraries/Bridge/src/Bridge.cpp

+10-2
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,9 @@ void BridgeClass::begin() {
5757

5858
// Reset the brigde to check if it is running
5959
uint8_t cmd[] = {'X', 'X', '1', '0', '0'};
60-
uint8_t res[1];
60+
uint8_t res[4];
6161
max_retries = 50;
62-
uint16_t l = transfer(cmd, 5, res, 1);
62+
uint16_t l = transfer(cmd, 5, res, 4);
6363
if (l == TRANSFER_TIMEOUT) {
6464
// Bridge didn't start...
6565
// Maybe the board is starting-up?
@@ -71,6 +71,14 @@ void BridgeClass::begin() {
7171
if (res[0] != 0)
7272
while (true);
7373

74+
// Detect bridge version
75+
if (l == 4) {
76+
bridgeVersion = (res[1]-'0')*100 + (res[2]-'0')*10 + (res[3]-'0');
77+
} else {
78+
// Bridge v1.0.0 didn't send any version info
79+
bridgeVersion = 100;
80+
}
81+
7482
max_retries = 50;
7583
return;
7684
}

libraries/Bridge/src/Bridge.h

+6
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,18 @@ class BridgeClass {
6161
return transfer(buff1, len1, buff2, len2, NULL, 0, rxbuff, rxlen);
6262
}
6363

64+
uint16_t getBridgeVersion()
65+
{
66+
return bridgeVersion;
67+
}
68+
6469
static const int TRANSFER_TIMEOUT = 0xFFFF;
6570

6671
private:
6772
uint8_t index;
6873
int timedRead(unsigned int timeout);
6974
void dropAll();
75+
uint16_t bridgeVersion;
7076

7177
private:
7278
void crcUpdate(uint8_t c);

libraries/Bridge/src/FileIO.cpp

+28-2
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,35 @@ int File::available() {
137137
void File::flush() {
138138
}
139139

140-
//int read(void *buf, uint16_t nbyte)
140+
int File::read(void *buff, uint16_t nbyte) {
141+
uint16_t n = 0;
142+
uint8_t *p = reinterpret_cast<uint8_t *>(buff);
143+
while (n < nbyte) {
144+
if (buffered == 0) {
145+
doBuffer();
146+
if (buffered == 0)
147+
break;
148+
}
149+
*p++ = buffer[readPos++];
150+
buffered--;
151+
n++;
152+
}
153+
return n;
154+
}
141155

142-
//uint32_t size()
156+
uint32_t File::size() {
157+
if (bridge.getBridgeVersion() < 101)
158+
return 0;
159+
uint8_t cmd[] = {'t', handle};
160+
uint8_t buff[5];
161+
bridge.transfer(cmd, 2, buff, 5);
162+
//err = res[0]; // First byte is error code
163+
uint32_t res = buff[1] << 24;
164+
res += buff[2] << 16;
165+
res += buff[3] << 8;
166+
res += buff[4];
167+
return res;
168+
}
143169

144170
void File::close() {
145171
if (mode == 255)

libraries/Bridge/src/FileIO.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class FileSystemClass {
8383
// Methods to determine if the requested file path exists.
8484
boolean exists(const char *filepath);
8585

86-
// Create the requested directory heirarchy--if intermediate directories
86+
// Create the requested directory hierarchy--if intermediate directories
8787
// do not exist they will be created.
8888
boolean mkdir(const char *filepath);
8989

libraries/EEPROM/library.properties

-10
This file was deleted.

libraries/SPI/keywords.txt

-36
This file was deleted.

libraries/SPI/library.properties

-10
This file was deleted.

libraries/SPI/src/SPI.h

-1
This file was deleted.

0 commit comments

Comments
 (0)