Skip to content

Modified Arduino.h with changes to the boolean type #2151

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

Closed
wants to merge 3 commits into from
Closed
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
10 changes: 8 additions & 2 deletions hardware/arduino/avr/cores/arduino/Arduino.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#define Arduino_h

#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>

Expand All @@ -31,6 +30,14 @@

#include "binary.h"

#ifdef __cplusplus
typedef bool boolean;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the important part of my addition. The boolean type needs to be seen as a bool when compiling C++ code.

#else
typedef uint8_t boolean;
#define false 0
#define true !false
#endif

#ifdef __cplusplus
extern "C"{
#endif
Expand Down Expand Up @@ -114,7 +121,6 @@ typedef unsigned int word;

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

typedef uint8_t boolean;
typedef uint8_t byte;

void init(void);
Expand Down
2 changes: 2 additions & 0 deletions hardware/arduino/avr/cores/arduino/WString.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class String
#ifdef __GXX_EXPERIMENTAL_CXX0X__
String(String &&rval);
String(StringSumHelper &&rval);
auto begin() -> const char* { return c_str(); }
auto end() -> const char* { return c_str() + length(); }
#endif
explicit String(char c);
explicit String(unsigned char, unsigned char base=10);
Expand Down