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.

pins_arduino.c 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  1. /*
  2. pins_arduino.c - pin definitions for the Arduino board
  3. Part of Arduino / Wiring Lite
  4. Copyright (c) 2005 David A. Mellis
  5. This library is free software; you can redistribute it and/or
  6. modify it under the terms of the GNU Lesser General Public
  7. License as published by the Free Software Foundation; either
  8. version 2.1 of the License, or (at your option) any later version.
  9. This library is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. Lesser General Public License for more details.
  13. You should have received a copy of the GNU Lesser General
  14. Public License along with this library; if not, write to the
  15. Free Software Foundation, Inc., 59 Temple Place, Suite 330,
  16. Boston, MA 02111-1307 USA
  17. $Id: pins_arduino.c 254 2007-04-20 23:17:38Z mellis $
  18. */
  19. #include <avr/io.h>
  20. #include "wiring_private.h"
  21. #include "pins_arduino.h"
  22. // On the Sanguino board, digital pins are also used
  23. // for the analog output (software PWM). Analog input
  24. // pins are a separate set.
  25. // ATMEL ATMEGA644P / SANGUINO
  26. //
  27. // +---\/---+
  28. // INT0 (D 0) PB0 1| |40 PA0 (AI 0 / D31)
  29. // INT1 (D 1) PB1 2| |39 PA1 (AI 1 / D30)
  30. // INT2 (D 2) PB2 3| |38 PA2 (AI 2 / D29)
  31. // PWM (D 3) PB3 4| |37 PA3 (AI 3 / D28)
  32. // PWM (D 4) PB4 5| |36 PA4 (AI 4 / D27)
  33. // MOSI (D 5) PB5 6| |35 PA5 (AI 5 / D26)
  34. // MISO (D 6) PB6 7| |34 PA6 (AI 6 / D25)
  35. // SCK (D 7) PB7 8| |33 PA7 (AI 7 / D24)
  36. // RST 9| |32 AREF
  37. // VCC 10| |31 GND
  38. // GND 11| |30 AVCC
  39. // XTAL2 12| |29 PC7 (D 23)
  40. // XTAL1 13| |28 PC6 (D 22)
  41. // RX0 (D 8) PD0 14| |27 PC5 (D 21) TDI
  42. // TX0 (D 9) PD1 15| |26 PC4 (D 20) TDO
  43. // RX1 (D 10) PD2 16| |25 PC3 (D 19) TMS
  44. // TX1 (D 11) PD3 17| |24 PC2 (D 18) TCK
  45. // PWM (D 12) PD4 18| |23 PC1 (D 17) SDA
  46. // PWM (D 13) PD5 19| |22 PC0 (D 16) SCL
  47. // PWM (D 14) PD6 20| |21 PD7 (D 15) PWM
  48. // +--------+
  49. //
  50. #define PA 1
  51. #define PB 2
  52. #define PC 3
  53. #define PD 4
  54. // these arrays map port names (e.g. port B) to the
  55. // appropriate addresses for various functions (e.g. reading
  56. // and writing)
  57. const uint8_t PROGMEM port_to_mode_PGM[] =
  58. {
  59. NOT_A_PORT,
  60. (uint8_t) &DDRA,
  61. (uint8_t) &DDRB,
  62. (uint8_t) &DDRC,
  63. (uint8_t) &DDRD,
  64. };
  65. const uint8_t PROGMEM port_to_output_PGM[] =
  66. {
  67. NOT_A_PORT,
  68. (uint8_t) &PORTA,
  69. (uint8_t) &PORTB,
  70. (uint8_t) &PORTC,
  71. (uint8_t) &PORTD,
  72. };
  73. const uint8_t PROGMEM port_to_input_PGM[] =
  74. {
  75. NOT_A_PORT,
  76. (uint8_t) &PINA,
  77. (uint8_t) &PINB,
  78. (uint8_t) &PINC,
  79. (uint8_t) &PIND,
  80. };
  81. const uint8_t PROGMEM digital_pin_to_port_PGM[] =
  82. {
  83. PB, /* 0 */
  84. PB,
  85. PB,
  86. PB,
  87. PB,
  88. PB,
  89. PB,
  90. PB,
  91. PD, /* 8 */
  92. PD,
  93. PD,
  94. PD,
  95. PD,
  96. PD,
  97. PD,
  98. PD,
  99. PC, /* 16 */
  100. PC,
  101. PC,
  102. PC,
  103. PC,
  104. PC,
  105. PC,
  106. PC,
  107. PA, /* 24 */
  108. PA,
  109. PA,
  110. PA,
  111. PA,
  112. PA,
  113. PA,
  114. PA /* 31 */
  115. };
  116. const uint8_t PROGMEM digital_pin_to_bit_mask_PGM[] =
  117. {
  118. _BV(0), /* 0, port B */
  119. _BV(1),
  120. _BV(2),
  121. _BV(3),
  122. _BV(4),
  123. _BV(5),
  124. _BV(6),
  125. _BV(7),
  126. _BV(0), /* 8, port D */
  127. _BV(1),
  128. _BV(2),
  129. _BV(3),
  130. _BV(4),
  131. _BV(5),
  132. _BV(6),
  133. _BV(7),
  134. _BV(0), /* 16, port C */
  135. _BV(1),
  136. _BV(2),
  137. _BV(3),
  138. _BV(4),
  139. _BV(5),
  140. _BV(6),
  141. _BV(7),
  142. _BV(7), /* 24, port A */
  143. _BV(6),
  144. _BV(5),
  145. _BV(4),
  146. _BV(3),
  147. _BV(2),
  148. _BV(1),
  149. _BV(0)
  150. };
  151. const uint8_t PROGMEM digital_pin_to_timer_PGM[] =
  152. {
  153. NOT_ON_TIMER, /* 0 - PB0 */
  154. NOT_ON_TIMER, /* 1 - PB1 */
  155. NOT_ON_TIMER, /* 2 - PB2 */
  156. TIMER0A, /* 3 - PB3 */
  157. TIMER0B, /* 4 - PB4 */
  158. NOT_ON_TIMER, /* 5 - PB5 */
  159. NOT_ON_TIMER, /* 6 - PB6 */
  160. NOT_ON_TIMER, /* 7 - PB7 */
  161. NOT_ON_TIMER, /* 8 - PD0 */
  162. NOT_ON_TIMER, /* 9 - PD1 */
  163. NOT_ON_TIMER, /* 10 - PD2 */
  164. NOT_ON_TIMER, /* 11 - PD3 */
  165. TIMER1B, /* 12 - PD4 */
  166. TIMER1A, /* 13 - PD5 */
  167. TIMER2B, /* 14 - PD6 */
  168. TIMER2A, /* 15 - PD7 */
  169. NOT_ON_TIMER, /* 16 - PC0 */
  170. NOT_ON_TIMER, /* 17 - PC1 */
  171. NOT_ON_TIMER, /* 18 - PC2 */
  172. NOT_ON_TIMER, /* 19 - PC3 */
  173. NOT_ON_TIMER, /* 20 - PC4 */
  174. NOT_ON_TIMER, /* 21 - PC5 */
  175. NOT_ON_TIMER, /* 22 - PC6 */
  176. NOT_ON_TIMER, /* 23 - PC7 */
  177. NOT_ON_TIMER, /* 24 - PA0 */
  178. NOT_ON_TIMER, /* 25 - PA1 */
  179. NOT_ON_TIMER, /* 26 - PA2 */
  180. NOT_ON_TIMER, /* 27 - PA3 */
  181. NOT_ON_TIMER, /* 28 - PA4 */
  182. NOT_ON_TIMER, /* 29 - PA5 */
  183. NOT_ON_TIMER, /* 30 - PA6 */
  184. NOT_ON_TIMER /* 31 - PA7 */
  185. };