@@ -30,14 +30,6 @@ unsigned long micros();
30
30
#define NUM_SERIAL_PORTS 0
31
31
#endif
32
32
33
- // These definitions allow the following to compile (see issue #193):
34
- // https://github.com/arduino-libraries/Ethernet/blob/master/src/utility/w5100.h:341
35
- // add padding because some boards (__MK20DX128__) offset from the given address
36
- #define MMAP_PORTS_SIZE (MOCK_PINS_COUNT + 256 )
37
- #define digitalPinToBitMask (pin ) (1 )
38
- #define digitalPinToPort (pin ) (pin)
39
- #define portOutputRegister (port ) (GODMODE()->pMmapPort (port))
40
-
41
33
class GodmodeState {
42
34
private:
43
35
struct PortDef {
@@ -51,7 +43,7 @@ class GodmodeState {
51
43
uint8_t mode;
52
44
};
53
45
54
- uint8_t mmapPorts[MMAP_PORTS_SIZE ];
46
+ uint8_t mmapPorts[MOCK_PINS_COUNT ];
55
47
56
48
static GodmodeState* instance;
57
49
@@ -98,7 +90,7 @@ class GodmodeState {
98
90
}
99
91
100
92
void resetMmapPorts () {
101
- for (int i = 0 ; i < MMAP_PORTS_SIZE ; ++i) {
93
+ for (int i = 0 ; i < MOCK_PINS_COUNT ; ++i) {
102
94
mmapPorts[i] = 1 ;
103
95
}
104
96
}
@@ -159,5 +151,16 @@ void detachInterrupt(uint8_t interrupt);
159
151
inline void tone (uint8_t _pin, unsigned int frequency, unsigned long duration = 0 ) {}
160
152
inline void noTone (uint8_t _pin) {}
161
153
154
+ // These definitions allow the following to compile (see issue #193):
155
+ // https://github.com/arduino-libraries/Ethernet/blob/master/src/utility/w5100.h:341
156
+ // we allow one byte per port which "wastes" 224 bytes, but makes the code easier
157
+ #if defined(__AVR__)
158
+ #define digitalPinToBitMask (pin ) (1 )
159
+ #define digitalPinToPort (pin ) (pin)
160
+ #define portOutputRegister (port ) (GODMODE()->pMmapPort (port))
161
+ #else
162
+ // we don't (yet) support other boards
163
+ #endif
164
+
162
165
163
166
GodmodeState* GODMODE ();
0 commit comments