Skip to content

Commit 6465d4f

Browse files
committed
Make Arduino.h safe to include from C files
1 parent bdd9882 commit 6465d4f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

cores/esp32/Arduino.h

+11-10
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,6 @@ typedef unsigned int word;
121121

122122
#ifdef __cplusplus
123123
}
124-
#endif
125-
126-
#ifndef _GLIBCXX_VECTOR
127-
// arduino is not compatible with std::vector
128-
#define min(a,b) ((a)<(b)?(a):(b))
129-
#define max(a,b) ((a)>(b)?(a):(b))
130-
#endif
131-
132-
#define _min(a,b) ((a)<(b)?(a):(b))
133-
#define _max(a,b) ((a)>(b)?(a):(b))
134124

135125
#include "WCharacter.h"
136126
#include "WString.h"
@@ -144,6 +134,17 @@ typedef unsigned int word;
144134
#include "HardwareSerial.h"
145135
#include "Esp.h"
146136

137+
#endif /* __cplusplus */
138+
139+
#ifndef _GLIBCXX_VECTOR
140+
// arduino is not compatible with std::vector
141+
#define min(a,b) ((a)<(b)?(a):(b))
142+
#define max(a,b) ((a)>(b)?(a):(b))
143+
#endif
144+
145+
#define _min(a,b) ((a)<(b)?(a):(b))
146+
#define _max(a,b) ((a)>(b)?(a):(b))
147+
147148
#include "pins_arduino.h"
148149

149150
#endif /* _ESP32_CORE_ARDUINO_H_ */

0 commit comments

Comments
 (0)