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 
126 MAKE_PORT(PORTA, DDRA, PINA, Porta, 'A')
127 #endif
128 #ifdef USE_PORTB
129 MAKE_PORT(PORTB, DDRB, PINB, Portb, 'B')
130 #endif
131 #ifdef USE_PORTC
132 MAKE_PORT(PORTC, DDRC, PINC, Portc, 'C')
133 #endif
134 #ifdef USE_PORTD
135 MAKE_PORT(PORTD, DDRD, PIND, Portd, 'D')
136 #endif
137 #ifdef USE_PORTE
138 MAKE_PORT(PORTE, DDRE, PINE, Porte, 'E')
139 #endif
140 #ifdef USE_PORTF
141 MAKE_PORT(PORTF, DDRF, PINF, Portf, 'F')
142 #endif
143 #ifdef USE_PORTG
144 MAKE_PORT(PORTG, DDRG, PING, Portg, 'G')
145 #endif
146 #ifdef USE_PORTH
147 MAKE_PORT(PORTH, DDRH, PINH, Porth, 'H')
148 #endif
149 #ifdef USE_PORTJ
150 MAKE_PORT(PORTJ, DDRJ, PINJ, Portj, 'J')
151 #endif
152 #ifdef USE_PORTK
153 MAKE_PORT(PORTK, DDRK, PINK, Portk, 'K')
154 #endif
155 #ifdef USE_PORTL
156 MAKE_PORT(PORTL, DDRL, PINL, Portl, 'L')
157 #endif
158 #ifdef USE_PORTQ
159 MAKE_PORT(PORTQ, DDRQ, PINQ, Portq, 'Q')
160 #endif
161 #ifdef USE_PORTR
162 MAKE_PORT(PORTR, DDRR, PINR, Portr, 'R')
163 #endif
164 
165 #ifdef USE_TCCR0A
166 MAKE_TCCR(TCCR0A, Tccr0a)
167 #endif
168 #ifdef USE_TCCR1A
169 MAKE_TCCR(TCCR1A, Tccr1a)
170 #endif
171 #ifdef USE_TCCR2A
172 MAKE_TCCR(TCCR2A, Tccr2a)
173 #endif
174 
175 // this class represents one pin in a IO port.
176 // It is fully static.
177 template<typename PORT, uint8_t PIN>
178 class TPin {
179  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
180 public:
181  typedef PORT Port;
182 
183  enum {
184  Number = PIN
185  };
186 
187  static void Set() {
188  PORT::Set(1 << PIN);
189  }
190 
191  static void Set(uint8_t val) {
192  if(val)
193  Set();
194  else Clear();
195  }
196 
197  static void SetDir(uint8_t val) {
198  if(val)
199  SetDirWrite();
200  else SetDirRead();
201  }
202 
203  static void Clear() {
204  PORT::Clear(1 << PIN);
205  }
206 
207  static void Toggle() {
208  PORT::Toggle(1 << PIN);
209  }
210 
211  static void SetDirRead() {
212  PORT::DirClear(1 << PIN);
213  }
214 
215  static void SetDirWrite() {
216  PORT::DirSet(1 << PIN);
217  }
218 
219  static uint8_t IsSet() {
220  return PORT::PinRead() & (uint8_t) (1 << PIN);
221  }
222 
223  static void WaiteForSet() {
224  while(IsSet() == 0) {
225  }
226  }
227 
228  static void WaiteForClear() {
229  while(IsSet()) {
230  }
231  }
232 }; //class TPin...
233 
234 // this class represents one bit in TCCR port.
235 // used to set/clear TCCRx bits
236 // It is fully static.
237 
238 template<typename TCCR, uint8_t COM>
239 class TCom {
240  // BOOST_STATIC_ASSERT(PIN < PORT::Width);
241 public:
242  typedef TCCR Tccr;
243 
244  enum {
245  Com = COM
246  };
247 
248  static void Set() {
249  TCCR::Set(1 << COM);
250  }
251 
252  static void Clear() {
253  TCCR::Clear(1 << COM);
254  }
255 
256  static void Toggle() {
257  TCCR::Toggle(1 << COM);
258  }
259 }; //class TCom...
260 
261 //Short pin definitions
262 #ifdef USE_PORTA
263 typedef TPin<Porta, 0 > Pa0;
264 typedef TPin<Porta, 1 > Pa1;
265 typedef TPin<Porta, 2 > Pa2;
266 typedef TPin<Porta, 3 > Pa3;
267 typedef TPin<Porta, 4 > Pa4;
268 typedef TPin<Porta, 5 > Pa5;
269 typedef TPin<Porta, 6 > Pa6;
270 typedef TPin<Porta, 7 > Pa7;
271 #endif
272 
273 #ifdef USE_PORTB
274 typedef TPin<Portb, 0 > Pb0;
275 typedef TPin<Portb, 1 > Pb1;
276 typedef TPin<Portb, 2 > Pb2;
277 typedef TPin<Portb, 3 > Pb3;
278 typedef TPin<Portb, 4 > Pb4;
279 typedef TPin<Portb, 5 > Pb5;
280 typedef TPin<Portb, 6 > Pb6;
281 typedef TPin<Portb, 7 > Pb7;
282 #endif
283 
284 #ifdef USE_PORTC
285 typedef TPin<Portc, 0 > Pc0;
286 typedef TPin<Portc, 1 > Pc1;
287 typedef TPin<Portc, 2 > Pc2;
288 typedef TPin<Portc, 3 > Pc3;
289 typedef TPin<Portc, 4 > Pc4;
290 typedef TPin<Portc, 5 > Pc5;
291 typedef TPin<Portc, 6 > Pc6;
292 typedef TPin<Portc, 7 > Pc7;
293 #endif
294 
295 #ifdef USE_PORTD
296 typedef TPin<Portd, 0 > Pd0;
297 typedef TPin<Portd, 1 > Pd1;
298 typedef TPin<Portd, 2 > Pd2;
299 typedef TPin<Portd, 3 > Pd3;
300 typedef TPin<Portd, 4 > Pd4;
301 typedef TPin<Portd, 5 > Pd5;
302 typedef TPin<Portd, 6 > Pd6;
303 typedef TPin<Portd, 7 > Pd7;
304 #endif
305 
306 #ifdef USE_PORTE
307 typedef TPin<Porte, 0 > Pe0;
308 typedef TPin<Porte, 1 > Pe1;
309 typedef TPin<Porte, 2 > Pe2;
310 typedef TPin<Porte, 3 > Pe3;
311 typedef TPin<Porte, 4 > Pe4;
312 typedef TPin<Porte, 5 > Pe5;
313 typedef TPin<Porte, 6 > Pe6;
314 typedef TPin<Porte, 7 > Pe7;
315 #endif
316 
317 #ifdef USE_PORTF
318 typedef TPin<Portf, 0 > Pf0;
319 typedef TPin<Portf, 1 > Pf1;
320 typedef TPin<Portf, 2 > Pf2;
321 typedef TPin<Portf, 3 > Pf3;
322 typedef TPin<Portf, 4 > Pf4;
323 typedef TPin<Portf, 5 > Pf5;
324 typedef TPin<Portf, 6 > Pf6;
325 typedef TPin<Portf, 7 > Pf7;
326 #endif
327 
328 #ifdef USE_PORTG
329 typedef TPin<Portg, 0 > Pg0;
330 typedef TPin<Portg, 1 > Pg1;
331 typedef TPin<Portg, 2 > Pg2;
332 typedef TPin<Portg, 3 > Pg3;
333 typedef TPin<Portg, 4 > Pg4;
334 typedef TPin<Portg, 5 > Pg5;
335 typedef TPin<Portg, 6 > Pg6;
336 typedef TPin<Portg, 7 > Pg7;
337 #endif
338 
339 #ifdef USE_PORTH
340 typedef TPin<Porth, 0 > Ph0;
341 typedef TPin<Porth, 1 > Ph1;
342 typedef TPin<Porth, 2 > Ph2;
343 typedef TPin<Porth, 3 > Ph3;
344 typedef TPin<Porth, 4 > Ph4;
345 typedef TPin<Porth, 5 > Ph5;
346 typedef TPin<Porth, 6 > Ph6;
347 typedef TPin<Porth, 7 > Ph7;
348 #endif
349 
350 #ifdef USE_PORTJ
351 typedef TPin<Portj, 0 > Pj0;
352 typedef TPin<Portj, 1 > Pj1;
353 typedef TPin<Portj, 2 > Pj2;
354 typedef TPin<Portj, 3 > Pj3;
355 typedef TPin<Portj, 4 > Pj4;
356 typedef TPin<Portj, 5 > Pj5;
357 typedef TPin<Portj, 6 > Pj6;
358 typedef TPin<Portj, 7 > Pj7;
359 #endif
360 
361 #ifdef USE_PORTK
362 typedef TPin<Portk, 0 > Pk0;
363 typedef TPin<Portk, 1 > Pk1;
364 typedef TPin<Portk, 2 > Pk2;
365 typedef TPin<Portk, 3 > Pk3;
366 typedef TPin<Portk, 4 > Pk4;
367 typedef TPin<Portk, 5 > Pk5;
368 typedef TPin<Portk, 6 > Pk6;
369 typedef TPin<Portk, 7 > Pk7;
370 #endif
371 
372 #ifdef USE_PORTL
373 typedef TPin<Portl, 0 > Pl0;
374 typedef TPin<Portl, 1 > Pl1;
375 typedef TPin<Portl, 2 > Pl2;
376 typedef TPin<Portl, 3 > Pl3;
377 typedef TPin<Portl, 4 > Pl4;
378 typedef TPin<Portl, 5 > Pl5;
379 typedef TPin<Portl, 6 > Pl6;
380 typedef TPin<Portl, 7 > Pl7;
381 #endif
382 
383 #ifdef USE_PORTQ
384 typedef TPin<Portq, 0 > Pq0;
385 typedef TPin<Portq, 1 > Pq1;
386 typedef TPin<Portq, 2 > Pq2;
387 typedef TPin<Portq, 3 > Pq3;
388 typedef TPin<Portq, 4 > Pq4;
389 typedef TPin<Portq, 5 > Pq5;
390 typedef TPin<Portq, 6 > Pq6;
391 typedef TPin<Portq, 7 > Pq7;
392 #endif
393 
394 #ifdef USE_PORTR
395 typedef TPin<Portr, 0 > Pr0;
396 typedef TPin<Portr, 1 > Pr1;
397 typedef TPin<Portr, 2 > Pr2;
398 typedef TPin<Portr, 3 > Pr3;
399 typedef TPin<Portr, 4 > Pr4;
400 typedef TPin<Portr, 5 > Pr5;
401 typedef TPin<Portr, 6 > Pr6;
402 typedef TPin<Portr, 7 > Pr7;
403 #endif
404 
405 #ifdef USE_TCCR0A
406 typedef TCom<Tccr0a, COM0A1> Tc0a; //P6
407 typedef TCom<Tccr0a, COM0B1> Tc0b; //P5
408 #endif
409 
410 #ifdef USE_TCCR1A
411 typedef TCom<Tccr1a, COM1A1> Tc1a; //P9
412 typedef TCom<Tccr1a, COM1B1> Tc1b; //P10
413 #endif
414 
415 #ifdef USE_TCCR2A
416 typedef TCom<Tccr2a, COM2A1> Tc2a; //P11
417 typedef TCom<Tccr2a, COM2B1> Tc2b; //P3
418 #endif
419 
420 template<typename Tp_pin, typename Tc_bit>
421 class Tp_Tc {
422 public:
423 
424  static void SetDir(uint8_t val) {
425  if(val)
426  SetDirWrite();
427  else SetDirRead();
428  }
429 
430  static void SetDirRead() {
431  Tp_pin::SetDirRead(); //set pin direction
432  Tc_bit::Clear(); //disconnect pin from PWM
433  }
434 
435  static void SetDirWrite() {
436  Tp_pin::SetDirWrite();
437  Tc_bit::Clear();
438  }
439 };
440 
441 /* pin definitions for cases where it's necessary to clear compare output mode bits */
442 
443 //typedef Tp_Tc<Pd3, Tc2b> P3; //Arduino pin 3
444 //typedef Tp_Tc<Pd5, Tc0b> P5; //Arduino pin 5
445 //typedef Tp_Tc<Pd6, Tc0a> P6; //Arduino pin 6
446 //typedef Tp_Tc<Pb1, Tc1a> P9; //Arduino pin 9
447 //typedef Tp_Tc<Pb2, Tc1b> P10; //Arduino pin 10
448 //typedef Tp_Tc<Pb3, Tc2a> P11; //Arduino pin 11
449 
450 /* Arduino pin definitions */
451 #if defined(__AVR_ATmega1280__) || (__AVR_ATmega2560__)
452 
453 // "Mega" Arduino pin numbers
454 
455 #define P0 Pe0
456 #define P1 Pe1
457 #define P2 Pe4
458 #define P3 Pe5
459 #define P4 Pg5
460 #define P5 Pe5
461 #define P6 Ph3
462 #define P7 Ph4
463 
464 #define P8 Ph5
465 #define P9 Ph6
466 #define P10 Pb4
467 #define P11 Pb5
468 #define P12 Pb6
469 #define P13 Pb7
470 
471 #define P14 Pj1
472 #define P15 Pj0
473 #define P16 Ph1
474 #define P17 Ph0
475 #define P18 Pd3
476 #define P19 Pd2
477 #define P20 Pd1
478 #define P21 Pd0
479 
480 #define P22 Pa0
481 #define P23 Pa1
482 #define P24 Pa2
483 #define P25 Pa3
484 #define P26 Pa4
485 #define P27 Pa5
486 #define P28 Pa6
487 #define P29 Pa7
488 #define P30 Pc7
489 #define P31 Pc6
490 #define P32 Pc5
491 #define P33 Pc4
492 #define P34 Pc3
493 #define P35 Pc2
494 #define P36 Pc1
495 #define P37 Pc0
496 
497 #define P38 Pd7
498 #define P39 Pg2
499 #define P40 Pg1
500 #define P41 Pg0
501 #define P42 Pl7
502 #define P43 Pl6
503 #define P44 Pl5
504 #define P45 Pl4
505 #define P46 Pl3
506 #define P47 Pl2
507 #define P48 Pl1
508 #define P49 Pl0
509 #define P50 Pb3
510 #define P51 Pb2
511 #define P52 Pb1
512 #define P53 Pb0
513 #define P54 Pe6 // INT on Arduino ADK
514 
515 #endif //"Mega" pin numbers
516 
517 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__)
518 //"Classic" Arduino pin numbers
519 
520 #define P0 Pd0
521 #define P1 Pd1
522 #define P2 Pd2
523 #define P3 Pd3
524 #define P4 Pd4
525 #define P5 Pd5
526 #define P6 Pd6
527 #define P7 Pd7
528 
529 #define P8 Pb0
530 #define P9 Pb1
531 #define P10 Pb2
532 #define P11 Pb3
533 #define P12 Pb4
534 #define P13 Pb5
535 
536 #define P14 Pc0
537 #define P15 Pc1
538 #define P16 Pc2
539 #define P17 Pc3
540 #define P18 Pc4
541 #define P19 Pc5
542 
543 #endif // "Classic" Arduino pin numbers
544 
545 #if !defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
546 // Arduino Leonardo pin numbers
547 
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
556 
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
563 
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
568 
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
575 
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
582 
583 #endif // Arduino Leonardo pin numbers
584 
585 #if defined(BOARD_TEENSY) && defined(__AVR_ATmega32U4__)
586 // Teensy 2.0 pin numbers
587 // http://www.pjrc.com/teensy/pinout.html
588 #define P0 Pb0
589 #define P1 Pb1
590 #define P2 Pb2
591 #define P3 Pb3
592 #define P4 Pb7
593 #define P5 Pd0
594 #define P6 Pd1
595 #define P7 Pd2
596 #define P8 Pd3
597 #define P9 Pc6
598 #define P10 Pc7
599 #define P11 Pd6
600 #define P12 Pd7
601 #define P13 Pb4
602 #define P14 Pb5
603 #define P15 Pb6
604 #define P16 Pf7
605 #define P17 Pf6
606 #define P18 Pf5
607 #define P19 Pf4
608 #define P20 Pf1
609 #define P21 Pf0
610 #define P22 Pd4
611 #define P23 Pd5
612 #define P24 Pe6
613 #endif // Teensy 2.0
614 
615 #if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)
616 // Teensy++ 2.0 pin numbers
617 // http://www.pjrc.com/teensy/pinout.html
618 #define P0 Pd0
619 #define P1 Pd1
620 #define P2 Pd2
621 #define P3 Pd3
622 #define P4 Pd4
623 #define P5 Pd5
624 #define P6 Pd6
625 #define P7 Pd7
626 #define P8 Pe0
627 #define P9 Pe1
628 #define P10 Pc0
629 #define P11 Pc1
630 #define P12 Pc2
631 #define P13 Pc3
632 #define P14 Pc4
633 #define P15 Pc5
634 #define P16 Pc6
635 #define P17 Pc7
636 #define P18 Pe6
637 #define P19 Pe7
638 #define P20 Pb0
639 #define P21 Pb1
640 #define P22 Pb2
641 #define P23 Pb3
642 #define P24 Pb4
643 #define P25 Pb5
644 #define P26 Pb6
645 #define P27 Pb7
646 #define P28 Pa0
647 #define P29 Pa1
648 #define P30 Pa2
649 #define P31 Pa3
650 #define P32 Pa4
651 #define P33 Pa5
652 #define P34 Pa6
653 #define P35 Pa7
654 #define P36 Pe4
655 #define P37 Pe5
656 #define P38 Pf0
657 #define P39 Pf1
658 #define P40 Pf2
659 #define P41 Pf3
660 #define P42 Pf4
661 #define P43 Pf5
662 #define P44 Pf6
663 #define P45 Pf7
664 #endif // Teensy++ 2.0
665 
666 #if !defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
667 #define BOARD_BALANDUINO
668 // Balanduino pin numbers
669 // http://balanduino.net/
670 #define P0 Pd0 /* 0 - PD0 */
671 #define P1 Pd1 /* 1 - PD1 */
672 #define P2 Pb2 /* 2 - PB2 */
673 #define P3 Pd6 /* 3 - PD6 */
674 #define P4 Pd7 /* 4 - PD7 */
675 #define P5 Pb3 /* 5 - PB3 */
676 #define P6 Pb4 /* 6 - PB4 */
677 #define P7 Pa0 /* 7 - PA0 */
678 #define P8 Pa1 /* 8 - PA1 */
679 #define P9 Pa2 /* 9 - PA2 */
680 #define P10 Pa3 /* 10 - PA3 */
681 #define P11 Pa4 /* 11 - PA4 */
682 #define P12 Pa5 /* 12 - PA5 */
683 #define P13 Pc0 /* 13 - PC0 */
684 #define P14 Pc1 /* 14 - PC1 */
685 #define P15 Pd2 /* 15 - PD2 */
686 #define P16 Pd3 /* 16 - PD3 */
687 #define P17 Pd4 /* 17 - PD4 */
688 #define P18 Pd5 /* 18 - PD5 */
689 #define P19 Pc2 /* 19 - PC2 */
690 #define P20 Pc3 /* 20 - PC3 */
691 #define P21 Pc4 /* 21 - PC4 */
692 #define P22 Pc5 /* 22 - PC5 */
693 #define P23 Pc6 /* 23 - PC6 */
694 #define P24 Pc7 /* 24 - PC7 */
695 #define P25 Pb0 /* 25 - PB0 */
696 #define P26 Pb1 /* 26 - PB1 */
697 #define P27 Pb5 /* 27 - PB5 */
698 #define P28 Pb6 /* 28 - PB6 */
699 #define P29 Pb7 /* 29 - PB7 */
700 #define P30 Pa6 /* 30 - PA6 */
701 #define P31 Pa7 /* 31 - PA7 */
702 #endif // Balanduino
703 
704 #if defined(BOARD_SANGUINO) && (defined(__AVR_ATmega644__) || defined(__AVR_ATmega644P__))
705 // Sanguino pin numbers
706 // http://sanguino.cc/hardware
707 #define P0 Pb0
708 #define P1 Pb1
709 #define P2 Pb2
710 #define P3 Pb3
711 #define P4 Pb4
712 #define P5 Pb5
713 #define P6 Pb6
714 #define P7 Pb7
715 #define P8 Pd0
716 #define P9 Pd1
717 #define P10 Pd2
718 #define P11 Pd3
719 #define P12 Pd4
720 #define P13 Pd5
721 #define P14 Pd6
722 #define P15 Pd7
723 #define P16 Pc0
724 #define P17 Pc1
725 #define P18 Pc2
726 #define P19 Pc3
727 #define P20 Pc4
728 #define P21 Pc5
729 #define P22 Pc6
730 #define P23 Pc7
731 #define P24 Pa0
732 #define P25 Pa1
733 #define P26 Pa2
734 #define P27 Pa3
735 #define P28 Pa4
736 #define P29 Pa5
737 #define P30 Pa6
738 #define P31 Pa7
739 #endif // Sanguino
740 
741 #endif //_avrpins_h_