23 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
85 #define MAKE_PORT(portName, ddrName, pinName, className, ID) \
88 typedef uint8_t DataT;\
90 static void Write(DataT value){portName = value;}\
91 static void ClearAndSet(DataT clearMask, DataT value){portName = (portName & ~clearMask) | value;}\
92 static DataT Read(){return portName;}\
93 static void DirWrite(DataT value){ddrName = value;}\
94 static DataT DirRead(){return ddrName;}\
95 static void Set(DataT value){portName |= value;}\
96 static void Clear(DataT value){portName &= ~value;}\
97 static void Toggle(DataT value){portName ^= value;}\
98 static void DirSet(DataT value){ddrName |= value;}\
99 static void DirClear(DataT value){ddrName &= ~value;}\
100 static void DirToggle(DataT value){ddrName ^= value;}\
101 static DataT PinRead(){return pinName;}\
103 enum{Width=sizeof(DataT)*8};\
107 #define MAKE_TCCR(TccrName, className) \
110 typedef uint8_t DataT;\
112 static void Write(DataT value){TccrName = value;}\
113 static void ClearAndSet(DataT clearMask, DataT value){TccrName = (TccrName & ~clearMask) | value;}\
114 static DataT Read(){return TccrName;}\
115 static void Set(DataT value){TccrName |= value;}\
116 static void Clear(DataT value){TccrName &= ~value;}\
117 static void Toggle(DataT value){TccrName ^= value;}\
118 enum{Width=sizeof(DataT)*8};\
173 template<
typename PORT, u
int8_t PIN>
181 static void Set() { PORT::Set(1 << PIN); }
183 static void Set(uint8_t val){
193 static void Clear(){PORT::Clear(1 << PIN);}
195 static void Toggle(){PORT::Toggle(1 << PIN);}
201 static uint8_t
IsSet(){
return PORT::PinRead() & (uint8_t)(1 << PIN);}
211 template<
typename TCCR, u
int8_t COM>
219 static void Set() { TCCR::Set(1 << COM); }
221 static void Clear() { TCCR::Clear(1 << COM); }
223 static void Toggle() { TCCR::Toggle(1 << COM); }
385 template<
typename Tp_pin,
typename Tc_bit>
395 Tp_pin::SetDirRead();
399 Tp_pin::SetDirWrite();
414 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
476 #define P54 Pe6 // INT on Arduino ADK
478 #endif //"Mega" pin numbers
480 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
506 #endif // "Classic" Arduino pin numbers
508 #if !defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
511 #define P0 Pd2 // D0 - PD2
512 #define P1 Pd3 // D1 - PD3
513 #define P2 Pd1 // D2 - PD1
514 #define P3 Pd0 // D3 - PD0
515 #define P4 Pd4 // D4 - PD4
516 #define P5 Pc6 // D5 - PC6
517 #define P6 Pd7 // D6 - PD7
518 #define P7 Pe6 // D7 - PE6
520 #define P8 Pb4 // D8 - PB4
521 #define P9 Pb5 // D9 - PB5
522 #define P10 Pb6 // D10 - PB6
523 #define P11 Pb7 // D11 - PB7
524 #define P12 Pd6 // D12 - PD6
525 #define P13 Pc7 // D13 - PC7
527 #define P14 Pb3 // D14 - MISO - PB3
528 #define P15 Pb1 // D15 - SCK - PB1
529 #define P16 Pb2 // D16 - MOSI - PB2
530 #define P17 Pb0 // D17 - SS - PB0
532 #define P18 Pf7 // D18 - A0 - PF7
533 #define P19 Pf6 // D19 - A1 - PF6
534 #define P20 Pf5 // D20 - A2 - PF5
535 #define P21 Pf4 // D21 - A3 - PF4
536 #define P22 Pf1 // D22 - A4 - PF1
537 #define P23 Pf0 // D23 - A5 - PF0
539 #define P24 Pd4 // D24 / D4 - A6 - PD4
540 #define P25 Pd7 // D25 / D6 - A7 - PD7
541 #define P26 Pb4 // D26 / D8 - A8 - PB4
542 #define P27 Pb5 // D27 / D9 - A9 - PB5
543 #define P28 Pb6 // D28 / D10 - A10 - PB6
544 #define P29 Pd6 // D29 / D12 - A11 - PD6
546 #endif // Arduino Leonardo pin numbers
548 #if defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
578 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
627 #endif // Teensy++ 2.0
629 #if defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__)