162162((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PORTB : \
163163(((P) >= 30 && (P) <= 37) ? &PORTC : \
164164((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PORTD : \
165- ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PORTE : \
165+ ((((P) <= 3) || (P) == 5) ? &PORTE : \
166166(((P) >= 54 && (P) <= 61) ? &PORTF : \
167167((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PORTG : \
168168((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PORTH : \
174174((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &DDRB : \
175175(((P) >= 30 && (P) <= 37) ? &DDRC : \
176176((((P) >= 18 && (P) <= 21) || (P) == 38) ? &DDRD : \
177- ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &DDRE : \
177+ ((((P) <= 3) || (P) == 5) ? &DDRE : \
178178(((P) >= 54 && (P) <= 61) ? &DDRF : \
179179((((P) >= 39 && (P) <= 41) || (P) == 4) ? &DDRG : \
180180((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &DDRH : \
186186((((P) >= 10 && (P) <= 13) || ((P) >= 50 && (P) <= 53)) ? &PINB : \
187187(((P) >= 30 && (P) <= 37) ? &PINC : \
188188((((P) >= 18 && (P) <= 21) || (P) == 38) ? &PIND : \
189- ((((P) >= 0 && (P) <= 3) || (P) == 5) ? &PINE : \
189+ ((((P) <= 3) || (P) == 5) ? &PINE : \
190190(((P) >= 54 && (P) <= 61) ? &PINF : \
191191((((P) >= 39 && (P) <= 41) || (P) == 4) ? &PING : \
192192((((P) >= 6 && (P) <= 9) || (P) == 16 || (P) == 17) ? &PINH : \
241241
242242#if defined(__AVR_ATmega324PB__ )
243243#define __digitalPinToPortReg (P ) \
244- (((P) >= 0 && (P) <= 7) ? &PORTB : (((P) >= 8 && (P) <= 15) ? &PORTD : (((P) >= 16 && (P) <= 23) ? &PORTC : (((P) >= 24 && (P) <= 31) ? &PORTA : &PORTE))))
244+ (((P) <= 7) ? &PORTB : (((P) >= 8 && (P) <= 15) ? &PORTD : (((P) >= 16 && (P) <= 23) ? &PORTC : (((P) >= 24 && (P) <= 31) ? &PORTA : &PORTE))))
245245#define __digitalPinToDDRReg (P ) \
246- (((P) >= 0 && (P) <= 7) ? &DDRB : (((P) >= 8 && (P) <= 15) ? &DDRD : (((P) >= 16 && (P) <= 23) ? &DDRC : (((P) >= 24 && (P) <= 31) ? &DDRA : &DDRE))))
246+ (((P) <= 7) ? &DDRB : (((P) >= 8 && (P) <= 15) ? &DDRD : (((P) >= 16 && (P) <= 23) ? &DDRC : (((P) >= 24 && (P) <= 31) ? &DDRA : &DDRE))))
247247#define __digitalPinToPINReg (P ) \
248- (((P) >= 0 && (P) <= 7) ? &PINB : (((P) >= 8 && (P) <= 15) ? &PIND : (((P) >= 16 && (P) <= 23) ? &PINC : (((P) >= 24 && (P) <= 31) ? &PINA : &PINE))))
248+ (((P) <= 7) ? &PINB : (((P) >= 8 && (P) <= 15) ? &PIND : (((P) >= 16 && (P) <= 23) ? &PINC : (((P) >= 24 && (P) <= 31) ? &PINA : &PINE))))
249249# if defined(SANGUINO_PINOUT )
250250#define __digitalPinToBit (P ) \
251- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (((P) >= 16 && (P) <= 23) ? (7 - ((P) - 24)) : (P) - 32))))
251+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (((P) >= 16 && (P) <= 23) ? (7 - ((P) - 24)) : (P) - 32))))
252252# else //MightyCore Pinout
253253#define __digitalPinToBit (P ) \
254- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (((P) >= 16 && (P) <= 23) ? (P) - 24 : (P) - 32))))
254+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (((P) >= 16 && (P) <= 23) ? (P) - 24 : (P) - 32))))
255255# endif
256256#else
257257#define __digitalPinToPortReg (P ) \
258- (((P) >= 0 && (P) <= 7) ? &PORTB : (((P) >= 8 && (P) <= 15) ? &PORTD : (((P) >= 16 && (P) <= 23) ? &PORTC : &PORTA)))
258+ (((P) <= 7) ? &PORTB : (((P) >= 8 && (P) <= 15) ? &PORTD : (((P) >= 16 && (P) <= 23) ? &PORTC : &PORTA)))
259259#define __digitalPinToDDRReg (P ) \
260- (((P) >= 0 && (P) <= 7) ? &DDRB : (((P) >= 8 && (P) <= 15) ? &DDRD : (((P) >= 16 && (P) <= 23) ? &DDRC : &DDRA)))
260+ (((P) <= 7) ? &DDRB : (((P) >= 8 && (P) <= 15) ? &DDRD : (((P) >= 16 && (P) <= 23) ? &DDRC : &DDRA)))
261261#define __digitalPinToPINReg (P ) \
262- (((P) >= 0 && (P) <= 7) ? &PINB : (((P) >= 8 && (P) <= 15) ? &PIND : (((P) >= 16 && (P) <= 23) ? &PINC : &PINA)))
262+ (((P) <= 7) ? &PINB : (((P) >= 8 && (P) <= 15) ? &PIND : (((P) >= 16 && (P) <= 23) ? &PINC : &PINA)))
263263# if defined(SANGUINO_PINOUT )
264264#define __digitalPinToBit (P ) \
265- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (7 - ((P) - 24)))))
265+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (7 - ((P) - 24)))))
266266# else //MightyCore Pinout
267267#define __digitalPinToBit (P ) \
268- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (P) - 24)))
268+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 15) ? (P) - 8 : (((P) >= 16 && (P) <= 23) ? (P) - 16 : (P) - 24)))
269269# endif
270270#endif
271271
287287#define SPI_HW_SCK_PIN (15) //PB1
288288
289289#define __digitalPinToPortReg (P ) \
290- ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PORTD : (((P) == 5 || (P) == 13) ? &PORTC : (((P) >= 18 && (P) <= 23)) ? &PORTF : (((P) == 7) ? &PORTE : &PORTB)))
290+ ((((P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PORTD : (((P) == 5 || (P) == 13) ? &PORTC : (((P) >= 18 && (P) <= 23)) ? &PORTF : (((P) == 7) ? &PORTE : &PORTB)))
291291#define __digitalPinToDDRReg (P ) \
292- ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &DDRD : (((P) == 5 || (P) == 13) ? &DDRC : (((P) >= 18 && (P) <= 23)) ? &DDRF : (((P) == 7) ? &DDRE : &DDRB)))
292+ ((((P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &DDRD : (((P) == 5 || (P) == 13) ? &DDRC : (((P) >= 18 && (P) <= 23)) ? &DDRF : (((P) == 7) ? &DDRE : &DDRB)))
293293#define __digitalPinToPINReg (P ) \
294- ((((P) >= 0 && (P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PIND : (((P) == 5 || (P) == 13) ? &PINC : (((P) >= 18 && (P) <= 23)) ? &PINF : (((P) == 7) ? &PINE : &PINB)))
294+ ((((P) <= 4) || (P) == 6 || (P) == 12 || (P) == 24 || (P) == 25 || (P) == 29) ? &PIND : (((P) == 5 || (P) == 13) ? &PINC : (((P) >= 18 && (P) <= 23)) ? &PINF : (((P) == 7) ? &PINE : &PINB)))
295295#define __digitalPinToBit (P ) \
296296(((P) >= 8 && (P) <= 11) ? (P) - 4 : (((P) >= 18 && (P) <= 21) ? 25 - (P) : (((P) == 0) ? 2 : (((P) == 1) ? 3 : (((P) == 2) ? 1 : (((P) == 3) ? 0 : (((P) == 4) ? 4 : (((P) == 6) ? 7 : (((P) == 13) ? 7 : (((P) == 14) ? 3 : (((P) == 15) ? 1 : (((P) == 16) ? 2 : (((P) == 17) ? 0 : (((P) == 22) ? 1 : (((P) == 23) ? 0 : (((P) == 24) ? 4 : (((P) == 25) ? 7 : (((P) == 26) ? 4 : (((P) == 27) ? 5 : 6 )))))))))))))))))))
297297
325325
326326#if defined(__AVR_ATmega48PB__ ) || defined(__AVR_ATmega88PB__ ) || defined(__AVR_ATmega168PB__ ) || defined(__AVR_ATmega328PB__ )
327327#define __digitalPinToPortReg (P ) \
328- (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : (((P) >= 14 && (P) <= 19) ? &PORTC : &PORTE)))
328+ (((P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : (((P) >= 14 && (P) <= 19) ? &PORTC : &PORTE)))
329329#define __digitalPinToDDRReg (P ) \
330- (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : (((P) >= 14 && (P) <= 19) ? &DDRC : &DDRE)))
330+ (((P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : (((P) >= 14 && (P) <= 19) ? &DDRC : &DDRE)))
331331#define __digitalPinToPINReg (P ) \
332- (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : (((P) >= 14 && (P) <= 19) ? &PINC : &PINE)))
332+ (((P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : (((P) >= 14 && (P) <= 19) ? &PINC : &PINE)))
333333#define __digitalPinToBit (P ) \
334- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (((P) >= 14 && (P) <= 19) ? (P) - 14 : (((P) >= 20 && (P) <= 21) ? (P) - 18 : (P) - 22))))
334+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (((P) >= 14 && (P) <= 19) ? (P) - 14 : (((P) >= 20 && (P) <= 21) ? (P) - 18 : (P) - 22))))
335335#else
336336#define __digitalPinToPortReg (P ) \
337- (((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC))
337+ (((P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC))
338338#define __digitalPinToDDRReg (P ) \
339- (((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC))
339+ (((P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC))
340340#define __digitalPinToPINReg (P ) \
341- (((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC))
341+ (((P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC))
342342#define __digitalPinToBit (P ) \
343- (((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (P) - 14))
343+ (((P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (P) - 14))
344344#endif
345345
346346// --- Arduino Uno WiFi Rev 2, Nano Every ---
@@ -462,7 +462,7 @@ if (__builtin_constant_p(P) && __builtin_constant_p(V)) { \
462462#else
463463#define pinModeFast pinMode
464464#endif
465- #endif
465+ #endif // !defined(pinModeFast)
466466
467467#if !defined(digitalReadFast )
468468#if (defined(__AVR__ ) || defined(ARDUINO_ARCH_AVR ))
@@ -474,7 +474,7 @@ if (__builtin_constant_p(P) && __builtin_constant_p(V)) { \
474474#else
475475#define digitalReadFast digitalRead
476476#endif
477- #endif
477+ #endif // !defined(digitalReadFast)
478478
479479#if !defined(digitalToggleFast )
480480#if (defined(__AVR__ ) || defined(ARDUINO_ARCH_AVR ))
@@ -487,6 +487,6 @@ if (__builtin_constant_p(P)) { \
487487#else
488488#define digitalToggleFast (P ) digitalWrite(P, ! digitalRead(P))
489489#endif
490- #endif
490+ #endif // !defined(digitalToggleFast)
491491
492492#endif //__digitalWriteFast_h_
0 commit comments