fastio_168.h 7.6 KB

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