Skip to content

Commit d231ed2

Browse files
Fix C++ boolean issue
arduino/Arduino#2151
1 parent e3976be commit d231ed2

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

teensy3/wiring.h

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@
3636
extern "C"{
3737
#endif
3838

39-
#define true 1
40-
#define false 0
41-
4239
#define PI 3.1415926535897932384626433832795
4340
#define HALF_PI 1.5707963267948966192313216916398
4441
#define TWO_PI 6.283185307179586476925286766559
@@ -90,7 +87,6 @@ typedef unsigned int word;
9087

9188
#define bit(b) (1UL << (b))
9289

93-
typedef uint8_t boolean;
9490
typedef uint8_t byte;
9591

9692
uint32_t pulseIn(uint8_t pin, uint8_t state, uint32_t timeout);
@@ -109,4 +105,14 @@ void loop(void);
109105
} // extern "C"
110106
#endif
111107

108+
// fix C++ boolean issue
109+
// https://github.com/arduino/Arduino/pull/2151
110+
#ifdef __cplusplus
111+
typedef bool boolean;
112+
#else
113+
typedef uint8_t boolean;
114+
#define false 0
115+
#define true (!false)
116+
#endif
117+
112118
#endif

0 commit comments

Comments
 (0)