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