Debian Codegraph @

docs/firmware/pin_defs.h

raw symbols SCIP
1 /*------------------------------------------------------------------------ */
2 #if defined(__AVR_ATmega168__) || defined(__AVR_ATmega328P__) || defined(__AVR_ATmega88) || defined(__AVR_ATmega8__) || defined(__AVR_ATmega88__)
3 /*------------------------------------------------------------------------ */
4
5 /* Onboard LED is connected to pin PB5 in Arduino NG, Diecimila, and Duemilanove
6 */
7 #if !defined(LED)
8 #define LED B5
9 #endif
10
11 #if !defined(LED_KUTTY)
12 #define LED_KUTTY B5
13 #endif
14
15
16 /* Ports for soft UART */
17 #ifdef SOFT_UART
18 #define UART_PORT PORTD
19 #define UART_PIN PIND
20 #define UART_DDR DDRD
21 #define UART_TX_BIT 1
22 #define UART_RX_BIT 0
23 #endif
24 #endif
25
26 #if defined(__AVR_ATmega8__) || defined(__AVR_ATmega32__)
27 //Name conversion R.Wiersma
28 #define UCSR0A UCSRA
29 #define UDR0 UDR
30 #define UDRE0 UDRE
31 #define RXC0 RXC
32 #define FE0 FE
33 #define TIFR1 TIFR
34 #define WDTCSR WDTCR
35 #endif
36
37 #if defined(__AVR_ATmega32__)
38 #define WDCE WDTOE
39
40 #if !defined(LED_KUTTY)
41 #define LED_KUTTY B3
42 #endif
43
44 #endif
45
46 /* Luminet support */
47 /*------------------------------------------------------------------------ */
48 #if defined(__AVR_ATtiny84__)
49 /*------------------------------------------------------------------------ */
50 /* Red LED is connected to pin PA4 */
51 #if !defined(LED)
52 #define LED A4
53 #endif
54
55 /* Ports for soft UART - left port only for now. TX/RX on PA2/PA3 */
56 #ifdef SOFT_UART
57 #define UART_PORT PORTA
58 #define UART_PIN PINA
59 #define UART_DDR DDRA
60 #define UART_TX_BIT 2
61 #define UART_RX_BIT 3
62 #endif
63 #endif
64
65 /*------------------------------------------------------------------------ */
66 /* Sanguino support (and other 40pin DIP cpus) */
67 #if defined(__AVR_ATmega644P__) || defined(__AVR_ATmega1284P__) || defined(__AVR_ATmega32__)
68 /*------------------------------------------------------------------------ */
69 /* Onboard LED is connected to pin PB0 on Sanguino */
70 #if !defined(LED)
71 #define LED B0
72 #endif
73
74 /* Ports for soft UART */
75 #ifdef SOFT_UART
76 #define UART_PORT PORTD
77 #define UART_PIN PIND
78 #define UART_DDR DDRD
79 #define UART_TX_BIT 1
80 #define UART_RX_BIT 0
81 #endif
82 #endif
83
84 /*------------------------------------------------------------------------ */
85 /* Mega support */
86 #if defined(__AVR_ATmega1280__)
87 /*------------------------------------------------------------------------ */
88 /* Onboard LED is connected to pin PB7 on Arduino Mega */
89 #if !defined(LED)
90 #define LED B7
91 #endif
92
93 /* Ports for soft UART */
94 #ifdef SOFT_UART
95 #define UART_PORT PORTE
96 #define UART_PIN PINE
97 #define UART_DDR DDRE
98 #define UART_TX_BIT 1
99 #define UART_RX_BIT 0
100 #endif
101 #endif
102
103 /*
104 * ------------------------------------------------------------------------
105 * A bunch of macros to enable the LED to be specifed as "B5" for bit 5
106 * of port B, and similar.
107 */
108
109 #define A0 0x100
110 #define A1 0x101
111 #define A2 0x102
112 #define A3 0x103
113 #define A4 0x104
114 #define A5 0x105
115 #define A6 0x106
116 #define A7 0x107
117
118 #define B0 0x200
119 #define B1 0x201
120 #define B2 0x202
121 #define B3 0x203
122 #define B4 0x204
123 #define B5 0x205
124 #define B6 0x206
125 #define B7 0x207
126
127 #define C0 0x300
128 #define C1 0x301
129 #define C2 0x302
130 #define C3 0x303
131 #define C4 0x304
132 #define C5 0x305
133 #define C6 0x306
134 #define C7 0x307
135
136 #define D0 0x400
137 #define D1 0x401
138 #define D2 0x402
139 #define D3 0x403
140 #define D4 0x404
141 #define D5 0x405
142 #define D6 0x406
143 #define D7 0x407
144
145 #define E0 0x500
146 #define E1 0x501
147 #define E2 0x502
148 #define E3 0x503
149 #define E4 0x504
150 #define E5 0x505
151 #define E6 0x506
152 #define E7 0x507
153
154 #define F0 0x600
155 #define F1 0x601
156 #define F2 0x602
157 #define F3 0x603
158 #define F4 0x604
159 #define F5 0x605
160 #define F6 0x606
161 #define F7 0x607
162
163 #define G0 0x700
164 #define G1 0x701
165 #define G2 0x702
166 #define G3 0x703
167 #define G4 0x704
168 #define G5 0x705
169 #define G6 0x706
170 #define G7 0x707
171
172 #define H0 0x800
173 #define H1 0x801
174 #define H2 0x802
175 #define H3 0x803
176 #define H4 0x804
177 #define H5 0x805
178 #define H6 0x806
179 #define H7 0x807
180
181 #define J0 0xA00
182 #define J1 0xA01
183 #define J2 0xA02
184 #define J3 0xA03
185 #define J4 0xA04
186 #define J5 0xA05
187 #define J6 0xA06
188 #define J7 0xA07
189
190 #define K0 0xB00
191 #define K1 0xB01
192 #define K2 0xB02
193 #define K3 0xB03
194 #define K4 0xB04
195 #define K5 0xB05
196 #define K6 0xB06
197 #define K7 0xB07
198
199 #define L0 0xC00
200 #define L1 0xC01
201 #define L2 0xC02
202 #define L3 0xC03
203 #define L4 0xC04
204 #define L5 0xC05
205 #define L6 0xC06
206 #define L7 0xC07
207
208
209
210 #if LED == B0
211 #undef LED
212 #define LED_DDR DDRB
213 #define LED_PORT PORTB
214 #define LED_PIN PINB
215 #define LED PINB0
216 #elif LED == B1
217 #undef LED
218 #define LED_DDR DDRB
219 #define LED_PORT PORTB
220 #define LED_PIN PINB
221 #define LED PINB1
222 #elif LED == B2
223 #undef LED
224 #define LED_DDR DDRB
225 #define LED_PORT PORTB
226 #define LED_PIN PINB
227 #define LED PINB2
228 #elif LED == B3
229 #undef LED
230 #define LED_DDR DDRB
231 #define LED_PORT PORTB
232 #define LED_PIN PINB
233 #define LED PINB3
234 #elif LED == B4
235 #undef LED
236 #define LED_DDR DDRB
237 #define LED_PORT PORTB
238 #define LED_PIN PINB
239 #define LED PINB4
240 #elif LED == B5
241 #undef LED
242 #define LED_DDR DDRB
243 #define LED_PORT PORTB
244 #define LED_PIN PINB
245 #define LED PINB5
246 #elif LED == B6
247 #undef LED
248 #define LED_DDR DDRB
249 #define LED_PORT PORTB
250 #define LED_PIN PINB
251 #define LED PINB6
252 #elif LED == B7
253 #undef LED
254 #define LED_DDR DDRB
255 #define LED_PORT PORTB
256 #define LED_PIN PINB
257 #define LED PINB7
258
259 #elif LED == C0
260 #undef LED
261 #define LED_DDR DDRC
262 #define LED_PORT PORTC
263 #define LED_PIN PINC
264 #define LED PINC0
265 #elif LED == C1
266 #undef LED
267 #define LED_DDR DDRC
268 #define LED_PORT PORTC
269 #define LED_PIN PINC
270 #define LED PINC1
271 #elif LED == C2
272 #undef LED
273 #define LED_DDR DDRC
274 #define LED_PORT PORTC
275 #define LED_PIN PINC
276 #define LED PINC2
277 #elif LED == C3
278 #undef LED
279 #define LED_DDR DDRC
280 #define LED_PORT PORTC
281 #define LED_PIN PINC
282 #define LED PINC3
283 #elif LED == C4
284 #undef LED
285 #define LED_DDR DDRC
286 #define LED_PORT PORTC
287 #define LED_PIN PINC
288 #define LED PINC4
289 #elif LED == C5
290 #undef LED
291 #define LED_DDR DDRC
292 #define LED_PORT PORTC
293 #define LED_PIN PINC
294 #define LED PINC5
295 #elif LED == C6
296 #undef LED
297 #define LED_DDR DDRC
298 #define LED_PORT PORTC
299 #define LED_PIN PINC
300 #define LED PINC6
301 #elif LED == C7
302 #undef LED
303 #define LED_DDR DDRC
304 #define LED_PORT PORTC
305 #define LED_PIN PINC
306 #define LED PINC7
307
308 #elif LED == D0
309 #undef LED
310 #define LED_DDR DDRD
311 #define LED_PORT PORTD
312 #define LED_PIN PIND
313 #define LED PIND0
314 #elif LED == D1
315 #undef LED
316 #define LED_DDR DDRD
317 #define LED_PORT PORTD
318 #define LED_PIN PIND
319 #define LED PIND1
320 #elif LED == D2
321 #undef LED
322 #define LED_DDR DDRD
323 #define LED_PORT PORTD
324 #define LED_PIN PIND
325 #define LED PIND2
326 #elif LED == D3
327 #undef LED
328 #define LED_DDR DDRD
329 #define LED_PORT PORTD
330 #define LED_PIN PIND
331 #define LED PIND3
332 #elif LED == D4
333 #undef LED
334 #define LED_DDR DDRD
335 #define LED_PORT PORTD
336 #define LED_PIN PIND
337 #define LED PIND4
338 #elif LED == D5
339 #undef LED
340 #define LED_DDR DDRD
341 #define LED_PORT PORTD
342 #define LED_PIN PIND
343 #define LED PIND5
344 #elif LED == D6
345 #undef LED
346 #define LED_DDR DDRD
347 #define LED_PORT PORTD
348 #define LED_PIN PIND
349 #define LED PIND6
350 #elif LED == D7
351 #undef LED
352 #define LED_DDR DDRD
353 #define LED_PORT PORTD
354 #define LED_PIN PIND
355 #define LED PIND7
356
357 #elif LED == E0
358 #undef LED
359 #define LED_DDR DDRE
360 #define LED_PORT PORTE
361 #define LED_PIN PINE
362 #define LED PINE0
363 #elif LED == E1
364 #undef LED
365 #define LED_DDR DDRE
366 #define LED_PORT PORTE
367 #define LED_PIN PINE
368 #define LED PINE1
369 #elif LED == E2
370 #undef LED
371 #define LED_DDR DDRE
372 #define LED_PORT PORTE
373 #define LED_PIN PINE
374 #define LED PINE2
375 #elif LED == E3
376 #undef LED
377 #define LED_DDR DDRE
378 #define LED_PORT PORTE
379 #define LED_PIN PINE
380 #define LED PINE3
381 #elif LED == E4
382 #undef LED
383 #define LED_DDR DDRE
384 #define LED_PORT PORTE
385 #define LED_PIN PINE
386 #define LED PINE4
387 #elif LED == E5
388 #undef LED
389 #define LED_DDR DDRE
390 #define LED_PORT PORTE
391 #define LED_PIN PINE
392 #define LED PINE5
393 #elif LED == E6
394 #undef LED
395 #define LED_DDR DDRE
396 #define LED_PORT PORTE
397 #define LED_PIN PINE
398 #define LED PINE6
399 #elif LED == E7
400 #undef LED
401 #define LED_DDR DDRE
402 #define LED_PORT PORTE
403 #define LED_PIN PINE
404 #define LED PINE7
405
406 #elif LED == F0
407 #undef LED
408 #define LED_DDR DDRF
409 #define LED_PORT PORTF
410 #define LED_PIN PINF
411 #define LED PINF0
412 #elif LED == F1
413 #undef LED
414 #define LED_DDR DDRF
415 #define LED_PORT PORTF
416 #define LED_PIN PINF
417 #define LED PINF1
418 #elif LED == F2
419 #undef LED
420 #define LED_DDR DDRF
421 #define LED_PORT PORTF
422 #define LED_PIN PINF
423 #define LED PINF2
424 #elif LED == F3
425 #undef LED
426 #define LED_DDR DDRF
427 #define LED_PORT PORTF
428 #define LED_PIN PINF
429 #define LED PINF3
430 #elif LED == F4
431 #undef LED
432 #define LED_DDR DDRF
433 #define LED_PORT PORTF
434 #define LED_PIN PINF
435 #define LED PINF4
436 #elif LED == F5
437 #undef LED
438 #define LED_DDR DDRF
439 #define LED_PORT PORTF
440 #define LED_PIN PINF
441 #define LED PINF5
442 #elif LED == F6
443 #undef LED
444 #define LED_DDR DDRF
445 #define LED_PORT PORTF
446 #define LED_PIN PINF
447 #define LED PINF6
448 #elif LED == F7
449 #undef LED
450 #define LED_DDR DDRF
451 #define LED_PORT PORTF
452 #define LED_PIN PINF
453 #define LED PINF7
454
455 #elif LED == G0
456 #undef LED
457 #define LED_DDR DDRG
458 #define LED_PORT PORTG
459 #define LED_PIN PING
460 #define LED PING0
461 #elif LED == G1
462 #undef LED
463 #define LED_DDR DDRG
464 #define LED_PORT PORTG
465 #define LED_PIN PING
466 #define LED PING1
467 #elif LED == G2
468 #undef LED
469 #define LED_DDR DDRG
470 #define LED_PORT PORTG
471 #define LED_PIN PING
472 #define LED PING2
473 #elif LED == G3
474 #undef LED
475 #define LED_DDR DDRG
476 #define LED_PORT PORTG
477 #define LED_PIN PING
478 #define LED PING3
479 #elif LED == G4
480 #undef LED
481 #define LED_DDR DDRG
482 #define LED_PORT PORTG
483 #define LED_PIN PING
484 #define LED PING4
485 #elif LED == G5
486 #undef LED
487 #define LED_DDR DDRG
488 #define LED_PORT PORTG
489 #define LED_PIN PING
490 #define LED PING5
491 #elif LED == G6
492 #undef LED
493 #define LED_DDR DDRG
494 #define LED_PORT PORTG
495 #define LED_PIN PING
496 #define LED PING6
497 #elif LED == G7
498 #undef LED
499 #define LED_DDR DDRG
500 #define LED_PORT PORTG
501 #define LED_PIN PING
502 #define LED PING7
503
504 #elif LED == H0
505 #undef LED
506 #define LED_DDR DDRH
507 #define LED_PORT PORTH
508 #define LED_PIN PINH
509 #define LED PINH0
510 #elif LED == H1
511 #undef LED
512 #define LED_DDR DDRH
513 #define LED_PORT PORTH
514 #define LED_PIN PINH
515 #define LED PINH1
516 #elif LED == H2
517 #undef LED
518 #define LED_DDR DDRH
519 #define LED_PORT PORTH
520 #define LED_PIN PINH
521 #define LED PINH2
522 #elif LED == H3
523 #undef LED
524 #define LED_DDR DDRH
525 #define LED_PORT PORTH
526 #define LED_PIN PINH
527 #define LED PINH3
528 #elif LED == H4
529 #undef LED
530 #define LED_DDR DDRH
531 #define LED_PORT PORTH
532 #define LED_PIN PINH
533 #define LED PINH4
534 #elif LED == H5
535 #undef LED
536 #define LED_DDR DDRH
537 #define LED_PORT PORTH
538 #define LED_PIN PINH
539 #define LED PINH5
540 #elif LED == H6
541 #undef LED
542 #define LED_DDR DDRH
543 #define LED_PORT PORTH
544 #define LED_PIN PINH
545 #define LED PINH6
546 #elif LED == H7
547 #undef LED
548 #define LED_DDR DDRH
549 #define LED_PORT PORTH
550 #define LED_PIN PINH
551 #define LED PINH7
552
553 #elif LED == J0
554 #undef LED
555 #define LED_DDR DDRJ
556 #define LED_PORT PORTJ
557 #define LED_PIN PINJ
558 #define LED PINJ0
559 #elif LED == J1
560 #undef LED
561 #define LED_DDR DDRJ
562 #define LED_PORT PORTJ
563 #define LED_PIN PINJ
564 #define LED PINJ1
565 #elif LED == J2
566 #undef LED
567 #define LED_DDR DDRJ
568 #define LED_PORT PORTJ
569 #define LED_PIN PINJ
570 #define LED PINJ2
571 #elif LED == J3
572 #undef LED
573 #define LED_DDR DDRJ
574 #define LED_PORT PORTJ
575 #define LED_PIN PINJ
576 #define LED PINJ3
577 #elif LED == J4
578 #undef LED
579 #define LED_DDR DDRJ
580 #define LED_PORT PORTJ
581 #define LED_PIN PINJ
582 #define LED PINJ4
583 #elif LED == J5
584 #undef LED
585 #define LED_DDR DDRJ
586 #define LED_PORT PORTJ
587 #define LED_PIN PINJ
588 #define LED PINJ5
589 #elif LED == J6
590 #undef LED
591 #define LED_DDR DDRJ
592 #define LED_PORT PORTJ
593 #define LED_PIN PINJ
594 #define LED PINJ6
595 #elif LED == J7
596 #undef LED
597 #define LED_DDR DDRJ
598 #define LED_PORT PORTJ
599 #define LED_PIN PINJ
600 #define LED PINJ7
601
602 #elif LED == K0
603 #undef LED
604 #define LED_DDR DDRK
605 #define LED_PORT PORTK
606 #define LED_PIN PINK
607 #define LED PINK0
608 #elif LED == K1
609 #undef LED
610 #define LED_DDR DDRK
611 #define LED_PORT PORTK
612 #define LED_PIN PINK
613 #define LED PINK1
614 #elif LED == K2
615 #undef LED
616 #define LED_DDR DDRK
617 #define LED_PORT PORTK
618 #define LED_PIN PINK
619 #define LED PINK2
620 #elif LED == K3
621 #undef LED
622 #define LED_DDR DDRK
623 #define LED_PORT PORTK
624 #define LED_PIN PINK
625 #define LED PINK3
626 #elif LED == K4
627 #undef LED
628 #define LED_DDR DDRK
629 #define LED_PORT PORTK
630 #define LED_PIN PINK
631 #define LED PINK4
632 #elif LED == K5
633 #undef LED
634 #define LED_DDR DDRK
635 #define LED_PORT PORTK
636 #define LED_PIN PINK
637 #define LED PINK5
638 #elif LED == K6
639 #undef LED
640 #define LED_DDR DDRK
641 #define LED_PORT PORTK
642 #define LED_PIN PINK
643 #define LED PINK6
644 #elif LED == K7
645 #undef LED
646 #define LED_DDR DDRK
647 #define LED_PORT PORTK
648 #define LED_PIN PINK
649 #define LED PINK7
650
651 #elif LED == L0
652 #undef LED
653 #define LED_DDR DDRL
654 #define LED_PORT PORTL
655 #define LED_PIN PINL
656 #define LED PINL0
657 #elif LED == L1
658 #undef LED
659 #define LED_DDR DDRL
660 #define LED_PORT PORTL
661 #define LED_PIN PINL
662 #define LED PINL1
663 #elif LED == L2
664 #undef LED
665 #define LED_DDR DDRL
666 #define LED_PORT PORTL
667 #define LED_PIN PINL
668 #define LED PINL2
669 #elif LED == L3
670 #undef LED
671 #define LED_DDR DDRL
672 #define LED_PORT PORTL
673 #define LED_PIN PINL
674 #define LED PINL3
675 #elif LED == L4
676 #undef LED
677 #define LED_DDR DDRL
678 #define LED_PORT PORTL
679 #define LED_PIN PINL
680 #define LED PINL4
681 #elif LED == L5
682 #undef LED
683 #define LED_DDR DDRL
684 #define LED_PORT PORTL
685 #define LED_PIN PINL
686 #define LED PINL5
687 #elif LED == L6
688 #undef LED
689 #define LED_DDR DDRL
690 #define LED_PORT PORTL
691 #define LED_PIN PINL
692 #define LED PINL6
693 #elif LED == L7
694 #undef LED
695 #define LED_DDR DDRL
696 #define LED_PORT PORTL
697 #define LED_PIN PINL
698 #define LED PINL7
699
700 #elif LED == A0
701 #undef LED
702 #define LED_DDR DDRA
703 #define LED_PORT PORTA
704 #define LED_PIN PINA
705 #define LED PINA0
706 #elif LED == A1
707 #undef LED
708 #define LED_DDR DDRA
709 #define LED_PORT PORTA
710 #define LED_PIN PINA
711 #define LED PINA1
712 #elif LED == A2
713 #undef LED
714 #define LED_DDR DDRA
715 #define LED_PORT PORTA
716 #define LED_PIN PINA
717 #define LED PINA2
718 #elif LED == A3
719 #undef LED
720 #define LED_DDR DDRA
721 #define LED_PORT PORTA
722 #define LED_PIN PINA
723 #define LED PINA3
724 #elif LED == A4
725 #undef LED
726 #define LED_DDR DDRA
727 #define LED_PORT PORTA
728 #define LED_PIN PINA
729 #define LED PINA4
730 #elif LED == A5
731 #undef LED
732 #define LED_DDR DDRA
733 #define LED_PORT PORTA
734 #define LED_PIN PINA
735 #define LED PINA5
736 #elif LED == A6
737 #undef LED
738 #define LED_DDR DDRA
739 #define LED_PORT PORTA
740 #define LED_PIN PINA
741 #define LED PINA6
742 #elif LED == A7
743 #undef LED
744 #define LED_DDR DDRA
745 #define LED_PORT PORTA
746 #define LED_PIN PINA
747 #define LED PINA7
748
749 #else
750 #error -------------------------------------------
751 #error Unrecognized LED name. Should be like "B5"
752 #error -------------------------------------------
753 #endif