Skip to content

Commit bf6158e

Browse files
committed
Merge branch '1.0.5'
2 parents 5b3a6a1 + 64e1c32 commit bf6158e

File tree

667 files changed

+471
-208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

667 files changed

+471
-208
lines changed

Diff for: README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# OpenTracker - Arduino Boards Manager
22

3-
Works with Arduino IDEs version 1.6.x and later (tested up to 1.6.13)
3+
Works with Arduino IDEs version 1.6.4 and later (tested up to 1.8.2)
44

55
Open the menu "File" > "Preferences" and add the following text to the box "Additional Boards Manager URLs":
66
https://raw.githubusercontent.com/geolink/opentracker-arduino-board/master/package_opentracker_index.json

Diff for: package_opentracker_index.json

+25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,31 @@
99
"online": "https://geolink.io/opentracker.php"
1010
},
1111
"platforms": [
12+
{
13+
"name": "OpenTracker Boards (32-bits ARM Cortex-M3)",
14+
"architecture": "sam",
15+
"version": "1.0.5",
16+
"category": "Contributed",
17+
"url": "https://github.com/geolink/opentracker-arduino-board/releases/download/v1.0.5/sam-1.6.11-opentracker-1.0.5.tar.bz2",
18+
"archiveFileName": "sam-1.6.11-opentracker-1.0.5.tar.bz2",
19+
"checksum": "SHA-256:50c01d87122a7f6416c3494b1ca96e05d5b4483ea21bb6dfb57184c0ce7c68e8",
20+
"size": "2982552",
21+
"boards": [
22+
{"name": "GeoLink OpenTracker"}
23+
],
24+
"toolsDependencies": [
25+
{
26+
"packager": "opentracker",
27+
"name": "arm-none-eabi-gcc",
28+
"version": "4.8.3-2014q1"
29+
},
30+
{
31+
"packager": "opentracker",
32+
"name": "bossac",
33+
"version": "1.5-opentracker"
34+
}
35+
]
36+
},
1237
{
1338
"name": "OpenTracker Boards (32-bits ARM Cortex-M3)",
1439
"architecture": "sam",

Diff for: sam/1.0.4/readme.txt

-1
This file was deleted.

Diff for: sam/1.0.4/boards.txt renamed to sam/1.0.5/boards.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ geolink_opentracker.build.pid=0x003e
2626
## Menu Additions
2727

2828
menu.HWVersion=Board Version
29-
geolink_opentracker.menu.HWVersion.ver_2_5=OpenTracker 2.5 (3G)
30-
geolink_opentracker.menu.HWVersion.ver_2_5.build.extra_flags=-D__SAM3A4C__ -mthumb {build.usb_flags} -DOPENTRACKER_HW_REV=0x0250
29+
geolink_opentracker.menu.HWVersion.ver_2_4_3G=OpenTracker 2.4 (3G)
30+
geolink_opentracker.menu.HWVersion.ver_2_4_3G.build.extra_flags=-D__SAM3A4C__ -mthumb {build.usb_flags} -DOPENTRACKER_HW_REV=0x024A
3131
geolink_opentracker.menu.HWVersion.ver_2_4=OpenTracker 2.4
3232
geolink_opentracker.menu.HWVersion.ver_2_4.build.extra_flags=-D__SAM3A4C__ -mthumb {build.usb_flags} -DOPENTRACKER_HW_REV=0x0240
3333
geolink_opentracker.menu.HWVersion.ver_2_3=OpenTracker 2.3

Diff for: sam/1.0.5/cores/arduino/.gitignore

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
libsam_sam3a4c_gcc_rel.*
2+
libvariant_geolink_opentracker_gcc_dbg.*

Diff for: sam/1.0.4/cores/arduino/Arduino.h renamed to sam/1.0.5/cores/arduino/Arduino.h

+20-4
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,16 @@ typedef enum _ETCChannel
155155
#define PIN_ATTR_PWM (1UL<<3)
156156
#define PIN_ATTR_TIMER (1UL<<4)
157157

158+
#define PIN_STATUS_DIGITAL_INPUT_PULLUP (0x01)
159+
#define PIN_STATUS_DIGITAL_INPUT (0x02)
160+
#define PIN_STATUS_DIGITAL_OUTPUT (0x03)
161+
#define PIN_STATUS_ANALOG (0x04)
162+
#define PIN_STATUS_PWM (0x05)
163+
#define PIN_STATUS_TIMER (0x06)
164+
#define PIN_STATUS_SERIAL (0x07)
165+
#define PIN_STATUS_DW_LOW (0x10)
166+
#define PIN_STATUS_DW_HIGH (0x11)
167+
158168
/* Types used for the tables below */
159169
typedef struct _PinDescription
160170
{
@@ -170,6 +180,8 @@ typedef struct _PinDescription
170180
ETCChannel ulTCChannel ;
171181
} PinDescription ;
172182

183+
extern uint8_t g_pinStatus[];
184+
173185
/* Pins table to be instanciated into variant.cpp */
174186
extern const PinDescription g_APinDescription[] ;
175187

@@ -197,10 +209,14 @@ extern const PinDescription g_APinDescription[] ;
197209
#include "watchdog.h"
198210

199211
// USB Device
200-
#define USB_VID 0x2341 // arduino LLC vid
201-
#define USB_PID_LEONARDO 0x0034
202-
#define USB_PID_MICRO 0x0035
203-
#define USB_PID_DUE 0x003E
212+
#ifndef USB_VID
213+
#define USB_VID 0x2341 // arduino LLC vid
214+
#endif
215+
216+
#ifndef USB_PID
217+
#define USB_PID 0x003E // arduino Due pid
218+
#endif
219+
204220
#include "USB/USBDesc.h"
205221
#include "USB/USBCore.h"
206222
#include "USB/USBAPI.h"
File renamed without changes.
File renamed without changes.

Diff for: sam/1.0.4/cores/arduino/IPAddress.cpp renamed to sam/1.0.5/cores/arduino/IPAddress.cpp

-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ IPAddress::IPAddress(const uint8_t *address)
4545

4646
bool IPAddress::fromString(const char *address)
4747
{
48-
// TODO: add support for "a", "a.b", "a.b.c" formats
49-
5048
uint16_t acc = 0; // Accumulator
5149
uint8_t dots = 0;
5250

File renamed without changes.

Diff for: sam/1.0.4/cores/arduino/Print.cpp renamed to sam/1.0.5/cores/arduino/Print.cpp

+6-5
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ size_t Print::println(const Printable& x)
192192

193193
// Private Methods /////////////////////////////////////////////////////////////
194194

195-
size_t Print::printNumber(unsigned long n, uint8_t base) {
195+
size_t Print::printNumber(unsigned long n, uint8_t base)
196+
{
196197
char buf[8 * sizeof(long) + 1]; // Assumes 8-bit chars plus zero byte.
197198
char *str = &buf[sizeof(buf) - 1];
198199

@@ -202,9 +203,9 @@ size_t Print::printNumber(unsigned long n, uint8_t base) {
202203
if (base < 2) base = 10;
203204

204205
do {
205-
unsigned long m = n;
206+
char c = n % base;
206207
n /= base;
207-
char c = m - base * n;
208+
208209
*--str = c < 10 ? c + '0' : c + 'A' - 10;
209210
} while(n);
210211

@@ -241,14 +242,14 @@ size_t Print::printFloat(double number, uint8_t digits)
241242

242243
// Print the decimal point, but only if there are digits beyond
243244
if (digits > 0) {
244-
n += print(".");
245+
n += print('.');
245246
}
246247

247248
// Extract digits from the remainder one at a time
248249
while (digits-- > 0)
249250
{
250251
remainder *= 10.0;
251-
int toPrint = int(remainder);
252+
unsigned int toPrint = (unsigned int)remainder;
252253
n += print(toPrint);
253254
remainder -= toPrint;
254255
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

Diff for: sam/1.0.4/cores/arduino/RingBuffer.h renamed to sam/1.0.5/cores/arduino/RingBuffer.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include <stdint.h>
2323

2424
// Define constants and variables for buffering incoming serial data. We're
25-
// using a ring buffer (I think), in which head is the index of the location
25+
// using a ring buffer, in which head is the index of the location
2626
// to which to write the next incoming character and tail is the index of the
2727
// location from which to read.
2828
#define SERIAL_BUFFER_SIZE 256
File renamed without changes.

Diff for: sam/1.0.4/cores/arduino/Stream.cpp renamed to sam/1.0.5/cores/arduino/Stream.cpp

+34-32
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
#include "Stream.h"
2727

2828
#define PARSE_TIMEOUT 1000 // default number of milli-seconds to wait
29-
#define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field
3029

3130
// private method to read stream with timeout
3231
int Stream::timedRead()
@@ -54,14 +53,30 @@ int Stream::timedPeek()
5453

5554
// returns peek of the next digit in the stream or -1 if timeout
5655
// discards non-numeric characters
57-
int Stream::peekNextDigit()
56+
int Stream::peekNextDigit(LookaheadMode lookahead, bool detectDecimal )
5857
{
5958
int c;
6059
while (1) {
6160
c = timedPeek();
62-
if (c < 0) return c; // timeout
63-
if (c == '-') return c;
64-
if (c >= '0' && c <= '9') return c;
61+
62+
if( c < 0 ||
63+
c == '-' ||
64+
(c >= '0' && c <= '9') ||
65+
(detectDecimal && c == '.')) return c;
66+
67+
switch( lookahead ){
68+
case SKIP_NONE: return -1; // Fail code.
69+
case SKIP_WHITESPACE:
70+
switch( c ){
71+
case ' ':
72+
case '\t':
73+
case '\r':
74+
case '\n': break;
75+
default: return -1; // Fail code.
76+
}
77+
case SKIP_ALL:
78+
break;
79+
}
6580
read(); // discard non-numeric
6681
}
6782
}
@@ -107,68 +122,55 @@ bool Stream::findUntil(char *target, size_t targetLen, char *terminator, size_t
107122
}
108123
}
109124

110-
111125
// returns the first valid (long) integer value from the current position.
112-
// initial characters that are not digits (or the minus sign) are skipped
113-
// function is terminated by the first character that is not a digit.
114-
long Stream::parseInt()
115-
{
116-
return parseInt(NO_SKIP_CHAR); // terminate on first non-digit character (or timeout)
117-
}
118-
119-
// as above but a given skipChar is ignored
120-
// this allows format characters (typically commas) in values to be ignored
121-
long Stream::parseInt(char skipChar)
126+
// lookahead determines how parseInt looks ahead in the stream.
127+
// See LookaheadMode enumeration at the top of the file.
128+
// Lookahead is terminated by the first character that is not a valid part of an integer.
129+
// Once parsing commences, 'ignore' will be skipped in the stream.
130+
long Stream::parseInt(LookaheadMode lookahead, char ignore)
122131
{
123132
bool isNegative = false;
124133
long value = 0;
125134
int c;
126135

127-
c = peekNextDigit();
136+
c = peekNextDigit(lookahead, false);
128137
// ignore non numeric leading characters
129138
if(c < 0)
130139
return 0; // zero returned if timeout
131140

132141
do{
133-
if(c == skipChar)
134-
; // ignore this charactor
142+
if(c == ignore)
143+
; // ignore this character
135144
else if(c == '-')
136145
isNegative = true;
137146
else if(c >= '0' && c <= '9') // is c a digit?
138147
value = value * 10 + c - '0';
139148
read(); // consume the character we got with peek
140149
c = timedPeek();
141150
}
142-
while( (c >= '0' && c <= '9') || c == skipChar );
151+
while( (c >= '0' && c <= '9') || c == ignore );
143152

144153
if(isNegative)
145154
value = -value;
146155
return value;
147156
}
148157

149-
150158
// as parseInt but returns a floating point value
151-
float Stream::parseFloat()
159+
float Stream::parseFloat(LookaheadMode lookahead, char ignore)
152160
{
153-
return parseFloat(NO_SKIP_CHAR);
154-
}
155-
156-
// as above but the given skipChar is ignored
157-
// this allows format characters (typically commas) in values to be ignored
158-
float Stream::parseFloat(char skipChar){
159161
bool isNegative = false;
160162
bool isFraction = false;
161163
long value = 0;
162-
char c;
164+
int c;
163165
float fraction = 1.0;
164166

165-
c = peekNextDigit();
167+
c = peekNextDigit(lookahead, true);
166168
// ignore non numeric leading characters
167169
if(c < 0)
168170
return 0; // zero returned if timeout
169171

170172
do{
171-
if(c == skipChar)
173+
if(c == ignore)
172174
; // ignore
173175
else if(c == '-')
174176
isNegative = true;
@@ -182,7 +184,7 @@ float Stream::parseFloat(char skipChar){
182184
read(); // consume the character we got with peek
183185
c = timedPeek();
184186
}
185-
while( (c >= '0' && c <= '9') || c == '.' || c == skipChar );
187+
while( (c >= '0' && c <= '9') || (c == '.' && !isFraction) || c == ignore );
186188

187189
if(isNegative)
188190
value = -value;

Diff for: sam/1.0.4/cores/arduino/Stream.h renamed to sam/1.0.5/cores/arduino/Stream.h

+31-13
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,32 @@
2828
// compatability macros for testing
2929
/*
3030
#define getInt() parseInt()
31-
#define getInt(skipChar) parseInt(skipchar)
31+
#define getInt(ignore) parseInt(ignore)
3232
#define getFloat() parseFloat()
33-
#define getFloat(skipChar) parseFloat(skipChar)
33+
#define getFloat(ignore) parseFloat(ignore)
3434
#define getString( pre_string, post_string, buffer, length)
3535
readBytesBetween( pre_string, terminator, buffer, length)
3636
*/
3737

38+
// This enumeration provides the lookahead options for parseInt(), parseFloat()
39+
// The rules set out here are used until either the first valid character is found
40+
// or a time out occurs due to lack of input.
41+
enum LookaheadMode{
42+
SKIP_ALL, // All invalid characters are ignored.
43+
SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
44+
SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped.
45+
};
46+
47+
#define NO_IGNORE_CHAR '\x01' // a char not found in a valid ASCII numeric field
48+
3849
class Stream : public Print
3950
{
4051
protected:
4152
unsigned long _timeout; // number of milliseconds to wait for the next char before aborting timed read
4253
unsigned long _startMillis; // used for timeout measurement
4354
int timedRead(); // private method to read stream with timeout
4455
int timedPeek(); // private method to peek stream with timeout
45-
int peekNextDigit(); // returns the next numeric digit in the stream or -1 if timeout
56+
int peekNextDigit(LookaheadMode lookahead, bool detectDecimal); // returns the next numeric digit in the stream or -1 if timeout
4657

4758
public:
4859
virtual int available() = 0;
@@ -55,6 +66,7 @@ class Stream : public Print
5566
// parsing methods
5667

5768
void setTimeout(unsigned long timeout); // sets maximum milliseconds to wait for stream data, default is 1 second
69+
unsigned long getTimeout(void) { return _timeout; }
5870

5971
bool find(char *target); // reads data from the stream until the target string is found
6072
bool find(uint8_t *target) { return find ((char *)target); }
@@ -64,18 +76,23 @@ class Stream : public Print
6476
bool find(uint8_t *target, size_t length) { return find ((char *)target, length); }
6577
// returns true if target string is found, false if timed out
6678

79+
bool find(char target) { return find (&target, 1); }
80+
6781
bool findUntil(char *target, char *terminator); // as find but search ends if the terminator string is found
6882
bool findUntil(uint8_t *target, char *terminator) { return findUntil((char *)target, terminator); }
6983

7084
bool findUntil(char *target, size_t targetLen, char *terminate, size_t termLen); // as above but search ends if the terminate string is found
7185
bool findUntil(uint8_t *target, size_t targetLen, char *terminate, size_t termLen) {return findUntil((char *)target, targetLen, terminate, termLen); }
7286

87+
long parseInt(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR);
88+
// returns the first valid (long) integer value from the current position.
89+
// lookahead determines how parseInt looks ahead in the stream.
90+
// See LookaheadMode enumeration at the top of the file.
91+
// Lookahead is terminated by the first character that is not a valid part of an integer.
92+
// Once parsing commences, 'ignore' will be skipped in the stream.
7393

74-
long parseInt(); // returns the first valid (long) integer value from the current position.
75-
// initial characters that are not digits (or the minus sign) are skipped
76-
// integer is terminated by the first character that is not a digit.
77-
78-
float parseFloat(); // float version of parseInt
94+
float parseFloat(LookaheadMode lookahead = SKIP_ALL, char ignore = NO_IGNORE_CHAR);
95+
// float version of parseInt
7996

8097
size_t readBytes( char *buffer, size_t length); // read chars from stream into buffer
8198
size_t readBytes( uint8_t *buffer, size_t length) { return readBytes((char *)buffer, length); }
@@ -92,11 +109,11 @@ class Stream : public Print
92109
String readStringUntil(char terminator);
93110

94111
protected:
95-
long parseInt(char skipChar); // as above but the given skipChar is ignored
96-
// as above but the given skipChar is ignored
97-
// this allows format characters (typically commas) in values to be ignored
98-
99-
float parseFloat(char skipChar); // as above but the given skipChar is ignored
112+
long parseInt(char ignore) { return parseInt(SKIP_ALL, ignore); }
113+
float parseFloat(char ignore) { return parseFloat(SKIP_ALL, ignore); }
114+
// These overload exists for compatibility with any class that has derived
115+
// Stream and used parseFloat/Int with a custom ignore character. To keep
116+
// the public API simple, these overload remains protected.
100117

101118
struct MultiTarget {
102119
const char *str; // string you're searching for
@@ -109,4 +126,5 @@ class Stream : public Print
109126
int findMulti(struct MultiTarget *targets, int tCount);
110127
};
111128

129+
#undef NO_IGNORE_CHAR
112130
#endif
File renamed without changes.

0 commit comments

Comments
 (0)