Prusa MINI Firmware overview
fastio_168.h
Go to the documentation of this file.
1 /**
2  * Marlin 3D Printer Firmware
3  * Copyright (c) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4  *
5  * Based on Sprinter and grbl.
6  * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  *
21  */
22 #pragma once
23 
24 /**
25  * Pin mapping for the 168, 328, and 328P
26  *
27  * Logical Pin: 08 09 10 11 12 13 14 15 16 17 18 19 20 21 00 01 02 03 04 05 06 07
28  * Port: B0 B1 B2 B3 B4 B5 C0 C1 C2 C3 C4 C5 C6 C7 D0 D1 D2 D3 D4 D5 D6 D7
29  */
30 
31 #include "../fastio.h"
32 
33 #define DEBUG_LED AIO5
34 
35 // UART
36 #define RXD DIO0
37 #define TXD DIO1
38 
39 // SPI
40 #define SCK DIO13
41 #define MISO DIO12
42 #define MOSI DIO11
43 #define SS DIO10
44 
45 // TWI (I2C)
46 #define SCL AIO5
47 #define SDA AIO4
48 
49 // Timers and PWM
50 #define OC0A DIO6
51 #define OC0B DIO5
52 #define OC1A DIO9
53 #define OC1B DIO10
54 #define OC2A DIO11
55 #define OC2B DIO3
56 
57 // Digital I/O
58 
59 #define DIO0_PIN PIND0
60 #define DIO0_RPORT PIND
61 #define DIO0_WPORT PORTD
62 #define DIO0_DDR DDRD
63 #define DIO0_PWM nullptr
64 
65 #define DIO1_PIN PIND1
66 #define DIO1_RPORT PIND
67 #define DIO1_WPORT PORTD
68 #define DIO1_DDR DDRD
69 #define DIO1_PWM nullptr
70 
71 #define DIO2_PIN PIND2
72 #define DIO2_RPORT PIND
73 #define DIO2_WPORT PORTD
74 #define DIO2_DDR DDRD
75 #define DIO2_PWM nullptr
76 
77 #define DIO3_PIN PIND3
78 #define DIO3_RPORT PIND
79 #define DIO3_WPORT PORTD
80 #define DIO3_DDR DDRD
81 #define DIO3_PWM &OCR2B
82 
83 #define DIO4_PIN PIND4
84 #define DIO4_RPORT PIND
85 #define DIO4_WPORT PORTD
86 #define DIO4_DDR DDRD
87 #define DIO4_PWM nullptr
88 
89 #define DIO5_PIN PIND5
90 #define DIO5_RPORT PIND
91 #define DIO5_WPORT PORTD
92 #define DIO5_DDR DDRD
93 #define DIO5_PWM &OCR0B
94 
95 #define DIO6_PIN PIND6
96 #define DIO6_RPORT PIND
97 #define DIO6_WPORT PORTD
98 #define DIO6_DDR DDRD
99 #define DIO6_PWM &OCR0A
100 
101 #define DIO7_PIN PIND7
102 #define DIO7_RPORT PIND
103 #define DIO7_WPORT PORTD
104 #define DIO7_DDR DDRD
105 #define DIO7_PWM nullptr
106 
107 #define DIO8_PIN PINB0
108 #define DIO8_RPORT PINB
109 #define DIO8_WPORT PORTB
110 #define DIO8_DDR DDRB
111 #define DIO8_PWM nullptr
112 
113 #define DIO9_PIN PINB1
114 #define DIO9_RPORT PINB
115 #define DIO9_WPORT PORTB
116 #define DIO9_DDR DDRB
117 #define DIO9_PWM nullptr
118 
119 #define DIO10_PIN PINB2
120 #define DIO10_RPORT PINB
121 #define DIO10_WPORT PORTB
122 #define DIO10_DDR DDRB
123 #define DIO10_PWM nullptr
124 
125 #define DIO11_PIN PINB3
126 #define DIO11_RPORT PINB
127 #define DIO11_WPORT PORTB
128 #define DIO11_DDR DDRB
129 #define DIO11_PWM &OCR2A
130 
131 #define DIO12_PIN PINB4
132 #define DIO12_RPORT PINB
133 #define DIO12_WPORT PORTB
134 #define DIO12_DDR DDRB
135 #define DIO12_PWM nullptr
136 
137 #define DIO13_PIN PINB5
138 #define DIO13_RPORT PINB
139 #define DIO13_WPORT PORTB
140 #define DIO13_DDR DDRB
141 #define DIO13_PWM nullptr
142 
143 #define DIO14_PIN PINC0
144 #define DIO14_RPORT PINC
145 #define DIO14_WPORT PORTC
146 #define DIO14_DDR DDRC
147 #define DIO14_PWM nullptr
148 
149 #define DIO15_PIN PINC1
150 #define DIO15_RPORT PINC
151 #define DIO15_WPORT PORTC
152 #define DIO15_DDR DDRC
153 #define DIO15_PWM nullptr
154 
155 #define DIO16_PIN PINC2
156 #define DIO16_RPORT PINC
157 #define DIO16_WPORT PORTC
158 #define DIO16_DDR DDRC
159 #define DIO16_PWM nullptr
160 
161 #define DIO17_PIN PINC3
162 #define DIO17_RPORT PINC
163 #define DIO17_WPORT PORTC
164 #define DIO17_DDR DDRC
165 #define DIO17_PWM nullptr
166 
167 #define DIO18_PIN PINC4
168 #define DIO18_RPORT PINC
169 #define DIO18_WPORT PORTC
170 #define DIO18_DDR DDRC
171 #define DIO18_PWM nullptr
172 
173 #define DIO19_PIN PINC5
174 #define DIO19_RPORT PINC
175 #define DIO19_WPORT PORTC
176 #define DIO19_DDR DDRC
177 #define DIO19_PWM nullptr
178 
179 #define DIO20_PIN PINC6
180 #define DIO20_RPORT PINC
181 #define DIO20_WPORT PORTC
182 #define DIO20_DDR DDRC
183 #define DIO20_PWM nullptr
184 
185 #define DIO21_PIN PINC7
186 #define DIO21_RPORT PINC
187 #define DIO21_WPORT PORTC
188 #define DIO21_DDR DDRC
189 #define DIO21_PWM nullptr
190 
191 #undef PB0
192 #define PB0_PIN PINB0
193 #define PB0_RPORT PINB
194 #define PB0_WPORT PORTB
195 #define PB0_DDR DDRB
196 #define PB0_PWM nullptr
197 
198 #undef PB1
199 #define PB1_PIN PINB1
200 #define PB1_RPORT PINB
201 #define PB1_WPORT PORTB
202 #define PB1_DDR DDRB
203 #define PB1_PWM nullptr
204 
205 #undef PB2
206 #define PB2_PIN PINB2
207 #define PB2_RPORT PINB
208 #define PB2_WPORT PORTB
209 #define PB2_DDR DDRB
210 #define PB2_PWM nullptr
211 
212 #undef PB3
213 #define PB3_PIN PINB3
214 #define PB3_RPORT PINB
215 #define PB3_WPORT PORTB
216 #define PB3_DDR DDRB
217 #define PB3_PWM &OCR2A
218 
219 #undef PB4
220 #define PB4_PIN PINB4
221 #define PB4_RPORT PINB
222 #define PB4_WPORT PORTB
223 #define PB4_DDR DDRB
224 #define PB4_PWM nullptr
225 
226 #undef PB5
227 #define PB5_PIN PINB5
228 #define PB5_RPORT PINB
229 #define PB5_WPORT PORTB
230 #define PB5_DDR DDRB
231 #define PB5_PWM nullptr
232 
233 #undef PB6
234 #define PB6_PIN PINB6
235 #define PB6_RPORT PINB
236 #define PB6_WPORT PORTB
237 #define PB6_DDR DDRB
238 #define PB6_PWM nullptr
239 
240 #undef PB7
241 #define PB7_PIN PINB7
242 #define PB7_RPORT PINB
243 #define PB7_WPORT PORTB
244 #define PB7_DDR DDRB
245 #define PB7_PWM nullptr
246 
247 #undef PC0
248 #define PC0_PIN PINC0
249 #define PC0_RPORT PINC
250 #define PC0_WPORT PORTC
251 #define PC0_DDR DDRC
252 #define PC0_PWM nullptr
253 
254 #undef PC1
255 #define PC1_PIN PINC1
256 #define PC1_RPORT PINC
257 #define PC1_WPORT PORTC
258 #define PC1_DDR DDRC
259 #define PC1_PWM nullptr
260 
261 #undef PC2
262 #define PC2_PIN PINC2
263 #define PC2_RPORT PINC
264 #define PC2_WPORT PORTC
265 #define PC2_DDR DDRC
266 #define PC2_PWM nullptr
267 
268 #undef PC3
269 #define PC3_PIN PINC3
270 #define PC3_RPORT PINC
271 #define PC3_WPORT PORTC
272 #define PC3_DDR DDRC
273 #define PC3_PWM nullptr
274 
275 #undef PC4
276 #define PC4_PIN PINC4
277 #define PC4_RPORT PINC
278 #define PC4_WPORT PORTC
279 #define PC4_DDR DDRC
280 #define PC4_PWM nullptr
281 
282 #undef PC5
283 #define PC5_PIN PINC5
284 #define PC5_RPORT PINC
285 #define PC5_WPORT PORTC
286 #define PC5_DDR DDRC
287 #define PC5_PWM nullptr
288 
289 #undef PC6
290 #define PC6_PIN PINC6
291 #define PC6_RPORT PINC
292 #define PC6_WPORT PORTC
293 #define PC6_DDR DDRC
294 #define PC6_PWM nullptr
295 
296 #undef PC7
297 #define PC7_PIN PINC7
298 #define PC7_RPORT PINC
299 #define PC7_WPORT PORTC
300 #define PC7_DDR DDRC
301 #define PC7_PWM nullptr
302 
303 #undef PD0
304 #define PD0_PIN PIND0
305 #define PD0_RPORT PIND
306 #define PD0_WPORT PORTD
307 #define PD0_DDR DDRD
308 #define PD0_PWM nullptr
309 
310 #undef PD1
311 #define PD1_PIN PIND1
312 #define PD1_RPORT PIND
313 #define PD1_WPORT PORTD
314 #define PD1_DDR DDRD
315 #define PD1_PWM nullptr
316 
317 #undef PD2
318 #define PD2_PIN PIND2
319 #define PD2_RPORT PIND
320 #define PD2_WPORT PORTD
321 #define PD2_DDR DDRD
322 #define PD2_PWM nullptr
323 
324 #undef PD3
325 #define PD3_PIN PIND3
326 #define PD3_RPORT PIND
327 #define PD3_WPORT PORTD
328 #define PD3_DDR DDRD
329 #define PD3_PWM &OCR2B
330 
331 #undef PD4
332 #define PD4_PIN PIND4
333 #define PD4_RPORT PIND
334 #define PD4_WPORT PORTD
335 #define PD4_DDR DDRD
336 #define PD4_PWM nullptr
337 
338 #undef PD5
339 #define PD5_PIN PIND5
340 #define PD5_RPORT PIND
341 #define PD5_WPORT PORTD
342 #define PD5_DDR DDRD
343 #define PD5_PWM &OCR0B
344 
345 #undef PD6
346 #define PD6_PIN PIND6
347 #define PD6_RPORT PIND
348 #define PD6_WPORT PORTD
349 #define PD6_DDR DDRD
350 #define PD6_PWM &OCR0A
351 
352 #undef PD7
353 #define PD7_PIN PIND7
354 #define PD7_RPORT PIND
355 #define PD7_WPORT PORTD
356 #define PD7_DDR DDRD
357 #define PD7_PWM nullptr