-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: better way to organize arduino library
- Loading branch information
1 parent
6b1a513
commit 9250ed7
Showing
7 changed files
with
52 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CompileFlags: | ||
Add: [-xc++, -std=c++11] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
generators/arduino/atsdk/atsdk.htemplate → generators/arduino/atsdk/lib/atsdk.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// For both development and compile time | ||
#include "atsdk.h" | ||
#include <cstdarg> | ||
#include <cstdio> | ||
#include <cstdlib> | ||
|
||
#ifdef __clang__ // For development to supress irrelevant errors | ||
#include "../../../../packages/atlogger/include/atlogger/atlogger.h" | ||
class DummySerial { | ||
public: | ||
void print(const char *); | ||
void println(const char *); | ||
}; | ||
extern DummySerial Serial; | ||
|
||
#else // Actual compile time includes | ||
#include <Arduino.h> | ||
#endif | ||
|
||
void atsdk_arduino_setup() {} | ||
|
||
extern "C" { | ||
void atlogger_log(const char *tag, const enum atlogger_logging_level level, const char *format, ...) { | ||
atlogger_logging_level allowed_level = atlogger_get_logging_level(); | ||
if (level > allowed_level) { | ||
return; | ||
} | ||
|
||
va_list args; | ||
va_start(args, format); | ||
if (tag != nullptr) { | ||
Serial.print(tag); | ||
Serial.print(" | "); | ||
} | ||
int len = vsnprintf(NULL, 0, format, args); | ||
char *buf = new char[len + 1]; | ||
vsnprintf(buf, len, format, args); | ||
Serial.println(buf); | ||
delete[] buf; | ||
|
||
va_end(args); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.