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