portpins.h
01 1 Copyright (c) 2003 Theodore A. Roth
022All rights reserved.
033
044Redistribution and use in source and binary forms, with or without
055modification, are permitted provided that the following conditions are met:
066
077* Redistributions of source code must retain the above copyright
088notice, this list of conditions and the following disclaimer.
099
1010* Redistributions in binary form must reproduce the above copyright
1111notice, this list of conditions and the following disclaimer in
1212the documentation and/or other materials provided with the
1313distribution.
1414
1515* Neither the name of the copyright holders nor the names of
1616contributors may be used to endorse or promote products derived
1717from this software without specific prior written permission.
1818
1919THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
2020AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2121IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2222ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
2323LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
2424CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
2525SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
2626INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
2727CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
2828ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
2929POSSIBILITY OF SUCH DAMAGE. */
3030
3131/* $Id: portpins.h 1936 2009-03-19 22:19:26Z arcanum $ */
3232
3333#ifndef _AVR_PORTPINS_H_
3434#define _AVR_PORTPINS_H_ 1
3535
3636/* This file should only be included from <avr/io.h>, never directly. */
3737
3838#ifndef _AVR_IO_H_
3939# error "Include <avr/io.h> instead of this file."
4040#endif
4141
4242/* Define Generic PORTn, DDn, and PINn values. */
4343
4444/* Port Data Register (generic) */
4545#define PORT7 7
4646#define PORT6 6
4747#define PORT5 5
4848#define PORT4 4
4949#define PORT3 3
5050#define PORT2 2
5151#define PORT1 1
5252#define PORT0 0
5353
5454/* Port Data Direction Register (generic) */
5555#define DD7 7
5656#define DD6 6
5757#define DD5 5
5858#define DD4 4
5959#define DD3 3
6060#define DD2 2
6161#define DD1 1
6262#define DD0 0
6363
6464/* Port Input Pins (generic) */
6565#define PIN7 7
6666#define PIN6 6
6767#define PIN5 5
6868#define PIN4 4
6969#define PIN3 3
7070#define PIN2 2
7171#define PIN1 1
7272#define PIN0 0
7373
7474/* Define PORTxn an Pxn values for all possible port pins if not defined already by io.h. */
7575
7676/* PORT A */
7777
7878#if defined(PA0) && !defined(PORTA0)
7979# define PORTA0 PA0
8080#elif defined(PORTA0) && !defined(PA0)
8181# define PA0 PORTA0
8282#endif
8383#if defined(PA1) && !defined(PORTA1)
8484# define PORTA1 PA1
8585#elif defined(PORTA1) && !defined(PA1)
8686# define PA1 PORTA1
8787#endif
8888#if defined(PA2) && !defined(PORTA2)
8989# define PORTA2 PA2
9090#elif defined(PORTA2) && !defined(PA2)
9191# define PA2 PORTA2
9292#endif
9393#if defined(PA3) && !defined(PORTA3)
9494# define PORTA3 PA3
9595#elif defined(PORTA3) && !defined(PA3)
9696# define PA3 PORTA3
9797#endif
9898#if defined(PA4) && !defined(PORTA4)
9999# define PORTA4 PA4
100100#elif defined(PORTA4) && !defined(PA4)
101101# define PA4 PORTA4
102102#endif
103103#if defined(PA5) && !defined(PORTA5)
104104# define PORTA5 PA5
105105#elif defined(PORTA5) && !defined(PA5)
106106# define PA5 PORTA5
107107#endif
108108#if defined(PA6) && !defined(PORTA6)
109109# define PORTA6 PA6
110110#elif defined(PORTA6) && !defined(PA6)
111111# define PA6 PORTA6
112112#endif
113113#if defined(PA7) && !defined(PORTA7)
114114# define PORTA7 PA7
115115#elif defined(PORTA7) && !defined(PA7)
116116# define PA7 PORTA7
117117#endif
118118
119119/* PORT B */
120120
121121#if defined(PB0) && !defined(PORTB0)
122122# define PORTB0 PB0
123123#elif defined(PORTB0) && !defined(PB0)
124124# define PB0 PORTB0
125125#endif
126126#if defined(PB1) && !defined(PORTB1)
127127# define PORTB1 PB1
128128#elif defined(PORTB1) && !defined(PB1)
129129# define PB1 PORTB1
130130#endif
131131#if defined(PB2) && !defined(PORTB2)
132132# define PORTB2 PB2
133133#elif defined(PORTB2) && !defined(PB2)
134134# define PB2 PORTB2
135135#endif
136136#if defined(PB3) && !defined(PORTB3)
137137# define PORTB3 PB3
138138#elif defined(PORTB3) && !defined(PB3)
139139# define PB3 PORTB3
140140#endif
141141#if defined(PB4) && !defined(PORTB4)
142142# define PORTB4 PB4
143143#elif defined(PORTB4) && !defined(PB4)
144144# define PB4 PORTB4
145145#endif
146146#if defined(PB5) && !defined(PORTB5)
147147# define PORTB5 PB5
148148#elif defined(PORTB5) && !defined(PB5)
149149# define PB5 PORTB5
150150#endif
151151#if defined(PB6) && !defined(PORTB6)
152152# define PORTB6 PB6
153153#elif defined(PORTB6) && !defined(PB6)
154154# define PB6 PORTB6
155155#endif
156156#if defined(PB7) && !defined(PORTB7)
157157# define PORTB7 PB7
158158#elif defined(PORTB7) && !defined(PB7)
159159# define PB7 PORTB7
160160#endif
161161
162162/* PORT C */
163163
164164#if defined(PC0) && !defined(PORTC0)
165165# define PORTC0 PC0
166166#elif defined(PORTC0) && !defined(PC0)
167167# define PC0 PORTC0
168168#endif
169169#if defined(PC1) && !defined(PORTC1)
170170# define PORTC1 PC1
171171#elif defined(PORTC1) && !defined(PC1)
172172# define PC1 PORTC1
173173#endif
174174#if defined(PC2) && !defined(PORTC2)
175175# define PORTC2 PC2
176176#elif defined(PORTC2) && !defined(PC2)
177177# define PC2 PORTC2
178178#endif
179179#if defined(PC3) && !defined(PORTC3)
180180# define PORTC3 PC3
181181#elif defined(PORTC3) && !defined(PC3)
182182# define PC3 PORTC3
183183#endif
184184#if defined(PC4) && !defined(PORTC4)
185185# define PORTC4 PC4
186186#elif defined(PORTC4) && !defined(PC4)
187187# define PC4 PORTC4
188188#endif
189189#if defined(PC5) && !defined(PORTC5)
190190# define PORTC5 PC5
191191#elif defined(PORTC5) && !defined(PC5)
192192# define PC5 PORTC5
193193#endif
194194#if defined(PC6) && !defined(PORTC6)
195195# define PORTC6 PC6
196196#elif defined(PORTC6) && !defined(PC6)
197197# define PC6 PORTC6
198198#endif
199199#if defined(PC7) && !defined(PORTC7)
200200# define PORTC7 PC7
201201#elif defined(PORTC7) && !defined(PC7)
202202# define PC7 PORTC7
203203#endif
204204
205205/* PORT D */
206206
207207#if defined(PD0) && !defined(PORTD0)
208208# define PORTD0 PD0
209209#elif defined(PORTD0) && !defined(PD0)
210210# define PD0 PORTD0
211211#endif
212212#if defined(PD1) && !defined(PORTD1)
213213# define PORTD1 PD1
214214#elif defined(PORTD1) && !defined(PD1)
215215# define PD1 PORTD1
216216#endif
217217#if defined(PD2) && !defined(PORTD2)
218218# define PORTD2 PD2
219219#elif defined(PORTD2) && !defined(PD2)
220220# define PD2 PORTD2
221221#endif
222222#if defined(PD3) && !defined(PORTD3)
223223# define PORTD3 PD3
224224#elif defined(PORTD3) && !defined(PD3)
225225# define PD3 PORTD3
226226#endif
227227#if defined(PD4) && !defined(PORTD4)
228228# define PORTD4 PD4
229229#elif defined(PORTD4) && !defined(PD4)
230230# define PD4 PORTD4
231231#endif
232232#if defined(PD5) && !defined(PORTD5)
233233# define PORTD5 PD5
234234#elif defined(PORTD5) && !defined(PD5)
235235# define PD5 PORTD5
236236#endif
237237#if defined(PD6) && !defined(PORTD6)
238238# define PORTD6 PD6
239239#elif defined(PORTD6) && !defined(PD6)
240240# define PD6 PORTD6
241241#endif
242242#if defined(PD7) && !defined(PORTD7)
243243# define PORTD7 PD7
244244#elif defined(PORTD7) && !defined(PD7)
245245# define PD7 PORTD7
246246#endif
247247
248248/* PORT E */
249249
250250#if defined(PE0) && !defined(PORTE0)
251251# define PORTE0 PE0
252252#elif defined(PORTE0) && !defined(PE0)
253253# define PE0 PORTE0
254254#endif
255255#if defined(PE1) && !defined(PORTE1)
256256# define PORTE1 PE1
257257#elif defined(PORTE1) && !defined(PE1)
258258# define PE1 PORTE1
259259#endif
260260#if defined(PE2) && !defined(PORTE2)
261261# define PORTE2 PE2
262262#elif defined(PORTE2) && !defined(PE2)
263263# define PE2 PORTE2
264264#endif
265265#if defined(PE3) && !defined(PORTE3)
266266# define PORTE3 PE3
267267#elif defined(PORTE3) && !defined(PE3)
268268# define PE3 PORTE3
269269#endif
270270#if defined(PE4) && !defined(PORTE4)
271271# define PORTE4 PE4
272272#elif defined(PORTE4) && !defined(PE4)
273273# define PE4 PORTE4
274274#endif
275275#if defined(PE5) && !defined(PORTE5)
276276# define PORTE5 PE5
277277#elif defined(PORTE5) && !defined(PE5)
278278# define PE5 PORTE5
279279#endif
280280#if defined(PE6) && !defined(PORTE6)
281281# define PORTE6 PE6
282282#elif defined(PORTE6) && !defined(PE6)
283283# define PE6 PORTE6
284284#endif
285285#if defined(PE7) && !defined(PORTE7)
286286# define PORTE7 PE7
287287#elif defined(PORTE7) && !defined(PE7)
288288# define PE7 PORTE7
289289#endif
290290
291291/* PORT F */
292292
293293#if defined(PF0) && !defined(PORTF0)
294294# define PORTF0 PF0
295295#elif defined(PORTF0) && !defined(PF0)
296296# define PF0 PORTF0
297297#endif
298298#if defined(PF1) && !defined(PORTF1)
299299# define PORTF1 PF1
300300#elif defined(PORTF1) && !defined(PF1)
301301# define PF1 PORTF1
302302#endif
303303#if defined(PF2) && !defined(PORTF2)
304304# define PORTF2 PF2
305305#elif defined(PORTF2) && !defined(PF2)
306306# define PF2 PORTF2
307307#endif
308308#if defined(PF3) && !defined(PORTF3)
309309# define PORTF3 PF3
310310#elif defined(PORTF3) && !defined(PF3)
311311# define PF3 PORTF3
312312#endif
313313#if defined(PF4) && !defined(PORTF4)
314314# define PORTF4 PF4
315315#elif defined(PORTF4) && !defined(PF4)
316316# define PF4 PORTF4
317317#endif
318318#if defined(PF5) && !defined(PORTF5)
319319# define PORTF5 PF5
320320#elif defined(PORTF5) && !defined(PF5)
321321# define PF5 PORTF5
322322#endif
323323#if defined(PF6) && !defined(PORTF6)
324324# define PORTF6 PF6
325325#elif defined(PORTF6) && !defined(PF6)
326326# define PF6 PORTF6
327327#endif
328328#if defined(PF7) && !defined(PORTF7)
329329# define PORTF7 PF7
330330#elif defined(PORTF7) && !defined(PF7)
331331# define PF7 PORTF7
332332#endif
333333
334334/* PORT G */
335335
336336#if defined(PG0) && !defined(PORTG0)
337337# define PORTG0 PG0
338338#elif defined(PORTG0) && !defined(PG0)
339339# define PG0 PORTG0
340340#endif
341341#if defined(PG1) && !defined(PORTG1)
342342# define PORTG1 PG1
343343#elif defined(PORTG1) && !defined(PG1)
344344# define PG1 PORTG1
345345#endif
346346#if defined(PG2) && !defined(PORTG2)
347347# define PORTG2 PG2
348348#elif defined(PORTG2) && !defined(PG2)
349349# define PG2 PORTG2
350350#endif
351351#if defined(PG3) && !defined(PORTG3)
352352# define PORTG3 PG3
353353#elif defined(PORTG3) && !defined(PG3)
354354# define PG3 PORTG3
355355#endif
356356#if defined(PG4) && !defined(PORTG4)
357357# define PORTG4 PG4
358358#elif defined(PORTG4) && !defined(PG4)
359359# define PG4 PORTG4
360360#endif
361361#if defined(PG5) && !defined(PORTG5)
362362# define PORTG5 PG5
363363#elif defined(PORTG5) && !defined(PG5)
364364# define PG5 PORTG5
365365#endif
366366#if defined(PG6) && !defined(PORTG6)
367367# define PORTG6 PG6
368368#elif defined(PORTG6) && !defined(PG6)
369369# define PG6 PORTG6
370370#endif
371371#if defined(PG7) && !defined(PORTG7)
372372# define PORTG7 PG7
373373#elif defined(PORTG7) && !defined(PG7)
374374# define PG7 PORTG7
375375#endif
376376
377377/* PORT H */
378378
379379#if defined(PH0) && !defined(PORTH0)
380380# define PORTH0 PH0
381381#elif defined(PORTH0) && !defined(PH0)
382382# define PH0 PORTH0
383383#endif
384384#if defined(PH1) && !defined(PORTH1)
385385# define PORTH1 PH1
386386#elif defined(PORTH1) && !defined(PH1)
387387# define PH1 PORTH1
388388#endif
389389#if defined(PH2) && !defined(PORTH2)
390390# define PORTH2 PH2
391391#elif defined(PORTH2) && !defined(PH2)
392392# define PH2 PORTH2
393393#endif
394394#if defined(PH3) && !defined(PORTH3)
395395# define PORTH3 PH3
396396#elif defined(PORTH3) && !defined(PH3)
397397# define PH3 PORTH3
398398#endif
399399#if defined(PH4) && !defined(PORTH4)
400400# define PORTH4 PH4
401401#elif defined(PORTH4) && !defined(PH4)
402402# define PH4 PORTH4
403403#endif
404404#if defined(PH5) && !defined(PORTH5)
405405# define PORTH5 PH5
406406#elif defined(PORTH5) && !defined(PH5)
407407# define PH5 PORTH5
408408#endif
409409#if defined(PH6) && !defined(PORTH6)
410410# define PORTH6 PH6
411411#elif defined(PORTH6) && !defined(PH6)
412412# define PH6 PORTH6
413413#endif
414414#if defined(PH7) && !defined(PORTH7)
415415# define PORTH7 PH7
416416#elif defined(PORTH7) && !defined(PH7)
417417# define PH7 PORTH7
418418#endif
419419
420420/* PORT J */
421421
422422#if defined(PJ0) && !defined(PORTJ0)
423423# define PORTJ0 PJ0
424424#elif defined(PORTJ0) && !defined(PJ0)
425425# define PJ0 PORTJ0
426426#endif
427427#if defined(PJ1) && !defined(PORTJ1)
428428# define PORTJ1 PJ1
429429#elif defined(PORTJ1) && !defined(PJ1)
430430# define PJ1 PORTJ1
431431#endif
432432#if defined(PJ2) && !defined(PORTJ2)
433433# define PORTJ2 PJ2
434434#elif defined(PORTJ2) && !defined(PJ2)
435435# define PJ2 PORTJ2
436436#endif
437437#if defined(PJ3) && !defined(PORTJ3)
438438# define PORTJ3 PJ3
439439#elif defined(PORTJ3) && !defined(PJ3)
440440# define PJ3 PORTJ3
441441#endif
442442#if defined(PJ4) && !defined(PORTJ4)
443443# define PORTJ4 PJ4
444444#elif defined(PORTJ4) && !defined(PJ4)
445445# define PJ4 PORTJ4
446446#endif
447447#if defined(PJ5) && !defined(PORTJ5)
448448# define PORTJ5 PJ5
449449#elif defined(PORTJ5) && !defined(PJ5)
450450# define PJ5 PORTJ5
451451#endif
452452#if defined(PJ6) && !defined(PORTJ6)
453453# define PORTJ6 PJ6
454454#elif defined(PORTJ6) && !defined(PJ6)
455455# define PJ6 PORTJ6
456456#endif
457457#if defined(PJ7) && !defined(PORTJ7)
458458# define PORTJ7 PJ7
459459#elif defined(PORTJ7) && !defined(PJ7)
460460# define PJ7 PORTJ7
461461#endif
462462
463463/* PORT K */
464464
465465#if defined(PK0) && !defined(PORTK0)
466466# define PORTK0 PK0
467467#elif defined(PORTK0) && !defined(PK0)
468468# define PK0 PORTK0
469469#endif
470470#if defined(PK1) && !defined(PORTK1)
471471# define PORTK1 PK1
472472#elif defined(PORTK1) && !defined(PK1)
473473# define PK1 PORTK1
474474#endif
475475#if defined(PK2) && !defined(PORTK2)
476476# define PORTK2 PK2
477477#elif defined(PORTK2) && !defined(PK2)
478478# define PK2 PORTK2
479479#endif
480480#if defined(PK3) && !defined(PORTK3)
481481# define PORTK3 PK3
482482#elif defined(PORTK3) && !defined(PK3)
483483# define PK3 PORTK3
484484#endif
485485#if defined(PK4) && !defined(PORTK4)
486486# define PORTK4 PK4
487487#elif defined(PORTK4) && !defined(PK4)
488488# define PK4 PORTK4
489489#endif
490490#if defined(PK5) && !defined(PORTK5)
491491# define PORTK5 PK5
492492#elif defined(PORTK5) && !defined(PK5)
493493# define PK5 PORTK5
494494#endif
495495#if defined(PK6) && !defined(PORTK6)
496496# define PORTK6 PK6
497497#elif defined(PORTK6) && !defined(PK6)
498498# define PK6 PORTK6
499499#endif
500500#if defined(PK7) && !defined(PORTK7)
501501# define PORTK7 PK7
502502#elif defined(PORTK7) && !defined(PK7)
503503# define PK7 PORTK7
504504#endif
505505
506506/* PORT L */
507507
508508#if defined(PL0) && !defined(PORTL0)
509509# define PORTL0 PL0
510510#elif defined(PORTL0) && !defined(PL0)
511511# define PL0 PORTL0
512512#endif
513513#if defined(PL1) && !defined(PORTL1)
514514# define PORTL1 PL1
515515#elif defined(PORTL1) && !defined(PL1)
516516# define PL1 PORTL1
517517#endif
518518#if defined(PL2) && !defined(PORTL2)
519519# define PORTL2 PL2
520520#elif defined(PORTL2) && !defined(PL2)
521521# define PL2 PORTL2
522522#endif
523523#if defined(PL3) && !defined(PORTL3)
524524# define PORTL3 PL3
525525#elif defined(PORTL3) && !defined(PL3)
526526# define PL3 PORTL3
527527#endif
528528#if defined(PL4) && !defined(PORTL4)
529529# define PORTL4 PL4
530530#elif defined(PORTL4) && !defined(PL4)
531531# define PL4 PORTL4
532532#endif
533533#if defined(PL5) && !defined(PORTL5)
534534# define PORTL5 PL5
535535#elif defined(PORTL5) && !defined(PL5)
536536# define PL5 PORTL5
537537#endif
538538#if defined(PL6) && !defined(PORTL6)
539539# define PORTL6 PL6
540540#elif defined(PORTL6) && !defined(PL6)
541541# define PL6 PORTL6
542542#endif
543543#if defined(PL7) && !defined(PORTL7)
544544# define PORTL7 PL7
545545#elif defined(PORTL7) && !defined(PL7)
546546# define PL7 PORTL7
547547#endif
548548
549549#endif /* _AVR_PORTPINS_H_ */