Skip to content

fix: fixes linking problems related to xByte2String method #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 5 additions & 45 deletions src/HeliOS.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
*
*
* SPDX-License-Identifier: GPL-2.0-or-later
*
*
*
*
*/
/*UNCRUSTIFY-ON*/
#ifndef HELIOS_H_
Expand Down Expand Up @@ -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_ */
#endif /* ifndef HELIOS_H_ */
28 changes: 28 additions & 0 deletions src/arduino_helpers.c
Original file line number Diff line number Diff line change
@@ -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 */
18 changes: 18 additions & 0 deletions src/arduino_helpers.h
Original file line number Diff line number Diff line change
@@ -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_ */