diff --git a/src/HeliOS.h b/src/HeliOS.h index 77a53db..72bb042 100644 --- a/src/HeliOS.h +++ b/src/HeliOS.h @@ -5,13 +5,13 @@ * @brief Kernel source for user application header * @version 0.4.2 * @date 2023-03-19 - * + * * @copyright * HeliOS Embedded Operating System Copyright (C) 2020-2023 HeliOS Project - * + * * SPDX-License-Identifier: GPL-2.0-or-later - * - * + * + * */ /*UNCRUSTIFY-ON*/ #ifndef HELIOS_H_ @@ -2975,44 +2975,4 @@ } #endif /* ifdef __cplusplus */ - - #ifdef __cplusplus - - #if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \ - defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \ - defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC) - String xByte2String(xSize size_, xByte *bytes_); - - - /* This is here to give Arduino users an easy way to convert from the - * HeliOS byte (xByte) array which is NOT null terminated to a String. */ - String xByte2String(xSize size_, xByte *bytes_) { - String str = ""; - xSize i = 0; - char buf[size_ + 1]; - - - if(NOTNULLPTR(bytes_) && (zero < size_)) { - for(i = 0; i < size_; i++) { - buf[i] = (char) bytes_[i]; - } - - buf[size_] = '\0'; - str = String(buf); - } - - return(str); - } - - - #endif /* if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || - * defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || - * defined(ARDUINO_ARCH_STM32) || defined(ARDUINO_TEENSY_MICROMOD) || - * defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || - * defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || - * defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || - * defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC) */ - - #endif /* ifdef __cplusplus */ - -#endif /* ifndef HELIOS_H_ */ \ No newline at end of file +#endif /* ifndef HELIOS_H_ */ diff --git a/src/arduino_helpers.c b/src/arduino_helpers.c new file mode 100644 index 0000000..0bc873a --- /dev/null +++ b/src/arduino_helpers.c @@ -0,0 +1,28 @@ +#include "arduino_helpers.h" + +#ifdef __cplusplus + +#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \ + defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \ + defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC) + +String xByte2String(xSize size_, xByte *bytes_) { + String str = ""; + xSize i = 0; + char buf[size_ + 1]; + + if(NOTNULLPTR(bytes_) && (zero < size_)) { + for(i = 0; i < size_; i++) { + buf[i] = (char) bytes_[i]; + } + + buf[size_] = '\0'; + str = String(buf); + } + + return(str); +} + +#endif + +#endif /* ifdef __cplusplus */ diff --git a/src/arduino_helpers.h b/src/arduino_helpers.h new file mode 100644 index 0000000..9b01704 --- /dev/null +++ b/src/arduino_helpers.h @@ -0,0 +1,18 @@ +#ifndef ARDUINO_HELPERS_H_ +#define ARDUINO_HELPERS_H_ + +#include "HeliOS.h" + +#ifdef __cplusplus + +#if defined(ARDUINO_ARCH_AVR) || defined(ARDUINO_ARCH_SAM) || defined(ARDUINO_ARCH_SAMD) || defined(ARDUINO_ARCH_ESP8266) || defined(ARDUINO_ARCH_STM32) || \ + defined(ARDUINO_TEENSY_MICROMOD) || defined(ARDUINO_TEENSY40) || defined(ARDUINO_TEENSY41) || defined(ARDUINO_TEENSY36) || defined(ARDUINO_TEENSY35) || \ + defined(ARDUINO_TEENSY31) || defined(ARDUINO_TEENSY32) || defined(ARDUINO_TEENSY30) || defined(ARDUINO_TEENSYLC) + +String xByte2String(xSize size_, xByte *bytes_); + +#endif + +#endif /* ifdef __cplusplus */ + +#endif /* ifndef ARDUINO_HELPERS_H_ */