Skip to content

Commit 0408ed5

Browse files
committed
V4_1_32
V4.1.32 added support for Adafruit SAMD boards
1 parent fb6571d commit 0408ed5

File tree

6 files changed

+57
-6
lines changed

6 files changed

+57
-6
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,21 @@ See [Arduino Text I/O for the Real World](https://www.forward.com.au/pfod/Arduin
2424
See [Simple Multitasking Arduino](https://www.forward.com.au/pfod/ArduinoProgramming/RealTimeArduino/index.html)
2525
See [How to code Timers and Delays in Arduino](https://www.forward.com.au/pfod/ArduinoProgramming/TimingDelaysInArduino.html)
2626

27+
# Sparkfun SAMD compile issue
28+
See issue https://github.com/PowerBroker2/SafeString/issues/73
29+
30+
Sparkfun's SAMD board support does not provide a define to distinguish it from Arduino's SAMD boards.
31+
This causes SafeString compile to fail with
32+
33+
**error: expected class-name before '{' token 73 | class SafeStringReader : public SafeString {**
34+
35+
This fix is to remove the contents of these three header files
36+
SafeStringNameSpace.h
37+
SafeStringNameSpaceEnd.h
38+
SafeStringNameSpaceStart.h
39+
40+
That is just have empty files for those three headers.
41+
2742
# PlatformIO support
2843
This library is primarily an Arduino IDE library, but users have had success using it with PlatformIO.
2944
See the PlatformIO subdirectory for the two PlatformIO versions. One for boards that use the arduino namespace, e.g. Arduino Zero, and one for boards that don't, e.g. UNO.
@@ -41,6 +56,7 @@ See the top of each file for its license
4156
Note, this is NOT my work, I am simply hosting it for easy access. The original code belongs to [Forward Computing and Control Pty. Ltd](https://www.forward.com.au/pfod/ArduinoProgramming/SafeString/index.html).
4257

4358
# Revisions
59+
V4.1.32 added support for Adafruit SAMD boards
4460
V4.1.31 added support for other Arduino MBED boards like Opta
4561
V4.1.30 added default initializations
4662
V4.1.29 removed F() macro and FlashStringHelper class from SafeString.h. SafeString now depends of the board's core to define these.

library.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=SafeString
2-
version=4.1.31
2+
version=4.1.32
33
author=Matthew Ford
44
maintainer=Matthew Ford
55
sentence=A Safe, Static String library to replace Arduino String, plus non-blocking Serial I/O, I/O buffering, loopTimer and millisDelay

readme_SparkfunSAMD.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
See issue https://github.com/PowerBroker2/SafeString/issues/73
2+
3+
Sparkfun's SAMD board support does not provide a define to distinguish it from Arduino's SAMD boards
4+
This causes SafeString compile to fail with
5+
error: expected class-name before '{' token 73 | class SafeStringReader : public SafeString { |
6+
7+
This fix is to remove the contents of these three header files
8+
SafeStringNameSpace.h
9+
SafeStringNameSpaceEnd.h
10+
SafeStringNameSpaceStart.h
11+
12+
That is just have empty files for those three headers.

src/SafeStringNameSpace.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
#ifndef SAFE_STRING_NAMESPACE_H
22
#define SAFE_STRING_NAMESPACE_H
3-
43
#if defined(MEGATINYCORE_MAJOR) || defined(MOTEINO_M0) || defined(RFGATEWAY_M4) || defined(CURRENT_RANGER) || defined(__SAMD51__)
54
// to skip this for SparkFun RedboardTurbo and MegaTinyCore and MOTEINO boards and Adafruit M4 boards
65
#else
7-
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
6+
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
87
using namespace arduino;
98
#endif
109
#endif // #if defined(MEGATINYCORE_MAJOR) ...
1110

11+
#if defined(ARDUINO_ARCH_SAMD)
12+
#if defined(ARDUINO_SAMD_ADAFRUIT)
13+
#else
14+
using namespace arduino;
15+
#endif
16+
#endif
17+
1218
#endif

src/SafeStringNameSpaceEnd.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1+
12
#ifndef SAFE_STRING_NAMESPACE_END_H
23
#define SAFE_STRING_NAMESPACE_END_H
34

45
#if defined(MEGATINYCORE_MAJOR) || defined(MOTEINO_M0) || defined(RFGATEWAY_M4) || defined(CURRENT_RANGER) || defined(__SAMD51__)
56
// to skip this for SparkFun RedboardTurbo and MegaTinyCore and MOTEINO boards and Adafruit M4 boards
67
#else
7-
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
8+
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
89
} // namespace arduino
910
#endif
1011
#endif // #if defined(MEGATINYCORE_MAJOR) ...
1112

13+
#if defined(ARDUINO_ARCH_SAMD)
14+
#if defined(ARDUINO_SAMD_ADAFRUIT)
15+
#else
16+
} // namespace arduino
17+
#endif
1218
#endif
19+
20+
#endif
21+

src/SafeStringNameSpaceStart.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,17 @@
44
#if defined(MEGATINYCORE_MAJOR) || defined(MOTEINO_M0) || defined(RFGATEWAY_M4) || defined(CURRENT_RANGER) || defined(__SAMD51__)
55
// to skip this for SparkFun RedboardTurbo and MegaTinyCore and MOTEINO boards and Adafruit M4 boards
66
#else
7-
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
7+
#if defined(ARDUINO_ARDUINO_NANO33BLE) || defined(ARDUINO_ARCH_MEGAAVR) || defined(ARDUINO_ARCH_MBED_RP2040) || defined(ARDUINO_ARCH_RP2040) || defined(ARDUINO_UNOR4_WIFI) || defined(ARDUINO_UNOR4_MINIMA) || defined(ARDUINO_ARCH_MBED)
88
namespace arduino {
99
#endif
1010
#endif // #if defined(MEGATINYCORE_MAJOR) ...
1111

12-
#endif
12+
#if defined(ARDUINO_ARCH_SAMD)
13+
#if defined(ARDUINO_SAMD_ADAFRUIT)
14+
#else
15+
namespace arduino {
16+
#endif
17+
#endif
18+
19+
#endif
20+

0 commit comments

Comments
 (0)