Skip to content
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

Improvement of enums in some cases. Now it is coded that they must oc… #167

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 9 additions & 3 deletions api/Common.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,31 @@
extern "C"{
#endif

#ifdef __cplusplus
#define ARD_CHAR_ENUM_XWEZPiBoACuGnH : char
#else
#define ARD_CHAR_ENUM_XWEZPiBoACuGnH __attribute__ ((__packed__))
#endif

void yield(void);

typedef enum {
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
LOW = 0,
HIGH = 1,
CHANGE = 2,
FALLING = 3,
RISING = 4,
} PinStatus;

typedef enum {
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
INPUT = 0x0,
OUTPUT = 0x1,
INPUT_PULLUP = 0x2,
INPUT_PULLDOWN = 0x3,
OUTPUT_OPENDRAIN = 0x4,
} PinMode;

typedef enum {
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
LSBFIRST = 0,
MSBFIRST = 1,
} BitOrder;
Expand Down
2 changes: 1 addition & 1 deletion api/HardwareSPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

namespace arduino {

typedef enum {
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
SPI_MODE0 = 0,
SPI_MODE1 = 1,
SPI_MODE2 = 2,
Expand Down
4 changes: 2 additions & 2 deletions api/Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace arduino {
// This enumeration provides the lookahead options for parseInt(), parseFloat()
// The rules set out here are used until either the first valid character is found
// or a time out occurs due to lack of input.
enum LookaheadMode{
enum LookaheadMode: uint8_t {
SKIP_ALL, // All invalid characters are ignored.
SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped.
Expand Down Expand Up @@ -130,4 +130,4 @@ class Stream : public Print

}

using arduino::Stream;
using arduino::Stream;