summaryrefslogtreecommitdiff
path: root/Sprinter/fastio.h
blob: aa5ad0e7bddd1eb4809a57cd68a0dabe36ba1ef7 (plain)
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
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
/*
	This code contibuted by Triffid_Hunter and modified by Kliment
	why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html
*/

#ifndef	_ARDUINO_H
#define	_ARDUINO_H

#include	<avr/io.h>

/*
	utility functions
*/

#ifndef		MASK
/// MASKING- returns \f$2^PIN\f$
	#define		MASK(PIN)				(1 << PIN)
#endif

/*
	magic I/O routines

	now you can simply SET_OUTPUT(STEP); WRITE(STEP, 1); WRITE(STEP, 0);
*/

/// Read a pin
#define		_READ(IO)					((bool)(DIO ## IO ## _RPORT & MASK(DIO ## IO ## _PIN)))
/// write to a pin
#define		_WRITE(IO, v)			do { if (v) {DIO ##  IO ## _WPORT |= MASK(DIO ## IO ## _PIN); } else {DIO ##  IO ## _WPORT &= ~MASK(DIO ## IO ## _PIN); }; } while (0)
/// toggle a pin
#define		_TOGGLE(IO)				do {DIO ##  IO ## _RPORT = MASK(DIO ## IO ## _PIN); } while (0)

/// set pin as input
#define		_SET_INPUT(IO)		do {DIO ##  IO ## _DDR &= ~MASK(DIO ## IO ## _PIN); } while (0)
/// set pin as output
#define		_SET_OUTPUT(IO)		do {DIO ##  IO ## _DDR |=  MASK(DIO ## IO ## _PIN); } while (0)

/// check if pin is an input
#define		_GET_INPUT(IO)		((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) == 0)
/// check if pin is an output
#define		_GET_OUTPUT(IO)		((DIO ## IO ## _DDR & MASK(DIO ## IO ## _PIN)) != 0)

//	why double up on these macros? see http://gcc.gnu.org/onlinedocs/cpp/Stringification.html

/// Read a pin wrapper
#define		READ(IO)					_READ(IO)
/// Write to a pin wrapper
#define		WRITE(IO, v)			_WRITE(IO, v)
/// toggle a pin wrapper
#define		TOGGLE(IO)				_TOGGLE(IO)

/// set pin as input wrapper
#define		SET_INPUT(IO)			_SET_INPUT(IO)
/// set pin as output wrapper
#define		SET_OUTPUT(IO)		_SET_OUTPUT(IO)

/// check if pin is an input wrapper
#define		GET_INPUT(IO)			_GET_INPUT(IO)
/// check if pin is an output wrapper
#define		GET_OUTPUT(IO)		_GET_OUTPUT(IO)

/*
	ports and functions

	added as necessary or if I feel like it- not a comprehensive list!
*/

#if defined (__AVR_ATmega168__) || defined (__AVR_ATmega328__) || defined (__AVR_ATmega328P__)
// UART
#define	RXD					DIO0
#define	TXD					DIO1

// SPI
#define	SCK					DIO13
#define	MISO				DIO12
#define	MOSI				DIO11
#define	SS					DIO10

// TWI (I2C)
#define	SCL					AIO5
#define	SDA					AIO4

// timers and PWM
#define	OC0A				DIO6
#define	OC0B				DIO5
#define	OC1A				DIO9
#define	OC1B				DIO10
#define	OC2A				DIO11
#define	OC2B				DIO3

#define	DEBUG_LED		AIO5

/*
pins
*/

#define DIO0_PIN		PIND0
#define DIO0_RPORT	PIND
#define DIO0_WPORT	PORTD
#define DIO0_DDR		DDRD
#define DIO0_PWM		NULL

#define DIO1_PIN		PIND1
#define DIO1_RPORT	PIND
#define DIO1_WPORT	PORTD
#define DIO1_DDR		DDRD
#define DIO1_PWM		NULL

#define DIO2_PIN		PIND2
#define DIO2_RPORT	PIND
#define DIO2_WPORT	PORTD
#define DIO2_DDR		DDRD
#define DIO2_PWM		NULL

#define DIO3_PIN		PIND3
#define DIO3_RPORT	PIND
#define DIO3_WPORT	PORTD
#define DIO3_DDR		DDRD
#define DIO3_PWM		&OCR2B

#define DIO4_PIN		PIND4
#define DIO4_RPORT	PIND
#define DIO4_WPORT	PORTD
#define DIO4_DDR		DDRD
#define DIO4_PWM		NULL

#define DIO5_PIN		PIND5
#define DIO5_RPORT	PIND
#define DIO5_WPORT	PORTD
#define DIO5_DDR		DDRD
#define DIO5_PWM		&OCR0B

#define DIO6_PIN		PIND6
#define DIO6_RPORT	PIND
#define DIO6_WPORT	PORTD
#define DIO6_DDR		DDRD
#define DIO6_PWM		&OCR0A

#define DIO7_PIN		PIND7
#define DIO7_RPORT	PIND
#define DIO7_WPORT	PORTD
#define DIO7_DDR		DDRD
#define DIO7_PWM		NULL

#define DIO8_PIN		PINB0
#define DIO8_RPORT	PINB
#define DIO8_WPORT	PORTB
#define DIO8_DDR		DDRB
#define DIO8_PWM		NULL

#define DIO9_PIN		PINB1
#define DIO9_RPORT	PINB
#define DIO9_WPORT	PORTB
#define DIO9_DDR		DDRB
#define DIO9_PWM		NULL

#define DIO10_PIN		PINB2
#define DIO10_RPORT	PINB
#define DIO10_WPORT	PORTB
#define DIO10_DDR		DDRB
#define DIO10_PWM		NULL

#define DIO11_PIN		PINB3
#define DIO11_RPORT	PINB
#define DIO11_WPORT	PORTB
#define DIO11_DDR		DDRB
#define DIO11_PWM		&OCR2A

#define DIO12_PIN		PINB4
#define DIO12_RPORT	PINB
#define DIO12_WPORT	PORTB
#define DIO12_DDR		DDRB
#define DIO12_PWM		NULL

#define DIO13_PIN		PINB5
#define DIO13_RPORT	PINB
#define DIO13_WPORT	PORTB
#define DIO13_DDR		DDRB
#define DIO13_PWM		NULL


#define AIO0_PIN		PINC0
#define AIO0_RPORT	PINC
#define AIO0_WPORT	PORTC
#define AIO0_DDR		DDRC
#define AIO0_PWM		NULL

#define AIO1_PIN		PINC1
#define AIO1_RPORT	PINC
#define AIO1_WPORT	PORTC
#define AIO1_DDR		DDRC
#define AIO1_PWM		NULL

#define AIO2_PIN		PINC2
#define AIO2_RPORT	PINC
#define AIO2_WPORT	PORTC
#define AIO2_DDR		DDRC
#define AIO2_PWM		NULL

#define AIO3_PIN		PINC3
#define AIO3_RPORT	PINC
#define AIO3_WPORT	PORTC
#define AIO3_DDR		DDRC
#define AIO3_PWM		NULL

#define AIO4_PIN		PINC4
#define AIO4_RPORT	PINC
#define AIO4_WPORT	PORTC
#define AIO4_DDR		DDRC
#define AIO4_PWM		NULL

#define AIO5_PIN		PINC5
#define AIO5_RPORT	PINC
#define AIO5_WPORT	PORTC
#define AIO5_DDR		DDRC
#define AIO5_PWM		NULL

#define AIO6_PIN		PINC6
#define AIO6_RPORT	PINC
#define AIO6_WPORT	PORTC
#define AIO6_DDR		DDRC
#define AIO6_PWM		NULL

#define AIO7_PIN		PINC7
#define AIO7_RPORT	PINC
#define AIO7_WPORT	PORTC
#define AIO7_DDR		DDRC
#define AIO7_PWM		NULL



#undef PB0
#define PB0_PIN			PINB0
#define PB0_RPORT		PINB
#define PB0_WPORT		PORTB
#define PB0_DDR			DDRB
#define PB0_PWM			NULL

#undef PB1
#define PB1_PIN			PINB1
#define PB1_RPORT		PINB
#define PB1_WPORT		PORTB
#define PB1_DDR			DDRB
#define PB1_PWM			NULL

#undef PB2
#define PB2_PIN			PINB2
#define PB2_RPORT		PINB
#define PB2_WPORT		PORTB
#define PB2_DDR			DDRB
#define PB2_PWM			NULL

#undef PB3
#define PB3_PIN			PINB3
#define PB3_RPORT		PINB
#define PB3_WPORT		PORTB
#define PB3_DDR			DDRB
#define PB3_PWM			&OCR2A

#undef PB4
#define PB4_PIN			PINB4
#define PB4_RPORT		PINB
#define PB4_WPORT		PORTB
#define PB4_DDR			DDRB
#define PB4_PWM			NULL

#undef PB5
#define PB5_PIN			PINB5
#define PB5_RPORT		PINB
#define PB5_WPORT		PORTB
#define PB5_DDR			DDRB
#define PB5_PWM			NULL

#undef PB6
#define PB6_PIN			PINB6
#define PB6_RPORT		PINB
#define PB6_WPORT		PORTB
#define PB6_DDR			DDRB
#define PB6_PWM			NULL

#undef PB7
#define PB7_PIN			PINB7
#define PB7_RPORT		PINB
#define PB7_WPORT		PORTB
#define PB7_DDR			DDRB
#define PB7_PWM			NULL


#undef PC0
#define PC0_PIN			PINC0
#define PC0_RPORT		PINC
#define PC0_WPORT		PORTC
#define PC0_DDR			DDRC
#define PC0_PWM			NULL

#undef PC1
#define PC1_PIN			PINC1
#define PC1_RPORT		PINC
#define PC1_WPORT		PORTC
#define PC1_DDR			DDRC
#define PC1_PWM			NULL

#undef PC2
#define PC2_PIN			PINC2
#define PC2_RPORT		PINC
#define PC2_WPORT		PORTC
#define PC2_DDR			DDRC
#define PC2_PWM			NULL

#undef PC3
#define PC3_PIN			PINC3
#define PC3_RPORT		PINC
#define PC3_WPORT		PORTC
#define PC3_DDR			DDRC
#define PC3_PWM			NULL

#undef PC4
#define PC4_PIN			PINC4
#define PC4_RPORT		PINC
#define PC4_WPORT		PORTC
#define PC4_DDR			DDRC
#define PC4_PWM			NULL

#undef PC5
#define PC5_PIN			PINC5
#define PC5_RPORT		PINC
#define PC5_WPORT		PORTC
#define PC5_DDR			DDRC
#define PC5_PWM			NULL

#undef PC6
#define PC6_PIN			PINC6
#define PC6_RPORT		PINC
#define PC6_WPORT		PORTC
#define PC6_DDR			DDRC
#define PC6_PWM			NULL

#undef PC7
#define PC7_PIN			PINC7
#define PC7_RPORT		PINC
#define PC7_WPORT		PORTC
#define PC7_DDR			DDRC
#define PC7_PWM			NULL


#undef PD0
#define PD0_PIN			PIND0
#define PD0_RPORT		PIND
#define PD0_WPORT		PORTD
#define PD0_DDR			DDRD
#define PD0_PWM			NULL

#undef PD1
#define PD1_PIN			PIND1
#define PD1_RPORT		PIND
#define PD1_WPORT		PORTD
#define PD1_DDR			DDRD
#define PD1_PWM			NULL

#undef PD2
#define PD2_PIN			PIND2
#define PD2_RPORT		PIND
#define PD2_WPORT		PORTD
#define PD2_DDR			DDRD
#define PD2_PWM			NULL

#undef PD3
#define PD3_PIN			PIND3
#define PD3_RPORT		PIND
#define PD3_WPORT		PORTD
#define PD3_DDR			DDRD
#define PD3_PWM			&OCR2B

#undef PD4
#define PD4_PIN			PIND4
#define PD4_RPORT		PIND
#define PD4_WPORT		PORTD
#define PD4_DDR			DDRD
#define PD4_PWM			NULL

#undef PD5
#define PD5_PIN			PIND5
#define PD5_RPORT		PIND
#define PD5_WPORT		PORTD
#define PD5_DDR			DDRD
#define PD5_PWM			&OCR0B

#undef PD6
#define PD6_PIN			PIND6
#define PD6_RPORT		PIND
#define PD6_WPORT		PORTD
#define PD6_DDR			DDRD
#define PD6_PWM			&OCR0A

#undef PD7
#define PD7_PIN			PIND7
#define PD7_RPORT		PIND
#define PD7_WPORT		PORTD
#define PD7_DDR			DDRD
#define PD7_PWM			NULL
#endif	/*	_AVR_ATmega{168,328,328P}__ */

#if defined (__AVR_ATmega644__) || defined (__AVR_ATmega644P__) || defined (__AVR_ATmega644PA__)
// UART
#define	RXD					DIO8
#define	TXD					DIO9
#define	RXD0				DIO8
#define	TXD0				DIO9

#define	RXD1				DIO10
#define	TXD1				DIO11

// SPI
#define	SCK					DIO7
#define	MISO				DIO6
#define	MOSI				DIO5
#define	SS					DIO4

// TWI (I2C)
#define	SCL					DIO16
#define	SDA					DIO17

// timers and PWM
#define	OC0A				DIO3
#define	OC0B				DIO4
#define	OC1A				DIO13
#define	OC1B				DIO12
#define	OC2A				DIO15
#define	OC2B				DIO14

#define	DEBUG_LED		DIO0
/*
pins
*/

#define DIO0_PIN		PINB0
#define DIO0_RPORT	PINB
#define DIO0_WPORT	PORTB
#define DIO0_DDR		DDRB
#define DIO0_PWM		NULL

#define DIO1_PIN		PINB1
#define DIO1_RPORT	PINB
#define DIO1_WPORT	PORTB
#define DIO1_DDR		DDRB
#define DIO1_PWM		NULL

#define DIO2_PIN		PINB2
#define DIO2_RPORT	PINB
#define DIO2_WPORT	PORTB
#define DIO2_DDR		DDRB
#define DIO2_PWM		NULL

#define DIO3_PIN		PINB3
#define DIO3_RPORT	PINB
#define DIO3_WPORT	PORTB
#define DIO3_DDR		DDRB
#define DIO3_PWM		&OCR0A

#define DIO4_PIN		PINB4
#define DIO4_RPORT	PINB
#define DIO4_WPORT	PORTB
#define DIO4_DDR		DDRB
#define DIO4_PWM		&OCR0B

#define DIO5_PIN		PINB5
#define DIO5_RPORT	PINB
#define DIO5_WPORT	PORTB
#define DIO5_DDR		DDRB
#define DIO5_PWM		NULL

#define DIO6_PIN		PINB6
#define DIO6_RPORT	PINB
#define DIO6_WPORT	PORTB
#define DIO6_DDR		DDRB
#define DIO6_PWM		NULL

#define DIO7_PIN		PINB7
#define DIO7_RPORT	PINB
#define DIO7_WPORT	PORTB
#define DIO7_DDR		DDRB
#define DIO7_PWM		NULL

#define DIO8_PIN		PIND0
#define DIO8_RPORT	PIND
#define DIO8_WPORT	PORTD
#define DIO8_DDR		DDRD
#define DIO8_PWM		NULL

#define DIO9_PIN		PIND1
#define DIO9_RPORT	PIND
#define DIO9_WPORT	PORTD
#define DIO9_DDR		DDRD
#define DIO9_PWM		NULL

#define DIO10_PIN		PIND2
#define DIO10_RPORT	PIND
#define DIO10_WPORT	PORTD
#define DIO10_DDR		DDRD
#define DIO10_PWM		NULL

#define DIO11_PIN		PIND3
#define DIO11_RPORT	PIND
#define DIO11_WPORT	PORTD
#define DIO11_DDR		DDRD
#define DIO11_PWM		NULL

#define DIO12_PIN		PIND4
#define DIO12_RPORT	PIND
#define DIO12_WPORT	PORTD
#define DIO12_DDR		DDRD
#define DIO12_PWM		NULL

#define DIO13_PIN		PIND5
#define DIO13_RPORT	PIND
#define DIO13_WPORT	PORTD
#define DIO13_DDR		DDRD
#define DIO13_PWM		NULL

#define DIO14_PIN		PIND6
#define DIO14_RPORT	PIND
#define DIO14_WPORT	PORTD
#define DIO14_DDR		DDRD
#define DIO14_PWM		&OCR2B

#define DIO15_PIN		PIND7
#define DIO15_RPORT	PIND
#define DIO15_WPORT	PORTD
#define DIO15_DDR		DDRD
#define DIO15_PWM		&OCR2A

#define DIO16_PIN		PINC0
#define DIO16_RPORT	PINC
#define DIO16_WPORT	PORTC
#define DIO16_DDR		DDRC
#define DIO16_PWM		NULL

#define DIO17_PIN		PINC1
#define DIO17_RPORT	PINC
#define DIO17_WPORT	PORTC
#define DIO17_DDR		DDRC
#define DIO17_PWM		NULL

#define DIO18_PIN		PINC2
#define DIO18_RPORT	PINC
#define DIO18_WPORT	PORTC
#define DIO18_DDR		DDRC
#define DIO18_PWM		NULL

#define DIO19_PIN		PINC3
#define DIO19_RPORT	PINC
#define DIO19_WPORT	PORTC
#define DIO19_DDR		DDRC
#define DIO19_PWM		NULL

#define DIO20_PIN		PINC4
#define DIO20_RPORT	PINC
#define DIO20_WPORT	PORTC
#define DIO20_DDR		DDRC
#define DIO20_PWM		NULL

#define DIO21_PIN		PINC5
#define DIO21_RPORT	PINC
#define DIO21_WPORT	PORTC
#define DIO21_DDR		DDRC
#define DIO21_PWM		NULL

#define DIO22_PIN		PINC6
#define DIO22_RPORT	PINC
#define DIO22_WPORT	PORTC
#define DIO22_DDR		DDRC
#define DIO22_PWM		NULL

#define DIO23_PIN		PINC7
#define DIO23_RPORT	PINC
#define DIO23_WPORT	PORTC
#define DIO23_DDR		DDRC
#define DIO23_PWM		NULL

#define DIO24_PIN		PINA7
#define DIO24_RPORT	PINA
#define DIO24_WPORT	PORTA
#define DIO24_DDR		DDRA
#define DIO24_PWM		NULL

#define DIO25_PIN		PINA6
#define DIO25_RPORT	PINA
#define DIO25_WPORT	PORTA
#define DIO25_DDR		DDRA
#define DIO25_PWM		NULL

#define DIO26_PIN		PINA5
#define DIO26_RPORT	PINA
#define DIO26_WPORT	PORTA
#define DIO26_DDR		DDRA
#define DIO26_PWM		NULL

#define DIO27_PIN		PINA4
#define DIO27_RPORT	PINA
#define DIO27_WPORT	PORTA
#define DIO27_DDR		DDRA
#define DIO27_PWM		NULL

#define DIO28_PIN		PINA3
#define DIO28_RPORT	PINA
#define DIO28_WPORT	PORTA
#define DIO28_DDR		DDRA
#define DIO28_PWM		NULL

#define DIO29_PIN		PINA2
#define DIO29_RPORT	PINA
#define DIO29_WPORT	PORTA
#define DIO29_DDR		DDRA
#define DIO29_PWM		NULL

#define DIO30_PIN		PINA1
#define DIO30_RPORT	PINA
#define DIO30_WPORT	PORTA
#define DIO30_DDR		DDRA
#define DIO30_PWM		NULL

#define DIO31_PIN		PINA0
#define DIO31_RPORT	PINA
#define DIO31_WPORT	PORTA
#define DIO31_DDR		DDRA
#define DIO31_PWM		NULL

#define AIO0_PIN		PINA0
#define AIO0_RPORT	PINA
#define AIO0_WPORT	PORTA
#define AIO0_DDR		DDRA
#define AIO0_PWM		NULL

#define AIO1_PIN		PINA1
#define AIO1_RPORT	PINA
#define AIO1_WPORT	PORTA
#define AIO1_DDR		DDRA
#define AIO1_PWM		NULL

#define AIO2_PIN		PINA2
#define AIO2_RPORT	PINA
#define AIO2_WPORT	PORTA
#define AIO2_DDR		DDRA
#define AIO2_PWM		NULL

#define AIO3_PIN		PINA3
#define AIO3_RPORT	PINA
#define AIO3_WPORT	PORTA
#define AIO3_DDR		DDRA
#define AIO3_PWM		NULL

#define AIO4_PIN		PINA4
#define AIO4_RPORT	PINA
#define AIO4_WPORT	PORTA
#define AIO4_DDR		DDRA
#define AIO4_PWM		NULL

#define AIO5_PIN		PINA5
#define AIO5_RPORT	PINA
#define AIO5_WPORT	PORTA
#define AIO5_DDR		DDRA
#define AIO5_PWM		NULL

#define AIO6_PIN		PINA6
#define AIO6_RPORT	PINA
#define AIO6_WPORT	PORTA
#define AIO6_DDR		DDRA
#define AIO6_PWM		NULL

#define AIO7_PIN		PINA7
#define AIO7_RPORT	PINA
#define AIO7_WPORT	PORTA
#define AIO7_DDR		DDRA
#define AIO7_PWM		NULL



#undef PA0
#define PA0_PIN			PINA0
#define PA0_RPORT		PINA
#define PA0_WPORT		PORTA
#define PA0_DDR			DDRA
#define PA0_PWM			NULL

#undef PA1
#define PA1_PIN			PINA1
#define PA1_RPORT		PINA
#define PA1_WPORT		PORTA
#define PA1_DDR			DDRA
#define PA1_PWM			NULL

#undef PA2
#define PA2_PIN			PINA2
#define PA2_RPORT		PINA
#define PA2_WPORT		PORTA
#define PA2_DDR			DDRA
#define PA2_PWM			NULL

#undef PA3
#define PA3_PIN			PINA3
#define PA3_RPORT		PINA
#define PA3_WPORT		PORTA
#define PA3_DDR			DDRA
#define PA3_PWM			NULL

#undef PA4
#define PA4_PIN			PINA4
#define PA4_RPORT		PINA
#define PA4_WPORT		PORTA
#define PA4_DDR			DDRA
#define PA4_PWM			NULL

#undef PA5
#define PA5_PIN			PINA5
#define PA5_RPORT		PINA
#define PA5_WPORT		PORTA
#define PA5_DDR			DDRA
#define PA5_PWM			NULL

#undef PA6
#define PA6_PIN			PINA6
#define PA6_RPORT		PINA
#define PA6_WPORT		PORTA
#define PA6_DDR			DDRA
#define PA6_PWM			NULL

#undef PA7
#define PA7_PIN			PINA7
#define PA7_RPORT		PINA
#define PA7_WPORT		PORTA
#define PA7_DDR			DDRA
#define PA7_PWM			NULL


#undef PB0
#define PB0_PIN			PINB0
#define PB0_RPORT		PINB
#define PB0_WPORT		PORTB
#define PB0_DDR			DDRB
#define PB0_PWM			NULL

#undef PB1
#define PB1_PIN			PINB1
#define PB1_RPORT		PINB
#define PB1_WPORT		PORTB
#define PB1_DDR			DDRB
#define PB1_PWM			NULL

#undef PB2
#define PB2_PIN			PINB2
#define PB2_RPORT		PINB
#define PB2_WPORT		PORTB
#define PB2_DDR			DDRB
#define PB2_PWM			NULL

#undef PB3
#define PB3_PIN			PINB3
#define PB3_RPORT		PINB
#define PB3_WPORT		PORTB
#define PB3_DDR			DDRB
#define PB3_PWM			&OCR0A

#undef PB4
#define PB4_PIN			PINB4
#define PB4_RPORT		PINB
#define PB4_WPORT		PORTB
#define PB4_DDR			DDRB
#define PB4_PWM			&OCR0B

#undef PB5
#define PB5_PIN			PINB5
#define PB5_RPORT		PINB
#define PB5_WPORT		PORTB
#define PB5_DDR			DDRB
#define PB5_PWM			NULL

#undef PB6
#define PB6_PIN			PINB6
#define PB6_RPORT		PINB
#define PB6_WPORT		PORTB
#define PB6_DDR			DDRB
#define PB6_PWM			NULL

#undef PB7
#define PB7_PIN			PINB7
#define PB7_RPORT		PINB
#define PB7_WPORT		PORTB
#define PB7_DDR			DDRB
#define PB7_PWM			NULL


#undef PC0
#define PC0_PIN			PINC0
#define PC0_RPORT		PINC
#define PC0_WPORT		PORTC
#define PC0_DDR			DDRC
#define PC0_PWM			NULL

#undef PC1
#define PC1_PIN			PINC1
#define PC1_RPORT		PINC
#define PC1_WPORT		PORTC
#define PC1_DDR			DDRC
#define PC1_PWM			NULL

#undef PC2
#define PC2_PIN			PINC2
#define PC2_RPORT		PINC
#define PC2_WPORT		PORTC
#define PC2_DDR			DDRC
#define PC2_PWM			NULL

#undef PC3
#define PC3_PIN			PINC3
#define PC3_RPORT		PINC
#define PC3_WPORT		PORTC
#define PC3_DDR			DDRC
#define PC3_PWM			NULL

#undef PC4
#define PC4_PIN			PINC4
#define PC4_RPORT		PINC
#define PC4_WPORT		PORTC
#define PC4_DDR			DDRC
#define PC4_PWM			NULL

#undef PC5
#define PC5_PIN			PINC5
#define PC5_RPORT		PINC
#define PC5_WPORT		PORTC
#define PC5_DDR			DDRC
#define PC5_PWM			NULL

#undef PC6
#define PC6_PIN			PINC6
#define PC6_RPORT		PINC
#define PC6_WPORT		PORTC
#define PC6_DDR			DDRC
#define PC6_PWM			NULL

#undef PC7
#define PC7_PIN			PINC7
#define PC7_RPORT		PINC
#define PC7_WPORT		PORTC
#define PC7_DDR			DDRC
#define PC7_PWM			NULL


#undef PD0
#define PD0_PIN			PIND0
#define PD0_RPORT		PIND
#define PD0_WPORT		PORTD
#define PD0_DDR			DDRD
#define PD0_PWM			NULL

#undef PD1
#define PD1_PIN			PIND1
#define PD1_RPORT		PIND
#define PD1_WPORT		PORTD
#define PD1_DDR			DDRD
#define PD1_PWM			NULL

#undef PD2
#define PD2_PIN			PIND2
#define PD2_RPORT		PIND
#define PD2_WPORT		PORTD
#define PD2_DDR			DDRD
#define PD2_PWM			NULL

#undef PD3
#define PD3_PIN			PIND3
#define PD3_RPORT		PIND
#define PD3_WPORT		PORTD
#define PD3_DDR			DDRD
#define PD3_PWM			NULL

#undef PD4
#define PD4_PIN			PIND4
#define PD4_RPORT		PIND
#define PD4_WPORT		PORTD
#define PD4_DDR			DDRD
#define PD4_PWM			NULL

#undef PD5
#define PD5_PIN			PIND5
#define PD5_RPORT		PIND
#define PD5_WPORT		PORTD
#define PD5_DDR			DDRD
#define PD5_PWM			NULL

#undef PD6
#define PD6_PIN			PIND6
#define PD6_RPORT		PIND
#define PD6_WPORT		PORTD
#define PD6_DDR			DDRD
#define PD6_PWM			&OCR2B

#undef PD7
#define PD7_PIN			PIND7
#define PD7_RPORT		PIND
#define PD7_WPORT		PORTD
#define PD7_DDR			DDRD
#define PD7_PWM			&OCR2A
#endif	/*	_AVR_ATmega{644,644P,644PA}__ */

#if defined (__AVR_ATmega1280__) || defined (__AVR_ATmega2560__)
// UART
#define	RXD					DIO0
#define	TXD					DIO1

// SPI
#define	SCK					DIO52
#define	MISO				DIO50
#define	MOSI				DIO51
#define	SS					DIO53

// TWI (I2C)
#define	SCL					DIO21
#define	SDA					DIO20

// timers and PWM
#define	OC0A				DIO13
#define	OC0B				DIO4
#define	OC1A				DIO11
#define	OC1B				DIO12
#define	OC2A				DIO10
#define	OC2B				DIO9
#define	OC3A				DIO5
#define	OC3B				DIO2
#define	OC3C				DIO3
#define	OC4A				DIO6
#define	OC4B				DIO7
#define	OC4C				DIO8
#define	OC5A				DIO46
#define	OC5B				DIO45
#define	OC5C				DIO44

// change for your board
#define	DEBUG_LED		DIO21

/*
pins
*/
#define	DIO0_PIN		PINE0
#define	DIO0_RPORT	PINE
#define	DIO0_WPORT	PORTE
#define	DIO0_DDR		DDRE
#define DIO0_PWM		NULL

#define	DIO1_PIN		PINE1
#define	DIO1_RPORT	PINE
#define	DIO1_WPORT	PORTE
#define	DIO1_DDR		DDRE
#define DIO1_PWM		NULL

#define	DIO2_PIN		PINE4
#define	DIO2_RPORT	PINE
#define	DIO2_WPORT	PORTE
#define	DIO2_DDR		DDRE
#define DIO2_PWM		&OCR3BL

#define	DIO3_PIN		PINE5
#define	DIO3_RPORT	PINE
#define	DIO3_WPORT	PORTE
#define	DIO3_DDR		DDRE
#define DIO3_PWM		&OCR3CL

#define	DIO4_PIN		PING5
#define	DIO4_RPORT	PING
#define	DIO4_WPORT	PORTG
#define	DIO4_DDR		DDRG
#define DIO4_PWM		&OCR0B

#define	DIO5_PIN		PINE3
#define	DIO5_RPORT	PINE
#define	DIO5_WPORT	PORTE
#define	DIO5_DDR		DDRE
#define DIO5_PWM		&OCR3AL

#define	DIO6_PIN		PINH3
#define	DIO6_RPORT	PINH
#define	DIO6_WPORT	PORTH
#define	DIO6_DDR		DDRH
#define DIO6_PWM		&OCR4AL

#define	DIO7_PIN		PINH4
#define	DIO7_RPORT	PINH
#define	DIO7_WPORT	PORTH
#define	DIO7_DDR		DDRH
#define DIO7_PWM		&OCR4BL

#define	DIO8_PIN		PINH5
#define	DIO8_RPORT	PINH
#define	DIO8_WPORT	PORTH
#define	DIO8_DDR		DDRH
#define DIO8_PWM		&OCR4CL

#define	DIO9_PIN		PINH6
#define	DIO9_RPORT	PINH
#define	DIO9_WPORT	PORTH
#define	DIO9_DDR		DDRH
#define DIO9_PWM		&OCR2B

#define	DIO10_PIN		PINB4
#define	DIO10_RPORT	PINB
#define	DIO10_WPORT	PORTB
#define	DIO10_DDR		DDRB
#define DIO10_PWM		&OCR2A

#define	DIO11_PIN		PINB5
#define	DIO11_RPORT	PINB
#define	DIO11_WPORT	PORTB
#define	DIO11_DDR		DDRB
#define DIO11_PWM		NULL

#define	DIO12_PIN		PINB6
#define	DIO12_RPORT	PINB
#define	DIO12_WPORT	PORTB
#define	DIO12_DDR		DDRB
#define DIO12_PWM		NULL

#define	DIO13_PIN		PINB7
#define	DIO13_RPORT	PINB
#define	DIO13_WPORT	PORTB
#define	DIO13_DDR		DDRB
#define DIO13_PWM		&OCR0A

#define	DIO14_PIN		PINJ1
#define	DIO14_RPORT	PINJ
#define	DIO14_WPORT	PORTJ
#define	DIO14_DDR		DDRJ
#define DIO14_PWM		NULL

#define	DIO15_PIN		PINJ0
#define	DIO15_RPORT	PINJ
#define	DIO15_WPORT	PORTJ
#define	DIO15_DDR		DDRJ
#define DIO15_PWM		NULL

#define	DIO16_PIN		PINH1
#define	DIO16_RPORT	PINH
#define	DIO16_WPORT	PORTH
#define	DIO16_DDR		DDRH
#define DIO16_PWM		NULL

#define	DIO17_PIN		PINH0
#define	DIO17_RPORT	PINH
#define	DIO17_WPORT	PORTH
#define	DIO17_DDR		DDRH
#define DIO17_PWM		NULL

#define	DIO18_PIN		PIND3
#define	DIO18_RPORT	PIND
#define	DIO18_WPORT	PORTD
#define	DIO18_DDR		DDRD
#define DIO18_PWM		NULL

#define	DIO19_PIN		PIND2
#define	DIO19_RPORT	PIND
#define	DIO19_WPORT	PORTD
#define	DIO19_DDR		DDRD
#define DIO19_PWM		NULL

#define	DIO20_PIN		PIND1
#define	DIO20_RPORT	PIND
#define	DIO20_WPORT	PORTD
#define	DIO20_DDR		DDRD
#define DIO20_PWM		NULL

#define	DIO21_PIN		PIND0
#define	DIO21_RPORT	PIND
#define	DIO21_WPORT	PORTD
#define	DIO21_DDR		DDRD
#define DIO21_PWM		NULL

#define	DIO22_PIN		PINA0
#define	DIO22_RPORT	PINA
#define	DIO22_WPORT	PORTA
#define	DIO22_DDR		DDRA
#define DIO22_PWM		NULL

#define	DIO23_PIN		PINA1
#define	DIO23_RPORT	PINA
#define	DIO23_WPORT	PORTA
#define	DIO23_DDR		DDRA
#define DIO23_PWM		NULL

#define	DIO24_PIN		PINA2
#define	DIO24_RPORT	PINA
#define	DIO24_WPORT	PORTA
#define	DIO24_DDR		DDRA
#define DIO24_PWM		NULL

#define	DIO25_PIN		PINA3
#define	DIO25_RPORT	PINA
#define	DIO25_WPORT	PORTA
#define	DIO25_DDR		DDRA
#define DIO25_PWM		NULL

#define	DIO26_PIN		PINA4
#define	DIO26_RPORT	PINA
#define	DIO26_WPORT	PORTA
#define	DIO26_DDR		DDRA
#define DIO26_PWM		NULL

#define	DIO27_PIN		PINA5
#define	DIO27_RPORT	PINA
#define	DIO27_WPORT	PORTA
#define	DIO27_DDR		DDRA
#define DIO27_PWM		NULL

#define	DIO28_PIN		PINA6
#define	DIO28_RPORT	PINA
#define	DIO28_WPORT	PORTA
#define	DIO28_DDR		DDRA
#define DIO28_PWM		NULL

#define	DIO29_PIN		PINA7
#define	DIO29_RPORT	PINA
#define	DIO29_WPORT	PORTA
#define	DIO29_DDR		DDRA
#define DIO29_PWM		NULL

#define	DIO30_PIN		PINC7
#define	DIO30_RPORT	PINC
#define	DIO30_WPORT	PORTC
#define	DIO30_DDR		DDRC
#define DIO30_PWM		NULL

#define	DIO31_PIN		PINC6
#define	DIO31_RPORT	PINC
#define	DIO31_WPORT	PORTC
#define	DIO31_DDR		DDRC
#define DIO31_PWM		NULL

#define	DIO32_PIN		PINC5
#define	DIO32_RPORT	PINC
#define	DIO32_WPORT	PORTC
#define	DIO32_DDR		DDRC
#define DIO32_PWM		NULL

#define	DIO33_PIN		PINC4
#define	DIO33_RPORT	PINC
#define	DIO33_WPORT	PORTC
#define	DIO33_DDR		DDRC
#define DIO33_PWM		NULL

#define	DIO34_PIN		PINC3
#define	DIO34_RPORT	PINC
#define	DIO34_WPORT	PORTC
#define	DIO34_DDR		DDRC
#define DIO34_PWM		NULL

#define	DIO35_PIN		PINC2
#define	DIO35_RPORT	PINC
#define	DIO35_WPORT	PORTC
#define	DIO35_DDR		DDRC
#define DIO35_PWM		NULL

#define	DIO36_PIN		PINC1
#define	DIO36_RPORT	PINC
#define	DIO36_WPORT	PORTC
#define	DIO36_DDR		DDRC
#define DIO36_PWM		NULL

#define	DIO37_PIN		PINC0
#define	DIO37_RPORT	PINC
#define	DIO37_WPORT	PORTC
#define	DIO37_DDR		DDRC
#define DIO37_PWM		NULL

#define	DIO38_PIN		PIND7
#define	DIO38_RPORT	PIND
#define	DIO38_WPORT	PORTD
#define	DIO38_DDR		DDRD
#define DIO38_PWM		NULL

#define	DIO39_PIN		PING2
#define	DIO39_RPORT	PING
#define	DIO39_WPORT	PORTG
#define	DIO39_DDR		DDRG
#define DIO39_PWM		NULL

#define	DIO40_PIN		PING1
#define	DIO40_RPORT	PING
#define	DIO40_WPORT	PORTG
#define	DIO40_DDR		DDRG
#define DIO40_PWM		NULL

#define	DIO41_PIN		PING0
#define	DIO41_RPORT	PING
#define	DIO41_WPORT	PORTG
#define	DIO41_DDR		DDRG
#define DIO41_PWM		NULL

#define	DIO42_PIN		PINL7
#define	DIO42_RPORT	PINL
#define	DIO42_WPORT	PORTL
#define	DIO42_DDR		DDRL
#define DIO42_PWM		NULL

#define	DIO43_PIN		PINL6
#define	DIO43_RPORT	PINL
#define	DIO43_WPORT	PORTL
#define	DIO43_DDR		DDRL
#define DIO43_PWM		NULL

#define	DIO44_PIN		PINL5
#define	DIO44_RPORT	PINL
#define	DIO44_WPORT	PORTL
#define	DIO44_DDR		DDRL
#define DIO44_PWM		&OCR5CL

#define	DIO45_PIN		PINL4
#define	DIO45_RPORT	PINL
#define	DIO45_WPORT	PORTL
#define	DIO45_DDR		DDRL
#define DIO45_PWM		&OCR5BL

#define	DIO46_PIN		PINL3
#define	DIO46_RPORT	PINL
#define	DIO46_WPORT	PORTL
#define	DIO46_DDR		DDRL
#define DIO46_PWM		&OCR5AL

#define	DIO47_PIN		PINL2
#define	DIO47_RPORT	PINL
#define	DIO47_WPORT	PORTL
#define	DIO47_DDR		DDRL
#define DIO47_PWM		NULL

#define	DIO48_PIN		PINL1
#define	DIO48_RPORT	PINL
#define	DIO48_WPORT	PORTL
#define	DIO48_DDR		DDRL
#define DIO48_PWM		NULL

#define	DIO49_PIN		PINL0
#define	DIO49_RPORT	PINL
#define	DIO49_WPORT	PORTL
#define	DIO49_DDR		DDRL
#define DIO49_PWM		NULL

#define	DIO50_PIN		PINB3
#define	DIO50_RPORT	PINB
#define	DIO50_WPORT	PORTB
#define	DIO50_DDR		DDRB
#define DIO50_PWM		NULL

#define	DIO51_PIN		PINB2
#define	DIO51_RPORT	PINB
#define	DIO51_WPORT	PORTB
#define	DIO51_DDR		DDRB
#define DIO51_PWM		NULL

#define	DIO52_PIN		PINB1
#define	DIO52_RPORT	PINB
#define	DIO52_WPORT	PORTB
#define	DIO52_DDR		DDRB
#define DIO52_PWM		NULL

#define	DIO53_PIN		PINB0
#define	DIO53_RPORT	PINB
#define	DIO53_WPORT	PORTB
#define	DIO53_DDR		DDRB
#define DIO53_PWM		NULL

#define AIO0_PIN		PINF0
#define AIO0_RPORT	PINF
#define AIO0_WPORT	PORTF
#define AIO0_DDR		DDRF
#define AIO0_PWM		NULL

#define AIO1_PIN		PINF1
#define AIO1_RPORT	PINF
#define AIO1_WPORT	PORTF
#define AIO1_DDR		DDRF
#define AIO1_PWM		NULL

#define AIO2_PIN		PINF2
#define AIO2_RPORT	PINF
#define AIO2_WPORT	PORTF
#define AIO2_DDR		DDRF
#define AIO2_PWM		NULL

#define AIO3_PIN		PINF3
#define AIO3_RPORT	PINF
#define AIO3_WPORT	PORTF
#define AIO3_DDR		DDRF
#define AIO3_PWM		NULL

#define AIO4_PIN		PINF4
#define AIO4_RPORT	PINF
#define AIO4_WPORT	PORTF
#define AIO4_DDR		DDRF
#define AIO4_PWM		NULL

#define AIO5_PIN		PINF5
#define AIO5_RPORT	PINF
#define AIO5_WPORT	PORTF
#define AIO5_DDR		DDRF
#define AIO5_PWM		NULL

#define AIO6_PIN		PINF6
#define AIO6_RPORT	PINF
#define AIO6_WPORT	PORTF
#define AIO6_DDR		DDRF
#define AIO6_PWM		NULL

#define AIO7_PIN		PINF7
#define AIO7_RPORT	PINF
#define AIO7_WPORT	PORTF
#define AIO7_DDR		DDRF
#define AIO7_PWM		NULL

#define AIO8_PIN		PINK0
#define AIO8_RPORT	PINK
#define AIO8_WPORT	PORTK
#define AIO8_DDR		DDRK
#define AIO8_PWM		NULL

#define AIO9_PIN		PINK1
#define AIO9_RPORT	PINK
#define AIO9_WPORT	PORTK
#define AIO9_DDR		DDRK
#define AIO9_PWM		NULL

#define AIO10_PIN		PINK2
#define AIO10_RPORT	PINK
#define AIO10_WPORT	PORTK
#define AIO10_DDR		DDRK
#define AIO10_PWM		NULL

#define AIO11_PIN		PINK3
#define AIO11_RPORT	PINK
#define AIO11_WPORT	PORTK
#define AIO11_DDR		DDRK
#define AIO11_PWM		NULL

#define AIO12_PIN		PINK4
#define AIO12_RPORT	PINK
#define AIO12_WPORT	PORTK
#define AIO12_DDR		DDRK
#define AIO12_PWM		NULL

#define AIO13_PIN		PINK5
#define AIO13_RPORT	PINK
#define AIO13_WPORT	PORTK
#define AIO13_DDR		DDRK
#define AIO13_PWM		NULL

#define AIO14_PIN		PINK6
#define AIO14_RPORT	PINK
#define AIO14_WPORT	PORTK
#define AIO14_DDR		DDRK
#define AIO14_PWM		NULL

#define AIO15_PIN		PINK7
#define AIO15_RPORT	PINK
#define AIO15_WPORT	PORTK
#define AIO15_DDR		DDRK
#define AIO15_PWM		NULL



#undef PA0
#define PA0_PIN			PINA0
#define PA0_RPORT		PINA
#define PA0_WPORT		PORTA
#define PA0_DDR			DDRA
#define PA0_PWM			NULL
#undef PA1
#define PA1_PIN			PINA1
#define PA1_RPORT		PINA
#define PA1_WPORT		PORTA
#define PA1_DDR			DDRA
#define PA1_PWM			NULL
#undef PA2
#define PA2_PIN			PINA2
#define PA2_RPORT		PINA
#define PA2_WPORT		PORTA
#define PA2_DDR			DDRA
#define PA2_PWM			NULL
#undef PA3
#define PA3_PIN			PINA3
#define PA3_RPORT		PINA
#define PA3_WPORT		PORTA
#define PA3_DDR			DDRA
#define PA3_PWM			NULL
#undef PA4
#define PA4_PIN			PINA4
#define PA4_RPORT		PINA
#define PA4_WPORT		PORTA
#define PA4_DDR			DDRA
#define PA4_PWM			NULL
#undef PA5
#define PA5_PIN			PINA5
#define PA5_RPORT		PINA
#define PA5_WPORT		PORTA
#define PA5_DDR			DDRA
#define PA5_PWM			NULL
#undef PA6
#define PA6_PIN			PINA6
#define PA6_RPORT		PINA
#define PA6_WPORT		PORTA
#define PA6_DDR			DDRA
#define PA6_PWM			NULL
#undef PA7
#define PA7_PIN			PINA7
#define PA7_RPORT		PINA
#define PA7_WPORT		PORTA
#define PA7_DDR			DDRA
#define PA7_PWM			NULL

#undef PB0
#define PB0_PIN			PINB0
#define PB0_RPORT		PINB
#define PB0_WPORT		PORTB
#define PB0_DDR			DDRB
#define PB0_PWM			NULL
#undef PB1
#define PB1_PIN			PINB1
#define PB1_RPORT		PINB
#define PB1_WPORT		PORTB
#define PB1_DDR			DDRB
#define PB1_PWM			NULL
#undef PB2
#define PB2_PIN			PINB2
#define PB2_RPORT		PINB
#define PB2_WPORT		PORTB
#define PB2_DDR			DDRB
#define PB2_PWM			NULL
#undef PB3
#define PB3_PIN			PINB3
#define PB3_RPORT		PINB
#define PB3_WPORT		PORTB
#define PB3_DDR			DDRB
#define PB3_PWM			NULL
#undef PB4
#define PB4_PIN			PINB4
#define PB4_RPORT		PINB
#define PB4_WPORT		PORTB
#define PB4_DDR			DDRB
#define PB4_PWM			&OCR2A
#undef PB5
#define PB5_PIN			PINB5
#define PB5_RPORT		PINB
#define PB5_WPORT		PORTB
#define PB5_DDR			DDRB
#define PB5_PWM			NULL
#undef PB6
#define PB6_PIN			PINB6
#define PB6_RPORT		PINB
#define PB6_WPORT		PORTB
#define PB6_DDR			DDRB
#define PB6_PWM			NULL
#undef PB7
#define PB7_PIN			PINB7
#define PB7_RPORT		PINB
#define PB7_WPORT		PORTB
#define PB7_DDR			DDRB
#define PB7_PWM			&OCR0A

#undef PC0
#define PC0_PIN			PINC0
#define PC0_RPORT		PINC
#define PC0_WPORT		PORTC
#define PC0_DDR			DDRC
#define PC0_PWM			NULL
#undef PC1
#define PC1_PIN			PINC1
#define PC1_RPORT		PINC
#define PC1_WPORT		PORTC
#define PC1_DDR			DDRC
#define PC1_PWM			NULL
#undef PC2
#define PC2_PIN			PINC2
#define PC2_RPORT		PINC
#define PC2_WPORT		PORTC
#define PC2_DDR			DDRC
#define PC2_PWM			NULL
#undef PC3
#define PC3_PIN			PINC3
#define PC3_RPORT		PINC
#define PC3_WPORT		PORTC
#define PC3_DDR			DDRC
#define PC3_PWM			NULL
#undef PC4
#define PC4_PIN			PINC4
#define PC4_RPORT		PINC
#define PC4_WPORT		PORTC
#define PC4_DDR			DDRC
#define PC4_PWM			NULL
#undef PC5
#define PC5_PIN			PINC5
#define PC5_RPORT		PINC
#define PC5_WPORT		PORTC
#define PC5_DDR			DDRC
#define PC5_PWM			NULL
#undef PC6
#define PC6_PIN			PINC6
#define PC6_RPORT		PINC
#define PC6_WPORT		PORTC
#define PC6_DDR			DDRC
#define PC6_PWM			NULL
#undef PC7
#define PC7_PIN			PINC7
#define PC7_RPORT		PINC
#define PC7_WPORT		PORTC
#define PC7_DDR			DDRC
#define PC7_PWM			NULL

#undef PD0
#define PD0_PIN			PIND0
#define PD0_RPORT		PIND
#define PD0_WPORT		PORTD
#define PD0_DDR			DDRD
#define PD0_PWM			NULL
#undef PD1
#define PD1_PIN			PIND1
#define PD1_RPORT		PIND
#define PD1_WPORT		PORTD
#define PD1_DDR			DDRD
#define PD1_PWM			NULL
#undef PD2
#define PD2_PIN			PIND2
#define PD2_RPORT		PIND
#define PD2_WPORT		PORTD
#define PD2_DDR			DDRD
#define PD2_PWM			NULL
#undef PD3
#define PD3_PIN			PIND3
#define PD3_RPORT		PIND
#define PD3_WPORT		PORTD
#define PD3_DDR			DDRD
#define PD3_PWM			NULL
#undef PD4
#define PD4_PIN			PIND4
#define PD4_RPORT		PIND
#define PD4_WPORT		PORTD
#define PD4_DDR			DDRD
#define PD4_PWM			NULL
#undef PD5
#define PD5_PIN			PIND5
#define PD5_RPORT		PIND
#define PD5_WPORT		PORTD
#define PD5_DDR			DDRD
#define PD5_PWM			NULL
#undef PD6
#define PD6_PIN			PIND6
#define PD6_RPORT		PIND
#define PD6_WPORT		PORTD
#define PD6_DDR			DDRD
#define PD6_PWM			NULL
#undef PD7
#define PD7_PIN			PIND7
#define PD7_RPORT		PIND
#define PD7_WPORT		PORTD
#define PD7_DDR			DDRD
#define PD7_PWM			NULL

#undef PE0
#define PE0_PIN			PINE0
#define PE0_RPORT		PINE
#define PE0_WPORT		PORTE
#define PE0_DDR			DDRE
#define PE0_PWM			NULL
#undef PE1
#define PE1_PIN			PINE1
#define PE1_RPORT		PINE
#define PE1_WPORT		PORTE
#define PE1_DDR			DDRE
#define PE1_PWM			NULL
#undef PE2
#define PE2_PIN			PINE2
#define PE2_RPORT		PINE
#define PE2_WPORT		PORTE
#define PE2_DDR			DDRE
#define PE2_PWM			NULL
#undef PE3
#define PE3_PIN			PINE3
#define PE3_RPORT		PINE
#define PE3_WPORT		PORTE
#define PE3_DDR			DDRE
#define PE3_PWM			&OCR3AL
#undef PE4
#define PE4_PIN			PINE4
#define PE4_RPORT		PINE
#define PE4_WPORT		PORTE
#define PE4_DDR			DDRE
#define PE4_PWM			&OCR3BL
#undef PE5
#define PE5_PIN			PINE5
#define PE5_RPORT		PINE
#define PE5_WPORT		PORTE
#define PE5_DDR			DDRE
#define PE5_PWM			&OCR3CL
#undef PE6
#define PE6_PIN			PINE6
#define PE6_RPORT		PINE
#define PE6_WPORT		PORTE
#define PE6_DDR			DDRE
#define PE6_PWM			NULL
#undef PE7
#define PE7_PIN			PINE7
#define PE7_RPORT		PINE
#define PE7_WPORT		PORTE
#define PE7_DDR			DDRE
#define PE7_PWM			NULL

#undef PF0
#define PF0_PIN			PINF0
#define PF0_RPORT		PINF
#define PF0_WPORT		PORTF
#define PF0_DDR			DDRF
#define PF0_PWM			NULL
#undef PF1
#define PF1_PIN			PINF1
#define PF1_RPORT		PINF
#define PF1_WPORT		PORTF
#define PF1_DDR			DDRF
#define PF1_PWM			NULL
#undef PF2
#define PF2_PIN			PINF2
#define PF2_RPORT		PINF
#define PF2_WPORT		PORTF
#define PF2_DDR			DDRF
#define PF2_PWM			NULL
#undef PF3
#define PF3_PIN			PINF3
#define PF3_RPORT		PINF
#define PF3_WPORT		PORTF
#define PF3_DDR			DDRF
#define PF3_PWM			NULL
#undef PF4
#define PF4_PIN			PINF4
#define PF4_RPORT		PINF
#define PF4_WPORT		PORTF
#define PF4_DDR			DDRF
#define PF4_PWM			NULL
#undef PF5
#define PF5_PIN			PINF5
#define PF5_RPORT		PINF
#define PF5_WPORT		PORTF
#define PF5_DDR			DDRF
#define PF5_PWM			NULL
#undef PF6
#define PF6_PIN			PINF6
#define PF6_RPORT		PINF
#define PF6_WPORT		PORTF
#define PF6_DDR			DDRF
#define PF6_PWM			NULL
#undef PF7
#define PF7_PIN			PINF7
#define PF7_RPORT		PINF
#define PF7_WPORT		PORTF
#define PF7_DDR			DDRF
#define PF7_PWM			NULL

#undef PG0
#define PG0_PIN			PING0
#define PG0_RPORT		PING
#define PG0_WPORT		PORTG
#define PG0_DDR			DDRG
#define PG0_PWM			NULL
#undef PG1
#define PG1_PIN			PING1
#define PG1_RPORT		PING
#define PG1_WPORT		PORTG
#define PG1_DDR			DDRG
#define PG1_PWM			NULL
#undef PG2
#define PG2_PIN			PING2
#define PG2_RPORT		PING
#define PG2_WPORT		PORTG
#define PG2_DDR			DDRG
#define PG2_PWM			NULL
#undef PG3
#define PG3_PIN			PING3
#define PG3_RPORT		PING
#define PG3_WPORT		PORTG
#define PG3_DDR			DDRG
#define PG3_PWM			NULL
#undef PG4
#define PG4_PIN			PING4
#define PG4_RPORT		PING
#define PG4_WPORT		PORTG
#define PG4_DDR			DDRG
#define PG4_PWM			NULL
#undef PG5
#define PG5_PIN			PING5
#define PG5_RPORT		PING
#define PG5_WPORT		PORTG
#define PG5_DDR			DDRG
#define PG5_PWM			&OCR0B
#undef PG6
#define PG6_PIN			PING6
#define PG6_RPORT		PING
#define PG6_WPORT		PORTG
#define PG6_DDR			DDRG
#define PG6_PWM			NULL
#undef PG7
#define PG7_PIN			PING7
#define PG7_RPORT		PING
#define PG7_WPORT		PORTG
#define PG7_DDR			DDRG
#define PG7_PWM			NULL

#undef PH0
#define PH0_PIN			PINH0
#define PH0_RPORT		PINH
#define PH0_WPORT		PORTH
#define PH0_DDR			DDRH
#define PH0_PWM			NULL
#undef PH1
#define PH1_PIN			PINH1
#define PH1_RPORT		PINH
#define PH1_WPORT		PORTH
#define PH1_DDR			DDRH
#define PH1_PWM			NULL
#undef PH2
#define PH2_PIN			PINH2
#define PH2_RPORT		PINH
#define PH2_WPORT		PORTH
#define PH2_DDR			DDRH
#define PH2_PWM			NULL
#undef PH3
#define PH3_PIN			PINH3
#define PH3_RPORT		PINH
#define PH3_WPORT		PORTH
#define PH3_DDR			DDRH
#define PH3_PWM			&OCR4AL
#undef PH4
#define PH4_PIN			PINH4
#define PH4_RPORT		PINH
#define PH4_WPORT		PORTH
#define PH4_DDR			DDRH
#define PH4_PWM			&OCR4BL
#undef PH5
#define PH5_PIN			PINH5
#define PH5_RPORT		PINH
#define PH5_WPORT		PORTH
#define PH5_DDR			DDRH
#define PH5_PWM			&OCR4CL
#undef PH6
#define PH6_PIN			PINH6
#define PH6_RPORT		PINH
#define PH6_WPORT		PORTH
#define PH6_DDR			DDRH
#define PH6_PWM			&OCR2B
#undef PH7
#define PH7_PIN			PINH7
#define PH7_RPORT		PINH
#define PH7_WPORT		PORTH
#define PH7_DDR			DDRH
#define PH7_PWM			NULL

#undef PJ0
#define PJ0_PIN			PINJ0
#define PJ0_RPORT		PINJ
#define PJ0_WPORT		PORTJ
#define PJ0_DDR			DDRJ
#define PJ0_PWM			NULL
#undef PJ1
#define PJ1_PIN			PINJ1
#define PJ1_RPORT		PINJ
#define PJ1_WPORT		PORTJ
#define PJ1_DDR			DDRJ
#define PJ1_PWM			NULL
#undef PJ2
#define PJ2_PIN			PINJ2
#define PJ2_RPORT		PINJ
#define PJ2_WPORT		PORTJ
#define PJ2_DDR			DDRJ
#define PJ2_PWM			NULL
#undef PJ3
#define PJ3_PIN			PINJ3
#define PJ3_RPORT		PINJ
#define PJ3_WPORT		PORTJ
#define PJ3_DDR			DDRJ
#define PJ3_PWM			NULL
#undef PJ4
#define PJ4_PIN			PINJ4
#define PJ4_RPORT		PINJ
#define PJ4_WPORT		PORTJ
#define PJ4_DDR			DDRJ
#define PJ4_PWM			NULL
#undef PJ5
#define PJ5_PIN			PINJ5
#define PJ5_RPORT		PINJ
#define PJ5_WPORT		PORTJ
#define PJ5_DDR			DDRJ
#define PJ5_PWM			NULL
#undef PJ6
#define PJ6_PIN			PINJ6
#define PJ6_RPORT		PINJ
#define PJ6_WPORT		PORTJ
#define PJ6_DDR			DDRJ
#define PJ6_PWM			NULL
#undef PJ7
#define PJ7_PIN			PINJ7
#define PJ7_RPORT		PINJ
#define PJ7_WPORT		PORTJ
#define PJ7_DDR			DDRJ
#define PJ7_PWM			NULL

#undef PK0
#define PK0_PIN			PINK0
#define PK0_RPORT		PINK
#define PK0_WPORT		PORTK
#define PK0_DDR			DDRK
#define PK0_PWM			NULL
#undef PK1
#define PK1_PIN			PINK1
#define PK1_RPORT		PINK
#define PK1_WPORT		PORTK
#define PK1_DDR			DDRK
#define PK1_PWM			NULL
#undef PK2
#define PK2_PIN			PINK2
#define PK2_RPORT		PINK
#define PK2_WPORT		PORTK
#define PK2_DDR			DDRK
#define PK2_PWM			NULL
#undef PK3
#define PK3_PIN			PINK3
#define PK3_RPORT		PINK
#define PK3_WPORT		PORTK
#define PK3_DDR			DDRK
#define PK3_PWM			NULL
#undef PK4
#define PK4_PIN			PINK4
#define PK4_RPORT		PINK
#define PK4_WPORT		PORTK
#define PK4_DDR			DDRK
#define PK4_PWM			NULL
#undef PK5
#define PK5_PIN			PINK5
#define PK5_RPORT		PINK
#define PK5_WPORT		PORTK
#define PK5_DDR			DDRK
#define PK5_PWM			NULL
#undef PK6
#define PK6_PIN			PINK6
#define PK6_RPORT		PINK
#define PK6_WPORT		PORTK
#define PK6_DDR			DDRK
#define PK6_PWM			NULL
#undef PK7
#define PK7_PIN			PINK7
#define PK7_RPORT		PINK
#define PK7_WPORT		PORTK
#define PK7_DDR			DDRK
#define PK7_PWM			NULL

#undef PL0
#define PL0_PIN			PINL0
#define PL0_RPORT		PINL
#define PL0_WPORT		PORTL
#define PL0_DDR			DDRL
#define PL0_PWM			NULL
#undef PL1
#define PL1_PIN			PINL1
#define PL1_RPORT		PINL
#define PL1_WPORT		PORTL
#define PL1_DDR			DDRL
#define PL1_PWM			NULL
#undef PL2
#define PL2_PIN			PINL2
#define PL2_RPORT		PINL
#define PL2_WPORT		PORTL
#define PL2_DDR			DDRL
#define PL2_PWM			NULL
#undef PL3
#define PL3_PIN			PINL3
#define PL3_RPORT		PINL
#define PL3_WPORT		PORTL
#define PL3_DDR			DDRL
#define PL3_PWM			&OCR5AL
#undef PL4
#define PL4_PIN			PINL4
#define PL4_RPORT		PINL
#define PL4_WPORT		PORTL
#define PL4_DDR			DDRL
#define PL4_PWM			&OCR5BL
#undef PL5
#define PL5_PIN			PINL5
#define PL5_RPORT		PINL
#define PL5_WPORT		PORTL
#define PL5_DDR			DDRL
#define PL5_PWM			&OCR5CL
#undef PL6
#define PL6_PIN			PINL6
#define PL6_RPORT		PINL
#define PL6_WPORT		PORTL
#define PL6_DDR			DDRL
#define PL6_PWM			NULL
#undef PL7
#define PL7_PIN			PINL7
#define PL7_RPORT		PINL
#define PL7_WPORT		PORTL
#define PL7_DDR			DDRL
#define PL7_PWM			NULL

#endif

#if defined (__AVR_AT90USB1287__)
// SPI
#define	SCK					DIO9
#define	MISO				DIO11
#define	MOSI				DIO10
#define	SS					DIO8

// change for your board
#define	DEBUG_LED		DIO31 /* led D5 red */

/*
pins
*/
#define DIO0_PIN        PINA0
#define DIO0_RPORT      PINA
#define DIO0_WPORT      PORTA
#define DIO0_PWM			NULL
#define DIO0_DDR        DDRA

#define DIO1_PIN        PINA1
#define DIO1_RPORT      PINA
#define DIO1_WPORT      PORTA
#define DIO1_PWM			NULL
#define DIO1_DDR        DDRA

#define DIO2_PIN        PINA2
#define DIO2_RPORT      PINA
#define DIO2_WPORT      PORTA
#define DIO2_PWM			NULL
#define DIO2_DDR        DDRA

#define DIO3_PIN        PINA3
#define DIO3_RPORT      PINA
#define DIO3_WPORT      PORTA
#define DIO3_PWM			NULL
#define DIO3_DDR        DDRA

#define DIO4_PIN        PINA4
#define DIO4_RPORT      PINA
#define DIO4_WPORT      PORTA
#define DIO4_PWM			NULL
#define DIO4_DDR        DDRA

#define DIO5_PIN        PINA5
#define DIO5_RPORT      PINA
#define DIO5_WPORT      PORTA
#define DIO5_PWM			NULL
#define DIO5_DDR        DDRA

#define DIO6_PIN        PINA6
#define DIO6_RPORT      PINA
#define DIO6_WPORT      PORTA
#define DIO6_PWM			NULL
#define DIO6_DDR        DDRA

#define DIO7_PIN        PINA7
#define DIO7_RPORT      PINA
#define DIO7_WPORT      PORTA
#define DIO7_PWM			NULL
#define DIO7_DDR        DDRA

#define DIO8_PIN        PINB0
#define DIO8_RPORT      PINB
#define DIO8_WPORT      PORTB
#define DIO8_PWM			NULL
#define DIO8_DDR        DDRB

#define DIO9_PIN        PINB1
#define DIO9_RPORT      PINB
#define DIO9_WPORT      PORTB
#define DIO9_PWM			NULL
#define DIO9_DDR        DDRB

#define DIO10_PIN       PINB2
#define DIO10_RPORT     PINB
#define DIO10_WPORT     PORTB
#define DIO10_PWM			NULL
#define DIO10_DDR       DDRB

#define DIO11_PIN       PINB3
#define DIO11_RPORT     PINB
#define DIO11_WPORT     PORTB
#define DIO11_PWM			NULL
#define DIO11_DDR       DDRB

#define DIO12_PIN       PINB4
#define DIO12_RPORT     PINB
#define DIO12_WPORT     PORTB
#define DIO12_PWM			NULL
#define DIO12_DDR       DDRB

#define DIO13_PIN       PINB5
#define DIO13_RPORT     PINB
#define DIO13_WPORT     PORTB
#define DIO13_PWM			NULL
#define DIO13_DDR       DDRB

#define DIO14_PIN       PINB6
#define DIO14_RPORT     PINB
#define DIO14_WPORT     PORTB
#define DIO14_PWM			NULL
#define DIO14_DDR       DDRB

#define DIO15_PIN       PINB7
#define DIO15_RPORT     PINB
#define DIO15_WPORT     PORTB
#define DIO15_PWM			NULL
#define DIO15_DDR       DDRB

#define DIO16_PIN       PINC0
#define DIO16_RPORT     PINC
#define DIO16_WPORT     PORTC
#define DIO16_PWM			NULL
#define DIO16_DDR       DDRC

#define DIO17_PIN       PINC1
#define DIO17_RPORT     PINC
#define DIO17_WPORT     PORTC
#define DIO17_PWM			NULL
#define DIO17_DDR       DDRC

#define DIO18_PIN       PINC2
#define DIO18_RPORT     PINC
#define DIO18_WPORT     PORTC
#define DIO18_PWM			NULL
#define DIO18_DDR       DDRC

#define DIO19_PIN       PINC3
#define DIO19_RPORT     PINC
#define DIO19_WPORT     PORTC
#define DIO19_PWM			NULL
#define DIO19_DDR       DDRC

#define DIO20_PIN       PINC4
#define DIO20_RPORT     PINC
#define DIO20_WPORT     PORTC
#define DIO20_PWM			NULL
#define DIO20_DDR       DDRC

#define DIO21_PIN       PINC5
#define DIO21_RPORT     PINC
#define DIO21_WPORT     PORTC
#define DIO21_PWM			NULL
#define DIO21_DDR       DDRC

#define DIO22_PIN       PINC6
#define DIO22_RPORT     PINC
#define DIO22_WPORT     PORTC
#define DIO22_PWM			NULL
#define DIO22_DDR       DDRC

#define DIO23_PIN       PINC7
#define DIO23_RPORT     PINC
#define DIO23_WPORT     PORTC
#define DIO23_PWM			NULL
#define DIO23_DDR       DDRC

#define DIO24_PIN       PIND0
#define DIO24_RPORT     PIND
#define DIO24_WPORT     PORTD
#define DIO24_PWM			NULL
#define DIO24_DDR       DDRD

#define DIO25_PIN       PIND1
#define DIO25_RPORT     PIND
#define DIO25_WPORT     PORTD
#define DIO25_PWM			NULL
#define DIO25_DDR       DDRD

#define DIO26_PIN       PIND2
#define DIO26_RPORT     PIND
#define DIO26_WPORT     PORTD
#define DIO26_PWM			NULL
#define DIO26_DDR       DDRD

#define DIO27_PIN       PIND3
#define DIO27_RPORT     PIND
#define DIO27_WPORT     PORTD
#define DIO27_PWM			NULL
#define DIO27_DDR       DDRD

#define DIO28_PIN       PIND4
#define DIO28_RPORT     PIND
#define DIO28_WPORT     PORTD
#define DIO28_PWM			NULL
#define DIO28_DDR       DDRD

#define DIO29_PIN       PIND5
#define DIO29_RPORT     PIND
#define DIO29_WPORT     PORTD
#define DIO29_PWM			NULL
#define DIO29_DDR       DDRD

#define DIO30_PIN       PIND6
#define DIO30_RPORT     PIND
#define DIO30_WPORT     PORTD
#define DIO30_PWM			NULL
#define DIO30_DDR       DDRD

#define DIO31_PIN       PIND7
#define DIO31_RPORT     PIND
#define DIO31_WPORT     PORTD
#define DIO31_PWM			NULL
#define DIO31_DDR       DDRD


#define DIO32_PIN       PINE0
#define DIO32_RPORT     PINE
#define DIO32_WPORT     PORTE
#define DIO32_PWM			NULL
#define DIO32_DDR       DDRE

#define DIO33_PIN       PINE1
#define DIO33_RPORT     PINE
#define DIO33_WPORT     PORTE
#define DIO33_PWM			NULL
#define DIO33_DDR       DDRE

#define DIO34_PIN       PINE2
#define DIO34_RPORT     PINE
#define DIO34_WPORT     PORTE
#define DIO34_PWM			NULL
#define DIO34_DDR       DDRE

#define DIO35_PIN       PINE3
#define DIO35_RPORT     PINE
#define DIO35_WPORT     PORTE
#define DIO35_PWM			NULL
#define DIO35_DDR       DDRE

#define DIO36_PIN       PINE4
#define DIO36_RPORT     PINE
#define DIO36_WPORT     PORTE
#define DIO36_PWM			NULL
#define DIO36_DDR       DDRE

#define DIO37_PIN       PINE5
#define DIO37_RPORT     PINE
#define DIO37_WPORT     PORTE
#define DIO37_PWM			NULL
#define DIO37_DDR       DDRE

#define DIO38_PIN       PINE6
#define DIO38_RPORT     PINE
#define DIO38_WPORT     PORTE
#define DIO38_PWM			NULL
#define DIO38_DDR       DDRE

#define DIO39_PIN       PINE7
#define DIO39_RPORT     PINE
#define DIO39_WPORT     PORTE
#define DIO39_PWM			NULL
#define DIO39_DDR       DDRE

#define AIO0_PIN PINF0
#define AIO0_RPORT PINF
#define AIO0_WPORT PORTF
#define AIO0_PWM			NULL
#define AIO0_DDR DDRF

#define AIO1_PIN PINF1
#define AIO1_RPORT PINF
#define AIO1_WPORT PORTF
#define AIO1_PWM			NULL
#define AIO1_DDR DDRF

#define AIO2_PIN PINF2
#define AIO2_RPORT PINF
#define AIO2_WPORT PORTF
#define AIO2_PWM			NULL
#define AIO2_DDR DDRF

#define AIO3_PIN PINF3
#define AIO3_RPORT PINF
#define AIO3_WPORT PORTF
#define AIO3_PWM			NULL
#define AIO3_DDR DDRF

#define AIO4_PIN PINF4
#define AIO4_RPORT PINF
#define AIO4_WPORT PORTF
#define AIO4_PWM			NULL
#define AIO4_DDR DDRF

#define AIO5_PIN PINF5
#define AIO5_RPORT PINF
#define AIO5_WPORT PORTF
#define AIO5_PWM			NULL
#define AIO5_DDR DDRF

#define AIO6_PIN PINF6
#define AIO6_RPORT PINF
#define AIO6_WPORT PORTF
#define AIO6_PWM			NULL
#define AIO6_DDR DDRF

#define AIO7_PIN PINF7
#define AIO7_RPORT PINF
#define AIO7_WPORT PORTF
#define AIO7_PWM			NULL
#define AIO7_DDR DDRF

#define DIO40_PIN       PINF0
#define DIO40_RPORT     PINF
#define DIO40_WPORT     PORTF
#define DIO40_PWM			NULL
#define DIO40_DDR       DDRF

#define DIO41_PIN       PINF1
#define DIO41_RPORT     PINF
#define DIO41_WPORT     PORTF
#define DIO41_PWM			NULL
#define DIO41_DDR       DDRF

#define DIO42_PIN       PINF2
#define DIO42_RPORT     PINF
#define DIO42_WPORT     PORTF
#define DIO42_PWM			NULL
#define DIO42_DDR       DDRF

#define DIO43_PIN       PINF3
#define DIO43_RPORT     PINF
#define DIO43_WPORT     PORTF
#define DIO43_PWM			NULL
#define DIO43_DDR       DDRF

#define DIO44_PIN       PINF4
#define DIO44_RPORT     PINF
#define DIO44_WPORT     PORTF
#define DIO44_PWM			NULL
#define DIO44_DDR       DDRF

#define DIO45_PIN       PINF5
#define DIO45_RPORT     PINF
#define DIO45_WPORT     PORTF
#define DIO45_PWM			NULL
#define DIO45_DDR       DDRF

#define DIO46_PIN       PINF6
#define DIO46_RPORT     PINF
#define DIO46_WPORT     PORTF
#define DIO46_PWM			NULL
#define DIO46_DDR       DDRF

#define DIO47_PIN       PINF7
#define DIO47_RPORT     PINF
#define DIO47_WPORT     PORTF
#define DIO47_PWM			NULL
#define DIO47_DDR       DDRF



#undef PA0
#define PA0_PIN			PINA0
#define PA0_RPORT		PINA
#define PA0_WPORT		PORTA
#define PA0_PWM			NULL
#define PA0_DDR			DDRA
#undef PA1
#define PA1_PIN			PINA1
#define PA1_RPORT		PINA
#define PA1_WPORT		PORTA
#define PA1_PWM			NULL
#define PA1_DDR			DDRA
#undef PA2
#define PA2_PIN			PINA2
#define PA2_RPORT		PINA
#define PA2_WPORT		PORTA
#define PA2_PWM			NULL
#define PA2_DDR			DDRA
#undef PA3
#define PA3_PIN			PINA3
#define PA3_RPORT		PINA
#define PA3_WPORT		PORTA
#define PA3_PWM			NULL
#define PA3_DDR			DDRA
#undef PA4
#define PA4_PIN			PINA4
#define PA4_RPORT		PINA
#define PA4_WPORT		PORTA
#define PA4_PWM			NULL
#define PA4_DDR			DDRA
#undef PA5
#define PA5_PIN			PINA5
#define PA5_RPORT		PINA
#define PA5_WPORT		PORTA
#define PA5_PWM			NULL
#define PA5_DDR			DDRA
#undef PA6
#define PA6_PIN			PINA6
#define PA6_RPORT		PINA
#define PA6_WPORT		PORTA
#define PA6_PWM			NULL
#define PA6_DDR			DDRA
#undef PA7
#define PA7_PIN			PINA7
#define PA7_RPORT		PINA
#define PA7_WPORT		PORTA
#define PA7_PWM			NULL
#define PA7_DDR			DDRA

#undef PB0
#define PB0_PIN			PINB0
#define PB0_RPORT		PINB
#define PB0_WPORT		PORTB
#define PB0_PWM			NULL
#define PB0_DDR			DDRB
#undef PB1
#define PB1_PIN			PINB1
#define PB1_RPORT		PINB
#define PB1_WPORT		PORTB
#define PB1_PWM			NULL
#define PB1_DDR			DDRB
#undef PB2
#define PB2_PIN			PINB2
#define PB2_RPORT		PINB
#define PB2_WPORT		PORTB
#define PB2_PWM			NULL
#define PB2_DDR			DDRB
#undef PB3
#define PB3_PIN			PINB3
#define PB3_RPORT		PINB
#define PB3_WPORT		PORTB
#define PB3_PWM			NULL
#define PB3_DDR			DDRB
#undef PB4
#define PB4_PIN			PINB4
#define PB4_RPORT		PINB
#define PB4_WPORT		PORTB
#define PB4_PWM			NULL
#define PB4_DDR			DDRB
#undef PB5
#define PB5_PIN			PINB5
#define PB5_RPORT		PINB
#define PB5_WPORT		PORTB
#define PB5_PWM			NULL
#define PB5_DDR			DDRB
#undef PB6
#define PB6_PIN			PINB6
#define PB6_RPORT		PINB
#define PB6_WPORT		PORTB
#define PB6_PWM			NULL
#define PB6_DDR			DDRB
#undef PB7
#define PB7_PIN			PINB7
#define PB7_RPORT		PINB
#define PB7_WPORT		PORTB
#define PB7_PWM			NULL
#define PB7_DDR			DDRB

#undef PC0
#define PC0_PIN			PINC0
#define PC0_RPORT		PINC
#define PC0_WPORT		PORTC
#define PC0_PWM			NULL
#define PC0_DDR			DDRC
#undef PC1
#define PC1_PIN			PINC1
#define PC1_RPORT		PINC
#define PC1_WPORT		PORTC
#define PC1_PWM			NULL
#define PC1_DDR			DDRC
#undef PC2
#define PC2_PIN			PINC2
#define PC2_RPORT		PINC
#define PC2_WPORT		PORTC
#define PC2_PWM			NULL
#define PC2_DDR			DDRC
#undef PC3
#define PC3_PIN			PINC3
#define PC3_RPORT		PINC
#define PC3_WPORT		PORTC
#define PC3_PWM			NULL
#define PC3_DDR			DDRC
#undef PC4
#define PC4_PIN			PINC4
#define PC4_RPORT		PINC
#define PC4_WPORT		PORTC
#define PC4_PWM			NULL
#define PC4_DDR			DDRC
#undef PC5
#define PC5_PIN			PINC5
#define PC5_RPORT		PINC
#define PC5_WPORT		PORTC
#define PC5_PWM			NULL
#define PC5_DDR			DDRC
#undef PC6
#define PC6_PIN			PINC6
#define PC6_RPORT		PINC
#define PC6_WPORT		PORTC
#define PC6_PWM			NULL
#define PC6_DDR			DDRC
#undef PC7
#define PC7_PIN			PINC7
#define PC7_RPORT		PINC
#define PC7_WPORT		PORTC
#define PC7_PWM			NULL
#define PC7_DDR			DDRC

#undef PD0
#define PD0_PIN			PIND0
#define PD0_RPORT		PIND
#define PD0_WPORT		PORTD
#define PD0_PWM			NULL
#define PD0_DDR			DDRD
#undef PD1
#define PD1_PIN			PIND1
#define PD1_RPORT		PIND
#define PD1_WPORT		PORTD
#define PD1_PWM			NULL
#define PD1_DDR			DDRD
#undef PD2
#define PD2_PIN			PIND2
#define PD2_RPORT		PIND
#define PD2_WPORT		PORTD
#define PD2_PWM			NULL
#define PD2_DDR			DDRD
#undef PD3
#define PD3_PIN			PIND3
#define PD3_RPORT		PIND
#define PD3_WPORT		PORTD
#define PD3_PWM			NULL
#define PD3_DDR			DDRD
#undef PD4
#define PD4_PIN			PIND4
#define PD4_RPORT		PIND
#define PD4_WPORT		PORTD
#define PD4_PWM			NULL
#define PD4_DDR			DDRD
#undef PD5
#define PD5_PIN			PIND5
#define PD5_RPORT		PIND
#define PD5_WPORT		PORTD
#define PD5_PWM			NULL
#define PD5_DDR			DDRD
#undef PD6
#define PD6_PIN			PIND6
#define PD6_RPORT		PIND
#define PD6_WPORT		PORTD
#define PD6_PWM			NULL
#define PD6_DDR			DDRD
#undef PD7
#define PD7_PIN			PIND7
#define PD7_RPORT		PIND
#define PD7_WPORT		PORTD
#define PD7_PWM			NULL
#define PD7_DDR			DDRD

#undef PE0
#define PE0_PIN			PINE0
#define PE0_RPORT		PINE
#define PE0_WPORT		PORTE
#define PE0_PWM			NULL
#define PE0_DDR			DDRE
#undef PE1
#define PE1_PIN			PINE1
#define PE1_RPORT		PINE
#define PE1_WPORT		PORTE
#define PE1_PWM			NULL
#define PE1_DDR			DDRE
#undef PE2
#define PE2_PIN			PINE2
#define PE2_RPORT		PINE
#define PE2_WPORT		PORTE
#define PE2_PWM			NULL
#define PE2_DDR			DDRE
#undef PE3
#define PE3_PIN			PINE3
#define PE3_RPORT		PINE
#define PE3_WPORT		PORTE
#define PE3_PWM			NULL
#define PE3_DDR			DDRE
#undef PE4
#define PE4_PIN			PINE4
#define PE4_RPORT		PINE
#define PE4_WPORT		PORTE
#define PE4_PWM			NULL
#define PE4_DDR			DDRE
#undef PE5
#define PE5_PIN			PINE5
#define PE5_RPORT		PINE
#define PE5_WPORT		PORTE
#define PE5_PWM			NULL
#define PE5_DDR			DDRE
#undef PE6
#define PE6_PIN			PINE6
#define PE6_RPORT		PINE
#define PE6_WPORT		PORTE
#define PE6_PWM			NULL
#define PE6_DDR			DDRE
#undef PE7
#define PE7_PIN			PINE7
#define PE7_RPORT		PINE
#define PE7_WPORT		PORTE
#define PE7_PWM			NULL
#define PE7_DDR			DDRE

#undef PF0
#define PF0_PIN			PINF0
#define PF0_RPORT		PINF
#define PF0_WPORT		PORTF
#define PF0_PWM			NULL
#define PF0_DDR			DDRF
#undef PF1
#define PF1_PIN			PINF1
#define PF1_RPORT		PINF
#define PF1_WPORT		PORTF
#define PF1_PWM			NULL
#define PF1_DDR			DDRF
#undef PF2
#define PF2_PIN			PINF2
#define PF2_RPORT		PINF
#define PF2_WPORT		PORTF
#define PF2_PWM			NULL
#define PF2_DDR			DDRF
#undef PF3
#define PF3_PIN			PINF3
#define PF3_RPORT		PINF
#define PF3_WPORT		PORTF
#define PF3_PWM			NULL
#define PF3_DDR			DDRF
#undef PF4
#define PF4_PIN			PINF4
#define PF4_RPORT		PINF
#define PF4_WPORT		PORTF
#define PF4_PWM			NULL
#define PF4_DDR			DDRF
#undef PF5
#define PF5_PIN			PINF5
#define PF5_RPORT		PINF
#define PF5_WPORT		PORTF
#define PF5_PWM			NULL
#define PF5_DDR			DDRF
#undef PF6
#define PF6_PIN			PINF6
#define PF6_RPORT		PINF
#define PF6_WPORT		PORTF
#define PF6_PWM			NULL
#define PF6_DDR			DDRF
#undef PF7
#define PF7_PIN			PINF7
#define PF7_RPORT		PINF
#define PF7_WPORT		PORTF
#define PF7_PWM			NULL
#define PF7_DDR			DDRF
#endif

#ifndef	DIO0_PIN
#error pins for this chip not defined in arduino.h! If you write an appropriate pin definition and have this firmware work on your chip, please submit a pull request
#endif

#endif /* _ARDUINO_H */