Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 066adba

Browse files
committed
Improvement of enums in some cases. Now it is coded that they must occupy 1 byte instead of 4.
1 parent ee040ed commit 066adba

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

‎api/Common.h‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,31 @@
66
extern "C"{
77
#endif
88

9+
#ifdef __cplusplus
10+
#define ARD_CHAR_ENUM_XWEZPiBoACuGnH : char
11+
#else
12+
#define ARD_CHAR_ENUM_XWEZPiBoACuGnH __attribute__ ((__packed__))
13+
#endif
14+
915
void yield(void);
1016

11-
typedef enum {
17+
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
1218
LOW = 0,
1319
HIGH = 1,
1420
CHANGE = 2,
1521
FALLING = 3,
1622
RISING = 4,
1723
} PinStatus;
1824

19-
typedef enum {
25+
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
2026
INPUT = 0x0,
2127
OUTPUT = 0x1,
2228
INPUT_PULLUP = 0x2,
2329
INPUT_PULLDOWN = 0x3,
2430
OUTPUT_OPENDRAIN = 0x4,
2531
} PinMode;
2632

27-
typedef enum {
33+
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH{
2834
LSBFIRST = 0,
2935
MSBFIRST = 1,
3036
} BitOrder;

‎api/HardwareSPI.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626

2727
namespace arduino {
2828

29-
typedef enum {
29+
typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
3030
SPI_MODE0 = 0,
3131
SPI_MODE1 = 1,
3232
SPI_MODE2 = 2,

‎api/Stream.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace arduino {
3939
// This enumeration provides the lookahead options for parseInt(), parseFloat()
4040
// The rules set out here are used until either the first valid character is found
4141
// or a time out occurs due to lack of input.
42-
enum LookaheadMode{
42+
enum LookaheadMode: uint8_t{
4343
SKIP_ALL, // All invalid characters are ignored.
4444
SKIP_NONE, // Nothing is skipped, and the stream is not touched unless the first waiting character is valid.
4545
SKIP_WHITESPACE // Only tabs, spaces, line feeds & carriage returns are skipped.
@@ -130,4 +130,4 @@ class Stream : public Print
130130

131131
}
132132

133-
using arduino::Stream;
133+
using arduino::Stream;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /