My Marlin configs for Fabrikator Mini and CTC i3 Pro B
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

fastio_644.h 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. /**
  2. * Marlin 3D Printer Firmware
  3. * Copyright (c) 2020 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 <https://www.gnu.org/licenses/>.
  20. *
  21. */
  22. #pragma once
  23. /**
  24. * Pin mapping for the 644, 644p, 644pa, and 1284p
  25. *
  26. * Logical Pin: 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
  27. * Port: B0 B1 B2 B3 B4 B5 B6 B7 D0 D1 D2 D3 D4 D5 D6 D7 C0 C1 C2 C3 C4 C5 C6 C7 A7 A6 A5 A4 A3 A2 A1 A0
  28. */
  29. /** ATMega644
  30. *
  31. * +---\/---+
  32. * (D 0) PB0 1| |40 PA0 (AI 0 / D31)
  33. * (D 1) PB1 2| |39 PA1 (AI 1 / D30)
  34. * INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29)
  35. * PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
  36. * PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27)
  37. * MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
  38. * MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
  39. * SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
  40. * RST 9| |32 AREF
  41. * VCC 10| |31 GND
  42. * GND 11| |30 AVCC
  43. * XTAL2 12| |29 PC7 (D 23)
  44. * XTAL1 13| |28 PC6 (D 22)
  45. * RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
  46. * TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
  47. * INT0 RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
  48. * INT1 TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
  49. * PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
  50. * PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
  51. * PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
  52. * +--------+
  53. */
  54. #include "../fastio.h"
  55. #define DEBUG_LED DIO0
  56. // UART
  57. #define RXD DIO8
  58. #define TXD DIO9
  59. #define RXD0 DIO8
  60. #define TXD0 DIO9
  61. #define RXD1 DIO10
  62. #define TXD1 DIO11
  63. // SPI
  64. #define SCK DIO7
  65. #define MISO DIO6
  66. #define MOSI DIO5
  67. #define SS DIO4
  68. // TWI (I2C)
  69. #define SCL DIO16
  70. #define SDA DIO17
  71. // Timers and PWM
  72. #define OC0A DIO3
  73. #define OC0B DIO4
  74. #define OC1A DIO13
  75. #define OC1B DIO12
  76. #define OC2A DIO15
  77. #define OC2B DIO14
  78. // Digital I/O
  79. #define DIO0_PIN PINB0
  80. #define DIO0_RPORT PINB
  81. #define DIO0_WPORT PORTB
  82. #define DIO0_DDR DDRB
  83. #define DIO0_PWM nullptr
  84. #define DIO1_PIN PINB1
  85. #define DIO1_RPORT PINB
  86. #define DIO1_WPORT PORTB
  87. #define DIO1_DDR DDRB
  88. #define DIO1_PWM nullptr
  89. #define DIO2_PIN PINB2
  90. #define DIO2_RPORT PINB
  91. #define DIO2_WPORT PORTB
  92. #define DIO2_DDR DDRB
  93. #define DIO2_PWM nullptr
  94. #define DIO3_PIN PINB3
  95. #define DIO3_RPORT PINB
  96. #define DIO3_WPORT PORTB
  97. #define DIO3_DDR DDRB
  98. #define DIO3_PWM &OCR0A
  99. #define DIO4_PIN PINB4
  100. #define DIO4_RPORT PINB
  101. #define DIO4_WPORT PORTB
  102. #define DIO4_DDR DDRB
  103. #define DIO4_PWM &OCR0B
  104. #define DIO5_PIN PINB5
  105. #define DIO5_RPORT PINB
  106. #define DIO5_WPORT PORTB
  107. #define DIO5_DDR DDRB
  108. #define DIO5_PWM nullptr
  109. #define DIO6_PIN PINB6
  110. #define DIO6_RPORT PINB
  111. #define DIO6_WPORT PORTB
  112. #define DIO6_DDR DDRB
  113. #define DIO6_PWM nullptr
  114. #define DIO7_PIN PINB7
  115. #define DIO7_RPORT PINB
  116. #define DIO7_WPORT PORTB
  117. #define DIO7_DDR DDRB
  118. #define DIO7_PWM nullptr
  119. #define DIO8_PIN PIND0
  120. #define DIO8_RPORT PIND
  121. #define DIO8_WPORT PORTD
  122. #define DIO8_DDR DDRD
  123. #define DIO8_PWM nullptr
  124. #define DIO9_PIN PIND1
  125. #define DIO9_RPORT PIND
  126. #define DIO9_WPORT PORTD
  127. #define DIO9_DDR DDRD
  128. #define DIO9_PWM nullptr
  129. #define DIO10_PIN PIND2
  130. #define DIO10_RPORT PIND
  131. #define DIO10_WPORT PORTD
  132. #define DIO10_DDR DDRD
  133. #define DIO10_PWM nullptr
  134. #define DIO11_PIN PIND3
  135. #define DIO11_RPORT PIND
  136. #define DIO11_WPORT PORTD
  137. #define DIO11_DDR DDRD
  138. #define DIO11_PWM nullptr
  139. #define DIO12_PIN PIND4
  140. #define DIO12_RPORT PIND
  141. #define DIO12_WPORT PORTD
  142. #define DIO12_DDR DDRD
  143. #define DIO12_PWM &OCR1B
  144. #define DIO13_PIN PIND5
  145. #define DIO13_RPORT PIND
  146. #define DIO13_WPORT PORTD
  147. #define DIO13_DDR DDRD
  148. #define DIO13_PWM &OCR1A
  149. #define DIO14_PIN PIND6
  150. #define DIO14_RPORT PIND
  151. #define DIO14_WPORT PORTD
  152. #define DIO14_DDR DDRD
  153. #define DIO14_PWM &OCR2B
  154. #define DIO15_PIN PIND7
  155. #define DIO15_RPORT PIND
  156. #define DIO15_WPORT PORTD
  157. #define DIO15_DDR DDRD
  158. #define DIO15_PWM &OCR2A
  159. #define DIO16_PIN PINC0
  160. #define DIO16_RPORT PINC
  161. #define DIO16_WPORT PORTC
  162. #define DIO16_DDR DDRC
  163. #define DIO16_PWM nullptr
  164. #define DIO17_PIN PINC1
  165. #define DIO17_RPORT PINC
  166. #define DIO17_WPORT PORTC
  167. #define DIO17_DDR DDRC
  168. #define DIO17_PWM nullptr
  169. #define DIO18_PIN PINC2
  170. #define DIO18_RPORT PINC
  171. #define DIO18_WPORT PORTC
  172. #define DIO18_DDR DDRC
  173. #define DIO18_PWM nullptr
  174. #define DIO19_PIN PINC3
  175. #define DIO19_RPORT PINC
  176. #define DIO19_WPORT PORTC
  177. #define DIO19_DDR DDRC
  178. #define DIO19_PWM nullptr
  179. #define DIO20_PIN PINC4
  180. #define DIO20_RPORT PINC
  181. #define DIO20_WPORT PORTC
  182. #define DIO20_DDR DDRC
  183. #define DIO20_PWM nullptr
  184. #define DIO21_PIN PINC5
  185. #define DIO21_RPORT PINC
  186. #define DIO21_WPORT PORTC
  187. #define DIO21_DDR DDRC
  188. #define DIO21_PWM nullptr
  189. #define DIO22_PIN PINC6
  190. #define DIO22_RPORT PINC
  191. #define DIO22_WPORT PORTC
  192. #define DIO22_DDR DDRC
  193. #define DIO22_PWM nullptr
  194. #define DIO23_PIN PINC7
  195. #define DIO23_RPORT PINC
  196. #define DIO23_WPORT PORTC
  197. #define DIO23_DDR DDRC
  198. #define DIO23_PWM nullptr
  199. #define DIO24_PIN PINA7
  200. #define DIO24_RPORT PINA
  201. #define DIO24_WPORT PORTA
  202. #define DIO24_DDR DDRA
  203. #define DIO24_PWM nullptr
  204. #define DIO25_PIN PINA6
  205. #define DIO25_RPORT PINA
  206. #define DIO25_WPORT PORTA
  207. #define DIO25_DDR DDRA
  208. #define DIO25_PWM nullptr
  209. #define DIO26_PIN PINA5
  210. #define DIO26_RPORT PINA
  211. #define DIO26_WPORT PORTA
  212. #define DIO26_DDR DDRA
  213. #define DIO26_PWM nullptr
  214. #define DIO27_PIN PINA4
  215. #define DIO27_RPORT PINA
  216. #define DIO27_WPORT PORTA
  217. #define DIO27_DDR DDRA
  218. #define DIO27_PWM nullptr
  219. #define DIO28_PIN PINA3
  220. #define DIO28_RPORT PINA
  221. #define DIO28_WPORT PORTA
  222. #define DIO28_DDR DDRA
  223. #define DIO28_PWM nullptr
  224. #define DIO29_PIN PINA2
  225. #define DIO29_RPORT PINA
  226. #define DIO29_WPORT PORTA
  227. #define DIO29_DDR DDRA
  228. #define DIO29_PWM nullptr
  229. #define DIO30_PIN PINA1
  230. #define DIO30_RPORT PINA
  231. #define DIO30_WPORT PORTA
  232. #define DIO30_DDR DDRA
  233. #define DIO30_PWM nullptr
  234. #define DIO31_PIN PINA0
  235. #define DIO31_RPORT PINA
  236. #define DIO31_WPORT PORTA
  237. #define DIO31_DDR DDRA
  238. #define DIO31_PWM nullptr
  239. #define AIO0_PIN PINA0
  240. #define AIO0_RPORT PINA
  241. #define AIO0_WPORT PORTA
  242. #define AIO0_DDR DDRA
  243. #define AIO0_PWM nullptr
  244. #define AIO1_PIN PINA1
  245. #define AIO1_RPORT PINA
  246. #define AIO1_WPORT PORTA
  247. #define AIO1_DDR DDRA
  248. #define AIO1_PWM nullptr
  249. #define AIO2_PIN PINA2
  250. #define AIO2_RPORT PINA
  251. #define AIO2_WPORT PORTA
  252. #define AIO2_DDR DDRA
  253. #define AIO2_PWM nullptr
  254. #define AIO3_PIN PINA3
  255. #define AIO3_RPORT PINA
  256. #define AIO3_WPORT PORTA
  257. #define AIO3_DDR DDRA
  258. #define AIO3_PWM nullptr
  259. #define AIO4_PIN PINA4
  260. #define AIO4_RPORT PINA
  261. #define AIO4_WPORT PORTA
  262. #define AIO4_DDR DDRA
  263. #define AIO4_PWM nullptr
  264. #define AIO5_PIN PINA5
  265. #define AIO5_RPORT PINA
  266. #define AIO5_WPORT PORTA
  267. #define AIO5_DDR DDRA
  268. #define AIO5_PWM nullptr
  269. #define AIO6_PIN PINA6
  270. #define AIO6_RPORT PINA
  271. #define AIO6_WPORT PORTA
  272. #define AIO6_DDR DDRA
  273. #define AIO6_PWM nullptr
  274. #define AIO7_PIN PINA7
  275. #define AIO7_RPORT PINA
  276. #define AIO7_WPORT PORTA
  277. #define AIO7_DDR DDRA
  278. #define AIO7_PWM nullptr
  279. #undef PA0
  280. #define PA0_PIN PINA0
  281. #define PA0_RPORT PINA
  282. #define PA0_WPORT PORTA
  283. #define PA0_DDR DDRA
  284. #define PA0_PWM nullptr
  285. #undef PA1
  286. #define PA1_PIN PINA1
  287. #define PA1_RPORT PINA
  288. #define PA1_WPORT PORTA
  289. #define PA1_DDR DDRA
  290. #define PA1_PWM nullptr
  291. #undef PA2
  292. #define PA2_PIN PINA2
  293. #define PA2_RPORT PINA
  294. #define PA2_WPORT PORTA
  295. #define PA2_DDR DDRA
  296. #define PA2_PWM nullptr
  297. #undef PA3
  298. #define PA3_PIN PINA3
  299. #define PA3_RPORT PINA
  300. #define PA3_WPORT PORTA
  301. #define PA3_DDR DDRA
  302. #define PA3_PWM nullptr
  303. #undef PA4
  304. #define PA4_PIN PINA4
  305. #define PA4_RPORT PINA
  306. #define PA4_WPORT PORTA
  307. #define PA4_DDR DDRA
  308. #define PA4_PWM nullptr
  309. #undef PA5
  310. #define PA5_PIN PINA5
  311. #define PA5_RPORT PINA
  312. #define PA5_WPORT PORTA
  313. #define PA5_DDR DDRA
  314. #define PA5_PWM nullptr
  315. #undef PA6
  316. #define PA6_PIN PINA6
  317. #define PA6_RPORT PINA
  318. #define PA6_WPORT PORTA
  319. #define PA6_DDR DDRA
  320. #define PA6_PWM nullptr
  321. #undef PA7
  322. #define PA7_PIN PINA7
  323. #define PA7_RPORT PINA
  324. #define PA7_WPORT PORTA
  325. #define PA7_DDR DDRA
  326. #define PA7_PWM nullptr
  327. #undef PB0
  328. #define PB0_PIN PINB0
  329. #define PB0_RPORT PINB
  330. #define PB0_WPORT PORTB
  331. #define PB0_DDR DDRB
  332. #define PB0_PWM nullptr
  333. #undef PB1
  334. #define PB1_PIN PINB1
  335. #define PB1_RPORT PINB
  336. #define PB1_WPORT PORTB
  337. #define PB1_DDR DDRB
  338. #define PB1_PWM nullptr
  339. #undef PB2
  340. #define PB2_PIN PINB2
  341. #define PB2_RPORT PINB
  342. #define PB2_WPORT PORTB
  343. #define PB2_DDR DDRB
  344. #define PB2_PWM nullptr
  345. #undef PB3
  346. #define PB3_PIN PINB3
  347. #define PB3_RPORT PINB
  348. #define PB3_WPORT PORTB
  349. #define PB3_DDR DDRB
  350. #define PB3_PWM &OCR0A
  351. #undef PB4
  352. #define PB4_PIN PINB4
  353. #define PB4_RPORT PINB
  354. #define PB4_WPORT PORTB
  355. #define PB4_DDR DDRB
  356. #define PB4_PWM &OCR0B
  357. #undef PB5
  358. #define PB5_PIN PINB5
  359. #define PB5_RPORT PINB
  360. #define PB5_WPORT PORTB
  361. #define PB5_DDR DDRB
  362. #define PB5_PWM nullptr
  363. #undef PB6
  364. #define PB6_PIN PINB6
  365. #define PB6_RPORT PINB
  366. #define PB6_WPORT PORTB
  367. #define PB6_DDR DDRB
  368. #define PB6_PWM nullptr
  369. #undef PB7
  370. #define PB7_PIN PINB7
  371. #define PB7_RPORT PINB
  372. #define PB7_WPORT PORTB
  373. #define PB7_DDR DDRB
  374. #define PB7_PWM nullptr
  375. #undef PC0
  376. #define PC0_PIN PINC0
  377. #define PC0_RPORT PINC
  378. #define PC0_WPORT PORTC
  379. #define PC0_DDR DDRC
  380. #define PC0_PWM nullptr
  381. #undef PC1
  382. #define PC1_PIN PINC1
  383. #define PC1_RPORT PINC
  384. #define PC1_WPORT PORTC
  385. #define PC1_DDR DDRC
  386. #define PC1_PWM nullptr
  387. #undef PC2
  388. #define PC2_PIN PINC2
  389. #define PC2_RPORT PINC
  390. #define PC2_WPORT PORTC
  391. #define PC2_DDR DDRC
  392. #define PC2_PWM nullptr
  393. #undef PC3
  394. #define PC3_PIN PINC3
  395. #define PC3_RPORT PINC
  396. #define PC3_WPORT PORTC
  397. #define PC3_DDR DDRC
  398. #define PC3_PWM nullptr
  399. #undef PC4
  400. #define PC4_PIN PINC4
  401. #define PC4_RPORT PINC
  402. #define PC4_WPORT PORTC
  403. #define PC4_DDR DDRC
  404. #define PC4_PWM nullptr
  405. #undef PC5
  406. #define PC5_PIN PINC5
  407. #define PC5_RPORT PINC
  408. #define PC5_WPORT PORTC
  409. #define PC5_DDR DDRC
  410. #define PC5_PWM nullptr
  411. #undef PC6
  412. #define PC6_PIN PINC6
  413. #define PC6_RPORT PINC
  414. #define PC6_WPORT PORTC
  415. #define PC6_DDR DDRC
  416. #define PC6_PWM nullptr
  417. #undef PC7
  418. #define PC7_PIN PINC7
  419. #define PC7_RPORT PINC
  420. #define PC7_WPORT PORTC
  421. #define PC7_DDR DDRC
  422. #define PC7_PWM nullptr
  423. #undef PD0
  424. #define PD0_PIN PIND0
  425. #define PD0_RPORT PIND
  426. #define PD0_WPORT PORTD
  427. #define PD0_DDR DDRD
  428. #define PD0_PWM nullptr
  429. #undef PD1
  430. #define PD1_PIN PIND1
  431. #define PD1_RPORT PIND
  432. #define PD1_WPORT PORTD
  433. #define PD1_DDR DDRD
  434. #define PD1_PWM nullptr
  435. #undef PD2
  436. #define PD2_PIN PIND2
  437. #define PD2_RPORT PIND
  438. #define PD2_WPORT PORTD
  439. #define PD2_DDR DDRD
  440. #define PD2_PWM nullptr
  441. #undef PD3
  442. #define PD3_PIN PIND3
  443. #define PD3_RPORT PIND
  444. #define PD3_WPORT PORTD
  445. #define PD3_DDR DDRD
  446. #define PD3_PWM nullptr
  447. #undef PD4
  448. #define PD4_PIN PIND4
  449. #define PD4_RPORT PIND
  450. #define PD4_WPORT PORTD
  451. #define PD4_DDR DDRD
  452. #define PD4_PWM nullptr
  453. #undef PD5
  454. #define PD5_PIN PIND5
  455. #define PD5_RPORT PIND
  456. #define PD5_WPORT PORTD
  457. #define PD5_DDR DDRD
  458. #define PD5_PWM nullptr
  459. #undef PD6
  460. #define PD6_PIN PIND6
  461. #define PD6_RPORT PIND
  462. #define PD6_WPORT PORTD
  463. #define PD6_DDR DDRD
  464. #define PD6_PWM &OCR2B
  465. #undef PD7
  466. #define PD7_PIN PIND7
  467. #define PD7_RPORT PIND
  468. #define PD7_WPORT PORTD
  469. #define PD7_DDR DDRD
  470. #define PD7_PWM &OCR2A