Debian Codegraph @

variants/standard/pins_arduino.h

raw symbols SCIP
1 #ifndef Pins_Arduino_h
2 #define Pins_Arduino_h
3
4 #include <avr/pgmspace.h>
5
6 // ATMEL ATMEGA1284P
7 //
8 // +---\/---+
9 // (D 0) PB0 1| |40 PA0 (AI 0 / D24)
10 // (D 1) PB1 2| |39 PA1 (AI 1 / D25)
11 // INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D26)
12 // PWM (D 3) PB3 4| |37 PA3 (AI 3 / D27)
13 // PWM/SS (D 4) PB4 5| |36 PA4 (AI 4 / D28)
14 // MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D29)
15 // PWM/MISO (D 6) PB6 7| |34 PA6 (AI 6 / D30)
16 // PWM/SCK (D 7) PB7 8| |33 PA7 (AI 7 / D31)
17 // RST 9| |32 AREF
18 // VCC 10| |31 GND
19 // GND 11| |30 AVCC
20 // XTAL2 12| |29 PC7 (D 23)
21 // XTAL1 13| |28 PC6 (D 22)
22 // RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
23 // TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
24 // RX1/INT0 (D 10) PD2 16| |25 PC3 (D 19) TMS
25 // TX1/INT1 (D 11) PD3 17| |24 PC2 (D 18) TCK
26 // PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
27 // PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
28 // PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
29 // +--------+
30 //
31
32 /*
33 PCINT15-8: D7-0 : bit 1
34 PCINT31-24: D15-8 : bit 3
35 PCINT23-16: D23-16 : bit 2
36 PCINT7-0: D31-24 : bit 0
37 */
38
39 #define NUM_DIGITAL_PINS 32
40 #define NUM_ANALOG_INPUTS 8
41 #define analogInputToDigitalPin(p) ((p < NUM_ANALOG_INPUTS) ? (p) + 24 : -1)
42
43 #define digitalPinHasPWM(p) ((p) == 3 || (p) == 4 || (p) == 6 || (p) == 7 || (p) == 12 || (p) == 13 || (p) == 14 || (p) == 15)
44
45 static const uint8_t SS = 4;
46 static const uint8_t MOSI = 5;
47 static const uint8_t MISO = 6;
48 static const uint8_t SCK = 7;
49
50 static const uint8_t SDA = 17;
51 static const uint8_t SCL = 16;
52 static const uint8_t LED = 7;
53
54 static const uint8_t A0 = 24;
55 static const uint8_t A1 = 25;
56 static const uint8_t A2 = 26;
57 static const uint8_t A3 = 27;
58 static const uint8_t A4 = 28;
59 static const uint8_t A5 = 29;
60 static const uint8_t A6 = 30;
61 static const uint8_t A7 = 31;
62
63 #define digitalPinToPCICR(p) (((p) >= 0 && (p) < NUM_DIGITAL_PINS) ? (&PCICR) : ((uint8_t *)0))
64 #define digitalPinToPCICRbit(p) (((p) <= 7) ? 1 : (((p) <= 15) ? 3 : (((p) <= 23) ? 2 : 0)))
65 #define digitalPinToPCMSK(p) (((p) <= 7) ? (&PCMSK2) : (((p) <= 13) ? (&PCMSK0) : (((p) <= 21) ? (&PCMSK1) : ((uint8_t *)0))))
66 #define digitalPinToPCMSKbit(p) ((p) % 8)
67
68 #ifdef ARDUINO_MAIN
69
70 #define PA 1
71 #define PB 2
72 #define PC 3
73 #define PD 4
74
75 // these arrays map port names (e.g. port B) to the
76 // appropriate addresses for various functions (e.g. reading
77 // and writing)
78 const uint16_t PROGMEM port_to_mode_PGM[] =
79 {
80 NOT_A_PORT,
81 (uint16_t) &DDRA,
82 (uint16_t) &DDRB,
83 (uint16_t) &DDRC,
84 (uint16_t) &DDRD,
85 };
86
87 const uint16_t PROGMEM port_to_output_PGM[] =
88 {
89 NOT_A_PORT,
90 (uint16_t) &PORTA,
91 (uint16_t) &PORTB,
92 (uint16_t) &PORTC,
93 (uint16_t) &PORTD,
94 };
95
96 const uint16_t PROGMEM port_to_input_PGM[] =
97 {
98 NOT_A_PORT,
99 (uint16_t) &PINA,
100 (uint16_t) &PINB,
101 (uint16_t) &PINC,
102 (uint16_t) &PIND,
103 };
104
105 const uint8_t PROGMEM digital_pin_to_port_PGM[] =
106 {
107 PB, /* 0 */
108 PB,
109 PB,
110 PB,
111 PB,
112 PB,
113 PB,
114 PB,
115 PD, /* 8 */
116 PD,
117 PD,
118 PD,
119 PD,
120 PD,
121 PD,
122 PD,
123 PC, /* 16 */
124 PC,
125 PC,
126 PC,
127 PC,
128 PC,
129 PC,
130 PC,
131 PA, /* 24 */
132 PA,
133 PA,
134 PA,
135 PA,
136 PA,
137 PA,
138 PA /* 31 */
139 };
140
141 const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
142 {
143 _BV(0), /* 0, port B */
144 _BV(1),
145 _BV(2),
146 _BV(3),
147 _BV(4),
148 _BV(5),
149 _BV(6),
150 _BV(7),
151 _BV(0), /* 8, port D */
152 _BV(1),
153 _BV(2),
154 _BV(3),
155 _BV(4),
156 _BV(5),
157 _BV(6),
158 _BV(7),
159 _BV(0), /* 16, port C */
160 _BV(1),
161 _BV(2),
162 _BV(3),
163 _BV(4),
164 _BV(5),
165 _BV(6),
166 _BV(7),
167 _BV(0), /* 24, port A */
168 _BV(1),
169 _BV(2),
170 _BV(3),
171 _BV(4),
172 _BV(5),
173 _BV(6),
174 _BV(7)
175 };
176
177 const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
178 {
179 NOT_ON_TIMER, /* 0 - PB0 */
180 NOT_ON_TIMER, /* 1 - PB1 */
181 NOT_ON_TIMER, /* 2 - PB2 */
182 TIMER0A, /* 3 - PB3 */
183 TIMER0B, /* 4 - PB4 */
184 NOT_ON_TIMER, /* 5 - PB5 */
185 TIMER3A, /* 6 - PB6 */
186 TIMER3B, /* 7 - PB7 */
187 NOT_ON_TIMER, /* 8 - PD0 */
188 NOT_ON_TIMER, /* 9 - PD1 */
189 NOT_ON_TIMER, /* 10 - PD2 */
190 NOT_ON_TIMER, /* 11 - PD3 */
191 TIMER1B, /* 12 - PD4 */
192 TIMER1A, /* 13 - PD5 */
193 TIMER2B, /* 14 - PD6 */
194 TIMER2A, /* 15 - PD7 */
195 NOT_ON_TIMER, /* 16 - PC0 */
196 NOT_ON_TIMER, /* 17 - PC1 */
197 NOT_ON_TIMER, /* 18 - PC2 */
198 NOT_ON_TIMER, /* 19 - PC3 */
199 NOT_ON_TIMER, /* 20 - PC4 */
200 NOT_ON_TIMER, /* 21 - PC5 */
201 NOT_ON_TIMER, /* 22 - PC6 */
202 NOT_ON_TIMER, /* 23 - PC7 */
203 NOT_ON_TIMER, /* 24 - PA0 */
204 NOT_ON_TIMER, /* 25 - PA1 */
205 NOT_ON_TIMER, /* 26 - PA2 */
206 NOT_ON_TIMER, /* 27 - PA3 */
207 NOT_ON_TIMER, /* 28 - PA4 */
208 NOT_ON_TIMER, /* 29 - PA5 */
209 NOT_ON_TIMER, /* 30 - PA6 */
210 NOT_ON_TIMER /* 31 - PA7 */
211 };
212
213 #endif // ARDUINO_MAIN
214
215 #endif // Pins_Arduino_h
216 // vim:ai:cin:sts=2 sw=2 ft=cpp