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.

pinsDebug.h 5.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
  25. */
  26. #define NUMBER_PINS_TOTAL PINS_COUNT
  27. #define digitalRead_mod(p) extDigitalRead(p)
  28. #define PRINT_PORT(p) do{ SERIAL_ECHOPGM(" Port: "); sprintf_P(buffer, PSTR("%c%02ld"), 'A' + g_APinDescription[p].ulPort, g_APinDescription[p].ulPin); SERIAL_ECHO(buffer); }while (0)
  29. #define PRINT_ARRAY_NAME(x) do{ sprintf_P(buffer, PSTR("%-" STRINGIFY(MAX_NAME_LENGTH) "s"), pin_array[x].name); SERIAL_ECHO(buffer); }while(0)
  30. #define PRINT_PIN(p) do{ sprintf_P(buffer, PSTR("%3d "), p); SERIAL_ECHO(buffer); }while(0)
  31. #define PRINT_PIN_ANALOG(p) do{ sprintf_P(buffer, PSTR(" (A%2d) "), DIGITAL_PIN_TO_ANALOG_PIN(pin)); SERIAL_ECHO(buffer); }while(0)
  32. #define GET_ARRAY_PIN(p) pin_array[p].pin
  33. #define GET_ARRAY_IS_DIGITAL(p) pin_array[p].is_digital
  34. #define VALID_PIN(pin) (pin >= 0 && pin < int8_t(NUMBER_PINS_TOTAL))
  35. #define DIGITAL_PIN_TO_ANALOG_PIN(p) digitalPinToAnalogInput(p)
  36. #define IS_ANALOG(P) (DIGITAL_PIN_TO_ANALOG_PIN(P)!=-1)
  37. #define pwm_status(pin) digitalPinHasPWM(pin)
  38. #define MULTI_NAME_PAD 27 // space needed to be pretty if not first name assigned to a pin
  39. // pins that will cause hang/reset/disconnect in M43 Toggle and Watch utilities
  40. // uses pin index
  41. #define M43_NEVER_TOUCH(Q) ((Q) >= 75)
  42. bool GET_PINMODE(int8_t pin) { // 1: output, 0: input
  43. const EPortType samdport = g_APinDescription[pin].ulPort;
  44. const uint32_t samdpin = g_APinDescription[pin].ulPin;
  45. return PORT->Group[samdport].DIR.reg & MASK(samdpin) || (PORT->Group[samdport].PINCFG[samdpin].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN;
  46. }
  47. void pwm_details(int32_t pin) {
  48. if (pwm_status(pin)) {
  49. //uint32_t chan = g_APinDescription[pin].ulPWMChannel TODO when fast pwm is operative;
  50. //SERIAL_ECHOPGM("PWM = ", duty);
  51. }
  52. }
  53. /**
  54. * AGCM4 Board pin | PORT | Label
  55. * ----------------+--------+-------
  56. * 0 | PB25 | "RX0"
  57. * 1 | PB24 | "TX0"
  58. * 2 | PC18 |
  59. * 3 | PC19 |
  60. * 4 | PC20 |
  61. * 5 | PC21 |
  62. * 6 | PD20 |
  63. * 7 | PD21 |
  64. * 8 | PB18 |
  65. * 9 | PB2 |
  66. * 10 | PB22 |
  67. * 11 | PB23 |
  68. * 12 | PB0 | "A16"
  69. * 13 | PB1 | LED AMBER "L" / "A17"
  70. * 14 | PB16 | "TX3"
  71. * 15 | PB17 | "RX3"
  72. * 16 | PC22 | "TX2"
  73. * 17 | PC23 | "RX2"
  74. * 18 | PB12 | "TX1" / "A18"
  75. * 19 | PB13 | "RX1"
  76. * 20 | PB20 | "SDA"
  77. * 21 | PB21 | "SCL"
  78. * 22 | PD12 |
  79. * 23 | PA15 |
  80. * 24 | PC17 |
  81. * 25 | PC16 |
  82. * 26 | PA12 |
  83. * 27 | PA13 |
  84. * 28 | PA14 |
  85. * 29 | PB19 |
  86. * 30 | PA23 |
  87. * 31 | PA22 |
  88. * 32 | PA21 |
  89. * 33 | PA20 |
  90. * 34 | PA19 |
  91. * 35 | PA18 |
  92. * 36 | PA17 |
  93. * 37 | PA16 |
  94. * 38 | PB15 |
  95. * 39 | PB14 |
  96. * 40 | PC13 |
  97. * 41 | PC12 |
  98. * 42 | PC15 |
  99. * 43 | PC14 |
  100. * 44 | PC11 |
  101. * 45 | PC10 |
  102. * 46 | PC6 |
  103. * 47 | PC7 |
  104. * 48 | PC4 |
  105. * 49 | PC5 |
  106. * 50 | PD11 |
  107. * 51 | PD8 |
  108. * 52 | PD9 |
  109. * 53 | PD10 |
  110. * 54 | PB5 | "A8"
  111. * 55 | PB6 | "A9"
  112. * 56 | PB7 | "A10"
  113. * 57 | PB8 | "A11"
  114. * 58 | PB9 | "A12"
  115. * 69 | PA4 | "A13"
  116. * 60 | PA6 | "A14"
  117. * 61 | PA7 | "A15"
  118. * 62 | PB17 |
  119. * 63 | PB20 |
  120. * 64 | PD11 |
  121. * 65 | PD8 |
  122. * 66 | PD9 |
  123. * 67 | PA2 | "A0" / "DAC0"
  124. * 68 | PA5 | "A1" / "DAC1"
  125. * 69 | PB3 | "A2"
  126. * 70 | PC0 | "A3"
  127. * 71 | PC1 | "A4"
  128. * 72 | PC2 | "A5"
  129. * 73 | PC3 | "A6"
  130. * 74 | PB4 | "A7"
  131. * 75 | PC31 | LED GREEN "RX"
  132. * 76 | PC30 | LED GREEN "TX"
  133. * 77 | PA27 | USB: Host enable
  134. * 78 | PA24 | USB: D-
  135. * 79 | PA25 | USB: D+
  136. * 80 | PB29 | SD: MISO
  137. * 81 | PB27 | SD: SCK
  138. * 82 | PB26 | SD: MOSI
  139. * 83 | PB28 | SD: CS
  140. * 84 | PA3 | AREF
  141. * 85 | PA2 | DAC0 (Duplicate)
  142. * 86 | PA5 | DAC1 (Duplicate)
  143. * 87 | PB1 | LED AMBER "L" (Duplicate)
  144. * 88 | PC24 | NeoPixel
  145. * 89 | PB10 | QSPI: SCK
  146. * 90 | PB11 | QSPI: CS
  147. * 91 | PA8 | QSPI: IO0
  148. * 92 | PA9 | QSPI: IO1
  149. * 93 | PA10 | QSPI: IO2
  150. * 94 | PA11 | QSPI: IO3
  151. * 95 | PB31 | SD: DETECT
  152. */