Skip to content

Commit 5ecab3f

Browse files
committed
Allow compilation on non-mbed targets
1 parent 5110146 commit 5ecab3f

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

examples/RS485CrashLog/RS485CrashLog.ino

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@
66
* Initial author: Sebastian Romero @sebromero
77
*/
88

9+
#ifdef ARDUINO_ARCH_MBED
910
#include "RS485FileHandle.h"
10-
1111
REDIRECT_STDOUT_TO(&RS485Console) // Redirect mbed crash log output to RS485
12+
#endif
1213

1314
void setup() {
1415
// Force a crash to demonstrate the crash log over RS485

src/RS485FileHandle.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
#include "RS485FileHandle.h"
2+
3+
#ifdef ARDUINO_ARCH_MBED
4+
25
#include <ArduinoRS485.h>
36
#include <errno.h>
47

@@ -75,4 +78,6 @@ int RS485FileHandle::isatty() const {
7578
}
7679

7780
// Global instance for stdout redirection
78-
RS485FileHandle RS485Console;
81+
RS485FileHandle RS485Console;
82+
83+
#endif // ARDUINO_ARCH_MBED

src/RS485FileHandle.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef RS485_FILE_HANDLE_H
22
#define RS485_FILE_HANDLE_H
33

4+
#ifdef ARDUINO_ARCH_MBED
5+
46
#include "mbed.h"
57

68
/**
@@ -84,4 +86,6 @@ class RS485FileHandle : public mbed::FileHandle {
8486
*/
8587
extern RS485FileHandle RS485Console;
8688

89+
#endif // ARDUINO_ARCH_MBED
90+
8791
#endif // RS485_FILE_HANDLE_H

0 commit comments

Comments
 (0)