Skip to content

Commit 885fa0c

Browse files
Merge pull request #58 from nhasbun/develop
fix: fixes linking problems related to xByte2String method
2 parents 9f85438 + 10820b7 commit 885fa0c

File tree

3 files changed

+47
-41
lines changed

3 files changed

+47
-41
lines changed

src/HeliOS.h

Lines changed: 1 addition & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9864,44 +9864,4 @@
98649864
}
98659865
#endif /* ifdef __cplusplus */
98669866

9867-
9868-
#ifdef __cplusplus
9869-
9870-
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \
9871-
defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \
9872-
defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC)
9873-
String xByte2String(xSize size_, xByte *bytes_);
9874-
9875-
9876-
/* This is here to give Arduino users an easy way to convert from the
9877-
* HeliOS byte (xByte) array which is NOT null terminated to a String. */
9878-
String xByte2String(xSize size_, xByte *bytes_) {
9879-
String str = "";
9880-
xSize i = 0;
9881-
char buf[size_ + 1];
9882-
9883-
9884-
if(__PointerIsNotNull__(bytes_) && (nil < size_)) {
9885-
for(i = 0; i < size_; i++) {
9886-
buf[i] = (char) bytes_[i];
9887-
}
9888-
9889-
buf[size_] = '\0';
9890-
str = String(buf);
9891-
}
9892-
9893-
return(str);
9894-
}
9895-
9896-
9897-
#endif /* if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) ||
9898-
* defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) ||
9899-
* defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_TEENSY_MICROMOD) ||
9900-
* defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) ||
9901-
* defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) ||
9902-
* defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) ||
9903-
* defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC) */
9904-
9905-
#endif /* ifdef __cplusplus */
9906-
9907-
#endif /* ifndef HELIOS_H_ */
9867+
#endif /* ifndef HELIOS_H_ */

src/arduino_helpers.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#include "arduino_helpers.h"
2+
3+
#ifdef __cplusplus
4+
5+
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \
6+
defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \
7+
defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC)
8+
9+
String xByte2String(xSize size_, xByte *bytes_) {
10+
String str = "";
11+
xSize i = 0;
12+
char buf[size_ + 1];
13+
14+
if(NOTNULLPTR(bytes_) && (zero < size_)) {
15+
for(i = 0; i < size_; i++) {
16+
buf[i] = (char) bytes_[i];
17+
}
18+
19+
buf[size_] = '\0';
20+
str = String(buf);
21+
}
22+
23+
return(str);
24+
}
25+
26+
#endif
27+
28+
#endif /* ifdef __cplusplus */

src/arduino_helpers.h

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#ifndef ARDUINO_HELPERS_H_
2+
#define ARDUINO_HELPERS_H_
3+
4+
#include "HeliOS.h"
5+
6+
#ifdef __cplusplus
7+
8+
#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \
9+
defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \
10+
defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC)
11+
12+
String xByte2String(xSize size_, xByte *bytes_);
13+
14+
#endif
15+
16+
#endif /* ifdef __cplusplus */
17+
18+
#endif /* ifndef ARDUINO_HELPERS_H_ */

0 commit comments

Comments
 (0)