Movatterモバイル変換


[0]ホーム

URL:


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

Commitb453a05

Browse files
committed
Improvement of enums in some cases. Now it is coded that they must occupy 1 byte instead of 4.
1 parent844e4bf commitb453a05

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+
#defineARD_CHAR_ENUM_XWEZPiBoACuGnH :char
11+
#else
12+
#defineARD_CHAR_ENUM_XWEZPiBoACuGnH__attribute__ ((__packed__))
13+
#endif
14+
915
voidyield(void);
1016

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

19-
typedefenum {
25+
typedefenumARD_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-
typedefenum {
33+
typedefenumARD_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
namespacearduino {
2828

29-
typedefenum {
29+
typedefenumARD_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)

[8]ページ先頭

©2009-2025 Movatter.jp