20
20
#ifndef Arduino_h
21
21
#define Arduino_h
22
22
23
+ #ifdef __cplusplus
24
+ #define ARD_CHAR_ENUM_XWEZPiBoACuGnH : char
25
+ #else
26
+ #define ARD_CHAR_ENUM_XWEZPiBoACuGnH __attribute__ ((__packed__))
27
+ #endif
28
+
23
29
#include <stdlib.h>
24
30
#include <stdbool.h>
25
31
#include <string.h>
@@ -37,12 +43,21 @@ extern "C"{
37
43
38
44
void yield (void );
39
45
40
- #define HIGH 0x1
41
- #define LOW 0x0
42
-
43
- #define INPUT 0x0
44
- #define OUTPUT 0x1
45
- #define INPUT_PULLUP 0x2
46
+ typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
47
+ LOW = 0 ,
48
+ HIGH = 1 ,
49
+ CHANGE = 2 ,
50
+ FALLING = 3 ,
51
+ RISING = 4 ,
52
+ } PinStatus ;
53
+
54
+ typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
55
+ INPUT = 0 ,
56
+ OUTPUT = 1 ,
57
+ INPUT_PULLUP = 2 ,
58
+ INPUT_PULLDOWN = 3 ,
59
+ OUTPUT_OPENDRAIN = 4 ,
60
+ } PinMode ;
46
61
47
62
#define PI 3.1415926535897932384626433832795
48
63
#define HALF_PI 1.5707963267948966192313216916398
@@ -51,38 +66,44 @@ void yield(void);
51
66
#define RAD_TO_DEG 57.295779513082320876798154814105
52
67
#define EULER 2.718281828459045235360287471352
53
68
54
- #define SERIAL 0x0
55
- #define DISPLAY 0x1
56
-
57
- #define LSBFIRST 0
58
- #define MSBFIRST 1
69
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
70
+ SERIAL = 0x0 ,
71
+ DISPLAY = 0x1
72
+ };
59
73
60
- #define CHANGE 1
61
- #define FALLING 2
62
- #define RISING 3
74
+ typedef enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
75
+ LSBFIRST = 0 ,
76
+ MSBFIRST = 1 ,
77
+ } BitOrder ;
63
78
64
79
#if defined(__AVR_ATtiny24__ ) || defined(__AVR_ATtiny44__ ) || defined(__AVR_ATtiny84__ )
65
- #define DEFAULT 0
66
- #define EXTERNAL 1
67
- #define INTERNAL1V1 2
68
- #define INTERNAL INTERNAL1V1
80
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
81
+ DEFAULT = 0 ,
82
+ EXTERNAL = 1 ,
83
+ INTERNAL1V1 = 2 ,
84
+ INTERNAL = INTERNAL1V1 ,
85
+ };
69
86
#elif defined(__AVR_ATtiny25__ ) || defined(__AVR_ATtiny45__ ) || defined(__AVR_ATtiny85__ )
70
- #define DEFAULT 0
71
- #define EXTERNAL 4
72
- #define INTERNAL1V1 8
73
- #define INTERNAL INTERNAL1V1
74
- #define INTERNAL2V56 9
75
- #define INTERNAL2V56_EXTCAP 13
76
- #else
87
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
88
+ DEFAULT = 0 ,
89
+ EXTERNAL = 4 ,
90
+ INTERNAL1V1 = 8 ,
91
+ INTERNAL = INTERNAL1V1 ,
92
+ INTERNAL2V56 = 9 ,
93
+ INTERNAL2V56_EXTCAP = 13 ,
94
+ };
95
+ #else
96
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
77
97
#if defined(__AVR_ATmega1280__ ) || defined(__AVR_ATmega2560__ ) || defined(__AVR_ATmega1284__ ) || defined(__AVR_ATmega1284P__ ) || defined(__AVR_ATmega644__ ) || defined(__AVR_ATmega644A__ ) || defined(__AVR_ATmega644P__ ) || defined(__AVR_ATmega644PA__ )
78
- #define INTERNAL1V1 2
79
- #define INTERNAL2V56 3
98
+ INTERNAL1V1 = 2 ,
99
+ INTERNAL2V56 = 3 ,
80
100
#else
81
- #define INTERNAL 3
101
+ INTERNAL = 3 ,
82
102
#endif
83
- #define DEFAULT 1
84
- #define EXTERNAL 0
103
+ DEFAULT = 1 ,
104
+ EXTERNAL = 0 ,
85
105
#endif
106
+ };
86
107
87
108
// undefine stdlib's abs if encountered
88
109
#ifdef abs
@@ -183,45 +204,51 @@ extern const uint8_t PROGMEM digital_pin_to_timer_PGM[];
183
204
#define portInputRegister (P ) ( (volatile uint8_t *)( pgm_read_word( port_to_input_PGM + (P))) )
184
205
#define portModeRegister (P ) ( (volatile uint8_t *)( pgm_read_word( port_to_mode_PGM + (P))) )
185
206
186
- #define NOT_A_PIN 0
187
- #define NOT_A_PORT 0
207
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
208
+ NOT_A_PIN = 0 ,
209
+ NOT_A_PORT = 0 ,
188
210
189
- #define NOT_AN_INTERRUPT -1
211
+ NOT_AN_INTERRUPT = -1 ,
212
+ };
190
213
191
214
#ifdef ARDUINO_MAIN
192
- #define PA 1
193
- #define PB 2
194
- #define PC 3
195
- #define PD 4
196
- #define PE 5
197
- #define PF 6
198
- #define PG 7
199
- #define PH 8
200
- #define PJ 10
201
- #define PK 11
202
- #define PL 12
215
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
216
+ PA = 1 ,
217
+ PB = 2 ,
218
+ PC = 3 ,
219
+ PD = 4 ,
220
+ PE = 5 ,
221
+ PF = 6 ,
222
+ PG = 7 ,
223
+ PH = 8 ,
224
+ PJ = 10 ,
225
+ PK = 11 ,
226
+ PL = 12 ,
227
+ };
203
228
#endif
204
229
205
- #define NOT_ON_TIMER 0
206
- #define TIMER0A 1
207
- #define TIMER0B 2
208
- #define TIMER1A 3
209
- #define TIMER1B 4
210
- #define TIMER1C 5
211
- #define TIMER2 6
212
- #define TIMER2A 7
213
- #define TIMER2B 8
214
-
215
- #define TIMER3A 9
216
- #define TIMER3B 10
217
- #define TIMER3C 11
218
- #define TIMER4A 12
219
- #define TIMER4B 13
220
- #define TIMER4C 14
221
- #define TIMER4D 15
222
- #define TIMER5A 16
223
- #define TIMER5B 17
224
- #define TIMER5C 18
230
+ enum ARD_CHAR_ENUM_XWEZPiBoACuGnH {
231
+ NOT_ON_TIMER = 0 ,
232
+ TIMER0A = 1 ,
233
+ TIMER0B = 2 ,
234
+ TIMER1A = 3 ,
235
+ TIMER1B = 4 ,
236
+ TIMER1C = 5 ,
237
+ TIMER2 = 6 ,
238
+ TIMER2A = 7 ,
239
+ TIMER2B = 8 ,
240
+
241
+ TIMER3A = 9 ,
242
+ TIMER3B = 10 ,
243
+ TIMER3C = 11 ,
244
+ TIMER4A = 12 ,
245
+ TIMER4B = 13 ,
246
+ TIMER4C = 14 ,
247
+ TIMER4D = 15 ,
248
+ TIMER5A = 16 ,
249
+ TIMER5B = 17 ,
250
+ TIMER5C = 18 ,
251
+ };
225
252
226
253
#ifdef __cplusplus
227
254
} // extern "C"
@@ -255,6 +282,8 @@ long map(long, long, long, long, long);
255
282
256
283
#endif
257
284
285
+ #undef ARD_CHAR_ENUM_XWEZPiBoACuGnH
286
+
258
287
#include "pins_arduino.h"
259
288
260
289
#endif
0 commit comments