23 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
88 #define MAKE_PORT(portName, ddrName, pinName, className, ID) \
91 typedef uint8_t DataT;\
93 static void Write(DataT value){portName = value;}\
94 static void ClearAndSet(DataT clearMask, DataT value){portName = (portName & ~clearMask) | value;}\
95 static DataT Read(){return portName;}\
96 static void DirWrite(DataT value){ddrName = value;}\
97 static DataT DirRead(){return ddrName;}\
98 static void Set(DataT value){portName |= value;}\
99 static void Clear(DataT value){portName &= ~value;}\
100 static void Toggle(DataT value){portName ^= value;}\
101 static void DirSet(DataT value){ddrName |= value;}\
102 static void DirClear(DataT value){ddrName &= ~value;}\
103 static void DirToggle(DataT value){ddrName ^= value;}\
104 static DataT PinRead(){return pinName;}\
106 enum{Width=sizeof(DataT)*8};\
110 #define MAKE_TCCR(TccrName, className) \
113 typedef uint8_t DataT;\
115 static void Write(DataT value){TccrName = value;}\
116 static void ClearAndSet(DataT clearMask, DataT value){TccrName = (TccrName & ~clearMask) | value;}\
117 static DataT Read(){return TccrName;}\
118 static void Set(DataT value){TccrName |= value;}\
119 static void Clear(DataT value){TccrName &= ~value;}\
120 static void Toggle(DataT value){TccrName ^= value;}\
121 enum{Width=sizeof(DataT)*8};\
177 template<
typename PORT, u
int8_t PIN>
191 static void Set(uint8_t val) {
204 PORT::Clear(1 << PIN);
208 PORT::Toggle(1 << PIN);
212 PORT::DirClear(1 << PIN);
216 PORT::DirSet(1 << PIN);
220 return PORT::PinRead() & (uint8_t) (1 << PIN);
224 while(
IsSet() == 0) {
238 template<
typename TCCR, u
int8_t COM>
253 TCCR::Clear(1 << COM);
257 TCCR::Toggle(1 << COM);
420 template<
typename Tp_pin,
typename Tc_bit>
431 Tp_pin::SetDirRead();
436 Tp_pin::SetDirWrite();
451 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
513 #define P54 Pe6 // INT on Arduino ADK
515 #endif //"Mega" pin numbers
517 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
543 #endif // "Classic" Arduino pin numbers
545 #if !defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
548 #define P0 Pd2 // D0 - PD2
549 #define P1 Pd3 // D1 - PD3
550 #define P2 Pd1 // D2 - PD1
551 #define P3 Pd0 // D3 - PD0
552 #define P4 Pd4 // D4 - PD4
553 #define P5 Pc6 // D5 - PC6
554 #define P6 Pd7 // D6 - PD7
555 #define P7 Pe6 // D7 - PE6
557 #define P8 Pb4 // D8 - PB4
558 #define P9 Pb5 // D9 - PB5
559 #define P10 Pb6 // D10 - PB6
560 #define P11 Pb7 // D11 - PB7
561 #define P12 Pd6 // D12 - PD6
562 #define P13 Pc7 // D13 - PC7
564 #define P14 Pb3 // D14 - MISO - PB3
565 #define P15 Pb1 // D15 - SCK - PB1
566 #define P16 Pb2 // D16 - MOSI - PB2
567 #define P17 Pb0 // D17 - SS - PB0
569 #define P18 Pf7 // D18 - A0 - PF7
570 #define P19 Pf6 // D19 - A1 - PF6
571 #define P20 Pf5 // D20 - A2 - PF5
572 #define P21 Pf4 // D21 - A3 - PF4
573 #define P22 Pf1 // D22 - A4 - PF1
574 #define P23 Pf0 // D23 - A5 - PF0
576 #define P24 Pd4 // D24 / D4 - A6 - PD4
577 #define P25 Pd7 // D25 / D6 - A7 - PD7
578 #define P26 Pb4 // D26 / D8 - A8 - PB4
579 #define P27 Pb5 // D27 / D9 - A9 - PB5
580 #define P28 Pb6 // D28 / D10 - A10 - PB6
581 #define P29 Pd6 // D29 / D12 - A11 - PD6
583 #endif // Arduino Leonardo pin numbers
585 #if defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
615 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
664 #endif // Teensy++ 2.0
666 #if !defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
667 #define BOARD_BALANDUINO
704 #if defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))