USB_Host_Shield_2.0
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
avrpins.h
Go to the documentation of this file.
1 /* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.
2 
3 This software may be distributed and modified under the terms of the GNU
4 General Public License version 2 (GPL2) as published by the Free Software
5 Foundation and appearing in the file GPL2.TXT included in the packaging of
6 this file. Please note that GPL2 Section 2[b] requires that all works based
7 on this software must also be made publicly available under the terms of
8 the GPL2 ("Copyleft").
9 
10 Contact information
11 -------------------
12 
13 Circuits At Home, LTD
14 Web : http://www.circuitsathome.com
15 e-mail : support@circuitsathome.com
16 */
17 
18 /* derived from Konstantin Chizhov's AVR port templates */
19 
20 #ifndef _avrpins_h_
21 #define _avrpins_h_
22 
23 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
24 /* Uncomment the following if you have Arduino Mega ADK board with MAX3421e built-in */
25 //#define BOARD_MEGA_ADK
26 #endif
27 
28 /* Uncomment the following if you are using a Teensy 2.0 */
29 //#define BOARD_TEENSY
30 
31 /* Uncomment the following if you are using a Sanguino */
32 //#define BOARD_SANGUINO
33 
34 #include <avr/io.h>
35 
36 #ifdef PORTA
37 #define USE_PORTA
38 #endif
39 #ifdef PORTB
40 #define USE_PORTB
41 #endif
42 #ifdef PORTC
43 #define USE_PORTC
44 #endif
45 #ifdef PORTD
46 #define USE_PORTD
47 #endif
48 #ifdef PORTE
49 #define USE_PORTE
50 #endif
51 #ifdef PORTF
52 #define USE_PORTF
53 #endif
54 #ifdef PORTG
55 #define USE_PORTG
56 #endif
57 #ifdef PORTH
58 #define USE_PORTH
59 #endif
60 #ifdef PORTJ
61 #define USE_PORTJ
62 #endif
63 #ifdef PORTK
64 #define USE_PORTK
65 #endif
66 #ifdef PORTL
67 #define USE_PORTL
68 #endif
69 #ifdef PORTQ
70 #define USE_PORTQ
71 #endif
72 #ifdef PORTR
73 #define USE_PORTR
74 #endif
75 
76 #ifdef TCCR0A
77 #define USE_TCCR0A
78 #endif
79 #ifdef TCCR1A
80 #define USE_TCCR1A
81 #endif
82 #ifdef TCCR2A
83 #define USE_TCCR2A
84 #endif
85 
86 //Port definitions for AtTiny, AtMega families.
87 
88 #define MAKE_PORT(portName, ddrName, pinName, className, ID) \
89  class className{\
90  public:\
91  typedef uint8_t DataT;\
92  public:\
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;}\
105  enum{Id = ID};\
106  enum{Width=sizeof(DataT)*8};\
107  };
108 
109 // TCCR registers to set/clear Arduino PWM
110 #define MAKE_TCCR(TccrName, className) \
111  class className{\
112  public:\
113  typedef uint8_t DataT;\
114  public:\
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};\
122  };
123 
124 #ifdef USE_PORTA
125 MAKE_PORT(PORTA, DDRA, PINA, Porta, 'A')
126 #endif
127 #ifdef USE_PORTB
128 MAKE_PORT(PORTB, DDRB, PINB, Portb, 'B')
129 #endif
130 #ifdef USE_PORTC
131 MAKE_PORT(PORTC, DDRC, PINC, Portc, 'C')
132 #endif
133 #ifdef USE_PORTD
134 MAKE_PORT(PORTD, DDRD, PIND, Portd, 'D')
135 #endif
136 #ifdef USE_PORTE
137 MAKE_PORT(PORTE, DDRE, PINE, Porte, 'E')
138 #endif
139 #ifdef USE_PORTF
140 MAKE_PORT(PORTF, DDRF, PINF, Portf, 'F')
141 #endif
142 #ifdef USE_PORTG
143 MAKE_PORT(PORTG, DDRG, PING, Portg, 'G')
144 #endif
145 #ifdef USE_PORTH
146 MAKE_PORT(PORTH, DDRH, PINH, Porth, 'H')
147 #endif
148 #ifdef USE_PORTJ
149 MAKE_PORT(PORTJ, DDRJ, PINJ, Portj, 'J')
150 #endif
151 #ifdef USE_PORTK
152 MAKE_PORT(PORTK, DDRK, PINK, Portk, 'K')
153 #endif
154 #ifdef USE_PORTL
155 MAKE_PORT(PORTL, DDRL, PINL, Portl, 'L')
156 #endif
157 #ifdef USE_PORTQ
158 MAKE_PORT(PORTQ, DDRQ, PINQ, Portq, 'Q')
159 #endif
160 #ifdef USE_PORTR
161 MAKE_PORT(PORTR, DDRR, PINR, Portr, 'R')
162 #endif
163 
164 #ifdef USE_TCCR0A
165 MAKE_TCCR(TCCR0A, Tccr0a)
166 #endif
167 #ifdef USE_TCCR1A
168 MAKE_TCCR(TCCR1A, Tccr1a)
169 #endif
170 #ifdef USE_TCCR2A
171 MAKE_TCCR(TCCR2A, Tccr2a)
172 #endif
173 
174  // this class represents one pin in a IO port.
175  // It is fully static.
176  template<typename PORT, uint8_t PIN>
177  class TPin
178  {
179 // BOOST_STATIC_ASSERT(PIN < PORT::Width);
180  public:
181  typedef PORT Port;
182  enum{Number = PIN};
183 
184  static void Set() { PORT::Set(1 << PIN); }
185 
186  static void Set(uint8_t val){
187  if(val)
188  Set();
189  else Clear();}
190 
191  static void SetDir(uint8_t val){
192  if(val)
193  SetDirWrite();
194  else SetDirRead();}
195 
196  static void Clear(){PORT::Clear(1 << PIN);}
197 
198  static void Toggle(){PORT::Toggle(1 << PIN);}
199 
200  static void SetDirRead(){PORT::DirClear(1 << PIN);}
201 
202  static void SetDirWrite(){PORT::DirSet(1 << PIN);}
203 
204  static uint8_t IsSet(){return PORT::PinRead() & (uint8_t)(1 << PIN);}
205 
206  static void WaiteForSet(){ while(IsSet()==0){} }
207 
208  static void WaiteForClear(){ while(IsSet()){} }
209  }; //class TPin...
210 
211  // this class represents one bit in TCCR port.
212  // used to set/clear TCCRx bits
213  // It is fully static.
214  template<typename TCCR, uint8_t COM>
215  class TCom
216  {
217 // BOOST_STATIC_ASSERT(PIN < PORT::Width);
218  public:
219  typedef TCCR Tccr;
220  enum{Com = COM};
221 
222  static void Set() { TCCR::Set(1 << COM); }
223 
224  static void Clear() { TCCR::Clear(1 << COM); }
225 
226  static void Toggle() { TCCR::Toggle(1 << COM); }
227  }; //class TCom...
228 
229 //Short pin definitions
230 #ifdef USE_PORTA
231 typedef TPin<Porta, 0> Pa0;
232 typedef TPin<Porta, 1> Pa1;
233 typedef TPin<Porta, 2> Pa2;
234 typedef TPin<Porta, 3> Pa3;
235 typedef TPin<Porta, 4> Pa4;
236 typedef TPin<Porta, 5> Pa5;
237 typedef TPin<Porta, 6> Pa6;
238 typedef TPin<Porta, 7> Pa7;
239 #endif
240 
241 #ifdef USE_PORTB
242 typedef TPin<Portb, 0> Pb0;
243 typedef TPin<Portb, 1> Pb1;
244 typedef TPin<Portb, 2> Pb2;
245 typedef TPin<Portb, 3> Pb3;
246 typedef TPin<Portb, 4> Pb4;
247 typedef TPin<Portb, 5> Pb5;
248 typedef TPin<Portb, 6> Pb6;
249 typedef TPin<Portb, 7> Pb7;
250 #endif
251 
252 #ifdef USE_PORTC
253 typedef TPin<Portc, 0> Pc0;
254 typedef TPin<Portc, 1> Pc1;
255 typedef TPin<Portc, 2> Pc2;
256 typedef TPin<Portc, 3> Pc3;
257 typedef TPin<Portc, 4> Pc4;
258 typedef TPin<Portc, 5> Pc5;
259 typedef TPin<Portc, 6> Pc6;
260 typedef TPin<Portc, 7> Pc7;
261 #endif
262 
263 #ifdef USE_PORTD
264 typedef TPin<Portd, 0> Pd0;
265 typedef TPin<Portd, 1> Pd1;
266 typedef TPin<Portd, 2> Pd2;
267 typedef TPin<Portd, 3> Pd3;
268 typedef TPin<Portd, 4> Pd4;
269 typedef TPin<Portd, 5> Pd5;
270 typedef TPin<Portd, 6> Pd6;
271 typedef TPin<Portd, 7> Pd7;
272 #endif
273 
274 #ifdef USE_PORTE
275 typedef TPin<Porte, 0> Pe0;
276 typedef TPin<Porte, 1> Pe1;
277 typedef TPin<Porte, 2> Pe2;
278 typedef TPin<Porte, 3> Pe3;
279 typedef TPin<Porte, 4> Pe4;
280 typedef TPin<Porte, 5> Pe5;
281 typedef TPin<Porte, 6> Pe6;
282 typedef TPin<Porte, 7> Pe7;
283 #endif
284 
285 #ifdef USE_PORTF
286 typedef TPin<Portf, 0> Pf0;
287 typedef TPin<Portf, 1> Pf1;
288 typedef TPin<Portf, 2> Pf2;
289 typedef TPin<Portf, 3> Pf3;
290 typedef TPin<Portf, 4> Pf4;
291 typedef TPin<Portf, 5> Pf5;
292 typedef TPin<Portf, 6> Pf6;
293 typedef TPin<Portf, 7> Pf7;
294 #endif
295 
296 #ifdef USE_PORTG
297 typedef TPin<Portg, 0> Pg0;
298 typedef TPin<Portg, 1> Pg1;
299 typedef TPin<Portg, 2> Pg2;
300 typedef TPin<Portg, 3> Pg3;
301 typedef TPin<Portg, 4> Pg4;
302 typedef TPin<Portg, 5> Pg5;
303 typedef TPin<Portg, 6> Pg6;
304 typedef TPin<Portg, 7> Pg7;
305 #endif
306 
307 #ifdef USE_PORTH
308 typedef TPin<Porth, 0> Ph0;
309 typedef TPin<Porth, 1> Ph1;
310 typedef TPin<Porth, 2> Ph2;
311 typedef TPin<Porth, 3> Ph3;
312 typedef TPin<Porth, 4> Ph4;
313 typedef TPin<Porth, 5> Ph5;
314 typedef TPin<Porth, 6> Ph6;
315 typedef TPin<Porth, 7> Ph7;
316 #endif
317 
318 #ifdef USE_PORTJ
319 typedef TPin<Portj, 0> Pj0;
320 typedef TPin<Portj, 1> Pj1;
321 typedef TPin<Portj, 2> Pj2;
322 typedef TPin<Portj, 3> Pj3;
323 typedef TPin<Portj, 4> Pj4;
324 typedef TPin<Portj, 5> Pj5;
325 typedef TPin<Portj, 6> Pj6;
326 typedef TPin<Portj, 7> Pj7;
327 #endif
328 
329 #ifdef USE_PORTK
330 typedef TPin<Portk, 0> Pk0;
331 typedef TPin<Portk, 1> Pk1;
332 typedef TPin<Portk, 2> Pk2;
333 typedef TPin<Portk, 3> Pk3;
334 typedef TPin<Portk, 4> Pk4;
335 typedef TPin<Portk, 5> Pk5;
336 typedef TPin<Portk, 6> Pk6;
337 typedef TPin<Portk, 7> Pk7;
338 #endif
339 
340 #ifdef USE_PORTL
341 typedef TPin<Portl, 0> Pl0;
342 typedef TPin<Portl, 1> Pl1;
343 typedef TPin<Portl, 2> Pl2;
344 typedef TPin<Portl, 3> Pl3;
345 typedef TPin<Portl, 4> Pl4;
346 typedef TPin<Portl, 5> Pl5;
347 typedef TPin<Portl, 6> Pl6;
348 typedef TPin<Portl, 7> Pl7;
349 #endif
350 
351 #ifdef USE_PORTQ
352 typedef TPin<Portq, 0> Pq0;
353 typedef TPin<Portq, 1> Pq1;
354 typedef TPin<Portq, 2> Pq2;
355 typedef TPin<Portq, 3> Pq3;
356 typedef TPin<Portq, 4> Pq4;
357 typedef TPin<Portq, 5> Pq5;
358 typedef TPin<Portq, 6> Pq6;
359 typedef TPin<Portq, 7> Pq7;
360 #endif
361 
362 #ifdef USE_PORTR
363 typedef TPin<Portr, 0> Pr0;
364 typedef TPin<Portr, 1> Pr1;
365 typedef TPin<Portr, 2> Pr2;
366 typedef TPin<Portr, 3> Pr3;
367 typedef TPin<Portr, 4> Pr4;
368 typedef TPin<Portr, 5> Pr5;
369 typedef TPin<Portr, 6> Pr6;
370 typedef TPin<Portr, 7> Pr7;
371 #endif
372 
373 #ifdef USE_TCCR0A
374 typedef TCom<Tccr0a, COM0A1> Tc0a; //P6
375 typedef TCom<Tccr0a, COM0B1> Tc0b; //P5
376 #endif
377 
378 #ifdef USE_TCCR1A
379 typedef TCom<Tccr1a, COM1A1> Tc1a; //P9
380 typedef TCom<Tccr1a, COM1B1> Tc1b; //P10
381 #endif
382 
383 #ifdef USE_TCCR2A
384 typedef TCom<Tccr2a, COM2A1> Tc2a; //P11
385 typedef TCom<Tccr2a, COM2B1> Tc2b; //P3
386 #endif
387 
388 template<typename Tp_pin, typename Tc_bit>
389  class Tp_Tc
390  {
391  public:
392  static void SetDir(uint8_t val){
393  if(val)
394  SetDirWrite();
395  else SetDirRead();
396  }
397  static void SetDirRead(){
398  Tp_pin::SetDirRead(); //set pin direction
399  Tc_bit::Clear(); //disconnect pin from PWM
400  }
401  static void SetDirWrite(){
402  Tp_pin::SetDirWrite();
403  Tc_bit::Clear();
404  }
405  };
406 
407 /* pin definitions for cases where it's necessary to clear compare output mode bits */
408 
409 //typedef Tp_Tc<Pd3, Tc2b> P3; //Arduino pin 3
410 //typedef Tp_Tc<Pd5, Tc0b> P5; //Arduino pin 5
411 //typedef Tp_Tc<Pd6, Tc0a> P6; //Arduino pin 6
412 //typedef Tp_Tc<Pb1, Tc1a> P9; //Arduino pin 9
413 //typedef Tp_Tc<Pb2, Tc1b> P10; //Arduino pin 10
414 //typedef Tp_Tc<Pb3, Tc2a> P11; //Arduino pin 11
415 
416 /* Arduino pin definitions */
417 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
418 
419 // "Mega" Arduino pin numbers
420 
421 #define P0 Pe0
422 #define P1 Pe1
423 #define P2 Pe4
424 #define P3 Pe5
425 #define P4 Pg5
426 #define P5 Pe5
427 #define P6 Ph3
428 #define P7 Ph4
429 
430 #define P8 Ph5
431 #define P9 Ph6
432 #define P10 Pb4
433 #define P11 Pb5
434 #define P12 Pb6
435 #define P13 Pb7
436 
437 #define P14 Pj1
438 #define P15 Pj0
439 #define P16 Ph1
440 #define P17 Ph0
441 #define P18 Pd3
442 #define P19 Pd2
443 #define P20 Pd1
444 #define P21 Pd0
445 
446 #define P22 Pa0
447 #define P23 Pa1
448 #define P24 Pa2
449 #define P25 Pa3
450 #define P26 Pa4
451 #define P27 Pa5
452 #define P28 Pa6
453 #define P29 Pa7
454 #define P30 Pc7
455 #define P31 Pc6
456 #define P32 Pc5
457 #define P33 Pc4
458 #define P34 Pc3
459 #define P35 Pc2
460 #define P36 Pc1
461 #define P37 Pc0
462 
463 #define P38 Pd7
464 #define P39 Pg2
465 #define P40 Pg1
466 #define P41 Pg0
467 #define P42 Pl7
468 #define P43 Pl6
469 #define P44 Pl5
470 #define P45 Pl4
471 #define P46 Pl3
472 #define P47 Pl2
473 #define P48 Pl1
474 #define P49 Pl0
475 #define P50 Pb3
476 #define P51 Pb2
477 #define P52 Pb1
478 #define P53 Pb0
479 #define P54 Pe6 // INT on Arduino ADK
480 
481 #endif //"Mega" pin numbers
482 
483 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
484 //"Classic" Arduino pin numbers
485 
486 #define P0 Pd0
487 #define P1 Pd1
488 #define P2 Pd2
489 #define P3 Pd3
490 #define P4 Pd4
491 #define P5 Pd5
492 #define P6 Pd6
493 #define P7 Pd7
494 
495 #define P8 Pb0
496 #define P9 Pb1
497 #define P10 Pb2
498 #define P11 Pb3
499 #define P12 Pb4
500 #define P13 Pb5
501 
502 #define P14 Pc0
503 #define P15 Pc1
504 #define P16 Pc2
505 #define P17 Pc3
506 #define P18 Pc4
507 #define P19 Pc5
508 
509 #endif // "Classic" Arduino pin numbers
510 
511 #if !defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
512 // Arduino Leonardo pin numbers
513 
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
522 
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
529 
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
534 
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
541 
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
548 
549 #endif // Arduino Leonardo pin numbers
550 
551 #if defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
552 // Teensy 2.0 pin numbers
553 // http://www.pjrc.com/teensy/pinout.html
554 #define P0 Pb0
555 #define P1 Pb1
556 #define P2 Pb2
557 #define P3 Pb3
558 #define P4 Pb7
559 #define P5 Pd0
560 #define P6 Pd1
561 #define P7 Pd2
562 #define P8 Pd3
563 #define P9 Pc6
564 #define P10 Pc7
565 #define P11 Pd6
566 #define P12 Pd7
567 #define P13 Pb4
568 #define P14 Pb5
569 #define P15 Pb6
570 #define P16 Pf7
571 #define P17 Pf6
572 #define P18 Pf5
573 #define P19 Pf4
574 #define P20 Pf1
575 #define P21 Pf0
576 #define P22 Pd4
577 #define P23 Pd5
578 #define P24 Pe6
579 #endif // Teensy 2.0
580 
581 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
582 // Teensy++ 2.0 pin numbers
583 // http://www.pjrc.com/teensy/pinout.html
584 #define P0 Pd0
585 #define P1 Pd1
586 #define P2 Pd2
587 #define P3 Pd3
588 #define P4 Pd4
589 #define P5 Pd5
590 #define P6 Pd6
591 #define P7 Pd7
592 #define P8 Pe0
593 #define P9 Pe1
594 #define P10 Pc0
595 #define P11 Pc1
596 #define P12 Pc2
597 #define P13 Pc3
598 #define P14 Pc4
599 #define P15 Pc5
600 #define P16 Pc6
601 #define P17 Pc7
602 #define P18 Pe6
603 #define P19 Pe7
604 #define P20 Pb0
605 #define P21 Pb1
606 #define P22 Pb2
607 #define P23 Pb3
608 #define P24 Pb4
609 #define P25 Pb5
610 #define P26 Pb6
611 #define P27 Pb7
612 #define P28 Pa0
613 #define P29 Pa1
614 #define P30 Pa2
615 #define P31 Pa3
616 #define P32 Pa4
617 #define P33 Pa5
618 #define P34 Pa6
619 #define P35 Pa7
620 #define P36 Pe4
621 #define P37 Pe5
622 #define P38 Pf0
623 #define P39 Pf1
624 #define P40 Pf2
625 #define P41 Pf3
626 #define P42 Pf4
627 #define P43 Pf5
628 #define P44 Pf6
629 #define P45 Pf7
630 #endif // Teensy++ 2.0
631 
632 #if !defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
633 #define BOARD_BALANDUINO
634 // Balanduino pin numbers
635 // http://balanduino.net/
636 #define P0 Pd0 /* 0 - PD0 */
637 #define P1 Pd1 /* 1 - PD1 */
638 #define P2 Pb2 /* 2 - PB2 */
639 #define P3 Pd6 /* 3 - PD6 */
640 #define P4 Pd7 /* 4 - PD7 */
641 #define P5 Pb3 /* 5 - PB3 */
642 #define P6 Pb4 /* 6 - PB4 */
643 #define P7 Pa0 /* 7 - PA0 */
644 #define P8 Pa1 /* 8 - PA1 */
645 #define P9 Pa2 /* 9 - PA2 */
646 #define P10 Pa3 /* 10 - PA3 */
647 #define P11 Pa4 /* 11 - PA4 */
648 #define P12 Pa5 /* 12 - PA5 */
649 #define P13 Pc0 /* 13 - PC0 */
650 #define P14 Pc1 /* 14 - PC1 */
651 #define P15 Pd2 /* 15 - PD2 */
652 #define P16 Pd3 /* 16 - PD3 */
653 #define P17 Pd4 /* 17 - PD4 */
654 #define P18 Pd5 /* 18 - PD5 */
655 #define P19 Pc2 /* 19 - PC2 */
656 #define P20 Pc3 /* 20 - PC3 */
657 #define P21 Pc4 /* 21 - PC4 */
658 #define P22 Pc5 /* 22 - PC5 */
659 #define P23 Pc6 /* 23 - PC6 */
660 #define P24 Pc7 /* 24 - PC7 */
661 #define P25 Pb0 /* 25 - PB0 */
662 #define P26 Pb1 /* 26 - PB1 */
663 #define P27 Pb5 /* 27 - PB5 */
664 #define P28 Pb6 /* 28 - PB6 */
665 #define P29 Pb7 /* 29 - PB7 */
666 #define P30 Pa6 /* 30 - PA6 */
667 #define P31 Pa7 /* 31 - PA7 */
668 #endif // Balanduino
669 
670 #if defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
671 // Sanguino pin numbers
672 // http://sanguino.cc/hardware
673 #define P0 Pb0
674 #define P1 Pb1
675 #define P2 Pb2
676 #define P3 Pb3
677 #define P4 Pb4
678 #define P5 Pb5
679 #define P6 Pb6
680 #define P7 Pb7
681 #define P8 Pd0
682 #define P9 Pd1
683 #define P10 Pd2
684 #define P11 Pd3
685 #define P12 Pd4
686 #define P13 Pd5
687 #define P14 Pd6
688 #define P15 Pd7
689 #define P16 Pc0
690 #define P17 Pc1
691 #define P18 Pc2
692 #define P19 Pc3
693 #define P20 Pc4
694 #define P21 Pc5
695 #define P22 Pc6
696 #define P23 Pc7
697 #define P24 Pa0
698 #define P25 Pa1
699 #define P26 Pa2
700 #define P27 Pa3
701 #define P28 Pa4
702 #define P29 Pa5
703 #define P30 Pa6
704 #define P31 Pa7
705 #endif // Sanguino
706 
707 #endif //_avrpins_h_