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};\
176 template<
typename PORT, u
int8_t PIN>
184 static void Set() { PORT::Set(1 << PIN); }
186 static void Set(uint8_t val){
196 static void Clear(){PORT::Clear(1 << PIN);}
198 static void Toggle(){PORT::Toggle(1 << PIN);}
204 static uint8_t
IsSet(){
return PORT::PinRead() & (uint8_t)(1 << PIN);}
214 template<
typename TCCR, u
int8_t COM>
222 static void Set() { TCCR::Set(1 << COM); }
224 static void Clear() { TCCR::Clear(1 << COM); }
226 static void Toggle() { TCCR::Toggle(1 << COM); }
388 template<
typename Tp_pin,
typename Tc_bit>
398 Tp_pin::SetDirRead();
402 Tp_pin::SetDirWrite();
417 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
479 #define P54 Pe6 // INT on Arduino ADK
481 #endif //"Mega" pin numbers
483 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
509 #endif // "Classic" Arduino pin numbers
511 #if !defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
514 #define P0 Pd2 // D0 - PD2
515 #define P1 Pd3 // D1 - PD3
516 #define P2 Pd1 // D2 - PD1
517 #define P3 Pd0 // D3 - PD0
518 #define P4 Pd4 // D4 - PD4
519 #define P5 Pc6 // D5 - PC6
520 #define P6 Pd7 // D6 - PD7
521 #define P7 Pe6 // D7 - PE6
523 #define P8 Pb4 // D8 - PB4
524 #define P9 Pb5 // D9 - PB5
525 #define P10 Pb6 // D10 - PB6
526 #define P11 Pb7 // D11 - PB7
527 #define P12 Pd6 // D12 - PD6
528 #define P13 Pc7 // D13 - PC7
530 #define P14 Pb3 // D14 - MISO - PB3
531 #define P15 Pb1 // D15 - SCK - PB1
532 #define P16 Pb2 // D16 - MOSI - PB2
533 #define P17 Pb0 // D17 - SS - PB0
535 #define P18 Pf7 // D18 - A0 - PF7
536 #define P19 Pf6 // D19 - A1 - PF6
537 #define P20 Pf5 // D20 - A2 - PF5
538 #define P21 Pf4 // D21 - A3 - PF4
539 #define P22 Pf1 // D22 - A4 - PF1
540 #define P23 Pf0 // D23 - A5 - PF0
542 #define P24 Pd4 // D24 / D4 - A6 - PD4
543 #define P25 Pd7 // D25 / D6 - A7 - PD7
544 #define P26 Pb4 // D26 / D8 - A8 - PB4
545 #define P27 Pb5 // D27 / D9 - A9 - PB5
546 #define P28 Pb6 // D28 / D10 - A10 - PB6
547 #define P29 Pd6 // D29 / D12 - A11 - PD6
549 #endif // Arduino Leonardo pin numbers
551 #if defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
581 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
630 #endif // Teensy++ 2.0
632 #if !defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
633 #define BOARD_BALANDUINO
670 #if defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))