Bladeren bron

Adafruit Grand Central M4 (#14749)

Giuliano Zaro 5 jaren geleden
bovenliggende
commit
290466578f
100 gewijzigde bestanden met toevoegingen van 2516 en 74 verwijderingen
  1. 1
    0
      .travis.yml
  2. 1
    1
      Marlin/Configuration_adv.h
  3. 2
    0
      Marlin/src/HAL/HAL.h
  4. 475
    0
      Marlin/src/HAL/HAL_SAMD51/HAL.cpp
  5. 141
    0
      Marlin/src/HAL/HAL_SAMD51/HAL.h
  6. 151
    0
      Marlin/src/HAL/HAL_SAMD51/HAL_spi_SAMD51.cpp
  7. 135
    0
      Marlin/src/HAL/HAL_SAMD51/HAL_timers_SAMD51.cpp
  8. 117
    0
      Marlin/src/HAL/HAL_SAMD51/HAL_timers_SAMD51.h
  9. 55
    0
      Marlin/src/HAL/HAL_SAMD51/MarlinSerial_AGCM4.cpp
  10. 25
    0
      Marlin/src/HAL/HAL_SAMD51/MarlinSerial_AGCM4.h
  11. 70
    0
      Marlin/src/HAL/HAL_SAMD51/SAMD51.h
  12. 48
    0
      Marlin/src/HAL/HAL_SAMD51/SanityCheck.h
  13. 59
    0
      Marlin/src/HAL/HAL_SAMD51/Tone.cpp
  14. 184
    0
      Marlin/src/HAL/HAL_SAMD51/endstop_interrupts.h
  15. 251
    0
      Marlin/src/HAL/HAL_SAMD51/fastio_SAMD51.h
  16. 129
    0
      Marlin/src/HAL/HAL_SAMD51/persistent_store_eeprom.cpp
  17. 153
    0
      Marlin/src/HAL/HAL_SAMD51/pinsDebug.h
  18. 54
    0
      Marlin/src/HAL/HAL_SAMD51/spi_pins.h
  19. 53
    0
      Marlin/src/HAL/HAL_SAMD51/watchdog_SAMD51.cpp
  20. 31
    0
      Marlin/src/HAL/HAL_SAMD51/watchdog_SAMD51.h
  21. 11
    0
      Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp
  22. 5
    0
      Marlin/src/core/boards.h
  23. 1
    1
      Marlin/src/core/drivers.h
  24. 15
    1
      Marlin/src/gcode/calibrate/M100.cpp
  25. 2
    0
      Marlin/src/inc/Conditionals_LCD.h
  26. 7
    0
      Marlin/src/pins/pins.h
  27. 1
    1
      Marlin/src/pins/pinsDebug_list.h
  28. 254
    0
      Marlin/src/pins/samd/pins_AGCM4_RURAMPS4D_13.h
  29. 2
    1
      README.md
  30. 14
    0
      buildroot/share/tests/adafruit_grandcentral_m4-tests
  31. 1
    1
      config/default/Configuration_adv.h
  32. 1
    1
      config/examples/3DFabXYZ/Migbot/Configuration_adv.h
  33. 1
    1
      config/examples/AlephObjects/TAZ4/Configuration_adv.h
  34. 1
    1
      config/examples/Alfawise/U20/Configuration_adv.h
  35. 1
    1
      config/examples/AliExpress/UM2pExt/Configuration_adv.h
  36. 1
    1
      config/examples/Anet/A2/Configuration_adv.h
  37. 1
    1
      config/examples/Anet/A2plus/Configuration_adv.h
  38. 1
    1
      config/examples/Anet/A6/Configuration_adv.h
  39. 1
    1
      config/examples/Anet/A8/Configuration_adv.h
  40. 1
    1
      config/examples/Anet/A8plus/Configuration_adv.h
  41. 1
    1
      config/examples/Anet/E16/Configuration_adv.h
  42. 1
    1
      config/examples/AnyCubic/i3/Configuration_adv.h
  43. 1
    1
      config/examples/ArmEd/Configuration_adv.h
  44. 1
    1
      config/examples/BIBO/TouchX/cyclops/Configuration_adv.h
  45. 1
    1
      config/examples/BIBO/TouchX/default/Configuration_adv.h
  46. 1
    1
      config/examples/BQ/Hephestos/Configuration_adv.h
  47. 1
    1
      config/examples/BQ/Hephestos_2/Configuration_adv.h
  48. 1
    1
      config/examples/BQ/WITBOX/Configuration_adv.h
  49. 1
    1
      config/examples/Cartesio/Configuration_adv.h
  50. 1
    1
      config/examples/Creality/CR-10/Configuration_adv.h
  51. 1
    1
      config/examples/Creality/CR-10S/Configuration_adv.h
  52. 1
    1
      config/examples/Creality/CR-10_5S/Configuration_adv.h
  53. 1
    1
      config/examples/Creality/CR-10mini/Configuration_adv.h
  54. 1
    1
      config/examples/Creality/CR-20 Pro/Configuration_adv.h
  55. 1
    1
      config/examples/Creality/CR-20/Configuration_adv.h
  56. 1
    1
      config/examples/Creality/CR-8/Configuration_adv.h
  57. 1
    1
      config/examples/Creality/Ender-2/Configuration_adv.h
  58. 1
    1
      config/examples/Creality/Ender-3/Configuration_adv.h
  59. 1
    1
      config/examples/Creality/Ender-4/Configuration_adv.h
  60. 1
    1
      config/examples/Creality/Ender-5/Configuration_adv.h
  61. 1
    1
      config/examples/Dagoma/Disco Ultimate/Configuration_adv.h
  62. 1
    1
      config/examples/EVNOVO (Artillery)/Sidewinder X1/Configuration_adv.h
  63. 1
    1
      config/examples/Einstart-S/Configuration_adv.h
  64. 1
    1
      config/examples/FYSETC/AIO_II/Configuration_adv.h
  65. 1
    1
      config/examples/FYSETC/Cheetah/BLTouch/Configuration_adv.h
  66. 1
    1
      config/examples/FYSETC/Cheetah/base/Configuration_adv.h
  67. 1
    1
      config/examples/FYSETC/F6_13/Configuration_adv.h
  68. 1
    1
      config/examples/Felix/Configuration_adv.h
  69. 1
    1
      config/examples/FlashForge/CreatorPro/Configuration_adv.h
  70. 1
    1
      config/examples/FolgerTech/i3-2020/Configuration_adv.h
  71. 1
    1
      config/examples/Formbot/Raptor/Configuration_adv.h
  72. 1
    1
      config/examples/Formbot/T_Rex_2+/Configuration_adv.h
  73. 1
    1
      config/examples/Formbot/T_Rex_3/Configuration_adv.h
  74. 1
    1
      config/examples/Geeetech/A10/Configuration_adv.h
  75. 1
    1
      config/examples/Geeetech/A10M/Configuration_adv.h
  76. 1
    1
      config/examples/Geeetech/A20M/Configuration_adv.h
  77. 1
    1
      config/examples/Geeetech/MeCreator2/Configuration_adv.h
  78. 1
    1
      config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h
  79. 1
    1
      config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h
  80. 1
    1
      config/examples/Infitary/i3-M508/Configuration_adv.h
  81. 1
    1
      config/examples/JGAurora/A1/Configuration_adv.h
  82. 1
    1
      config/examples/JGAurora/A5/Configuration_adv.h
  83. 1
    1
      config/examples/JGAurora/A5S/Configuration_adv.h
  84. 1
    1
      config/examples/MakerParts/Configuration_adv.h
  85. 1
    1
      config/examples/Malyan/M150/Configuration_adv.h
  86. 1
    1
      config/examples/Malyan/M200/Configuration_adv.h
  87. 1
    1
      config/examples/Micromake/C1/enhanced/Configuration_adv.h
  88. 1
    1
      config/examples/Mks/Robin/Configuration_adv.h
  89. 1
    1
      config/examples/Mks/Sbase/Configuration_adv.h
  90. 1
    1
      config/examples/RapideLite/RL200/Configuration_adv.h
  91. 1
    1
      config/examples/RigidBot/Configuration_adv.h
  92. 1
    1
      config/examples/SCARA/Configuration_adv.h
  93. 1
    1
      config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h
  94. 1
    1
      config/examples/Sanguinololu/Configuration_adv.h
  95. 1
    1
      config/examples/Tevo/Michelangelo/Configuration_adv.h
  96. 1
    1
      config/examples/Tevo/Tarantula Pro/Configuration_adv.h
  97. 1
    1
      config/examples/Tevo/Tornado/V1 (MKS Base)/Configuration_adv.h
  98. 1
    1
      config/examples/Tevo/Tornado/V2 (MKS GEN-L)/Configuration_adv.h
  99. 1
    1
      config/examples/TheBorg/Configuration_adv.h
  100. 0
    0
      config/examples/TinyBoy2/Configuration_adv.h

+ 1
- 0
.travis.yml Bestand weergeven

@@ -19,6 +19,7 @@ env:
19 19
   - TEST_PLATFORM="esp32"
20 20
   - TEST_PLATFORM="alfawise_U20"
21 21
   - TEST_PLATFORM="black_stm32f407ve"
22
+  - TEST_PLATFORM="adafruit_grandcentral_m4"
22 23
 
23 24
 before_install:
24 25
   #

+ 1
- 1
Marlin/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 2
- 0
Marlin/src/HAL/HAL.h Bestand weergeven

@@ -41,6 +41,8 @@
41 41
   #define HAL_PLATFORM HAL_ESP32
42 42
 #elif defined(__PLAT_LINUX__)
43 43
   #define HAL_PLATFORM HAL_LINUX
44
+#elif defined(__SAMD51__)
45
+  #define HAL_PLATFORM HAL_SAMD51
44 46
 #else
45 47
   #error "Unsupported Platform!"
46 48
 #endif

+ 475
- 0
Marlin/src/HAL/HAL_SAMD51/HAL.cpp Bestand weergeven

@@ -0,0 +1,475 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+#ifdef __SAMD51__
23
+
24
+#include "../../inc/MarlinConfig.h"
25
+#include "Adafruit_ZeroDMA.h"
26
+#include "wiring_private.h"
27
+
28
+// ------------------------
29
+// Local defines
30
+// ------------------------
31
+
32
+#if HAS_TEMP_ADC_0
33
+  #define GET_TEMP_0_ADC()          PIN_TO_ADC(TEMP_0_PIN)
34
+#else
35
+  #define GET_TEMP_0_ADC()          -1
36
+#endif
37
+#if HAS_TEMP_ADC_1
38
+  #define GET_TEMP_1_ADC()          PIN_TO_ADC(TEMP_1_PIN)
39
+#else
40
+  #define GET_TEMP_1_ADC()          -1
41
+#endif
42
+#if HAS_TEMP_ADC_2
43
+  #define GET_TEMP_2_ADC()          PIN_TO_ADC(TEMP_2_PIN)
44
+#else
45
+  #define GET_TEMP_2_ADC()          -1
46
+#endif
47
+#if HAS_TEMP_ADC_3
48
+  #define GET_TEMP_3_ADC()          PIN_TO_ADC(TEMP_3_PIN)
49
+#else
50
+  #define GET_TEMP_3_ADC()          -1
51
+#endif
52
+#if HAS_TEMP_ADC_4
53
+  #define GET_TEMP_4_ADC()          PIN_TO_ADC(TEMP_4_PIN)
54
+#else
55
+  #define GET_TEMP_4_ADC()          -1
56
+#endif
57
+#if HAS_TEMP_ADC_5
58
+  #define GET_TEMP_5_ADC()          PIN_TO_ADC(TEMP_5_PIN)
59
+#else
60
+  #define GET_TEMP_5_ADC()          -1
61
+#endif
62
+#if HAS_HEATED_BED
63
+  #define GET_BED_ADC()             PIN_TO_ADC(TEMP_BED_PIN)
64
+#else
65
+  #define GET_BED_ADC()             -1
66
+#endif
67
+#if HAS_HEATED_CHAMBER
68
+  #define GET_CHAMBER_ADC()         PIN_TO_ADC(TEMP_CHAMBER_PIN)
69
+#else
70
+  #define GET_CHAMBER_ADC()         -1
71
+#endif
72
+#if ENABLED(FILAMENT_WIDTH_SENSOR)
73
+  #define GET_FILAMENT_WIDTH_ADC()  PIN_TO_ADC(FILWIDTH_PIN)
74
+#else
75
+  #define GET_FILAMENT_WIDTH_ADC()  -1
76
+#endif
77
+#if HAS_ADC_BUTTONS
78
+  #define GET_BUTTONS_ADC()         PIN_TO_ADC(ADC_KEYPAD_PIN)
79
+#else
80
+  #define GET_BUTTONS_ADC()         -1
81
+#endif
82
+
83
+#define IS_ADC_REQUIRED(n)      (GET_TEMP_0_ADC() == n || GET_TEMP_1_ADC() == n || GET_TEMP_2_ADC() == n      \
84
+                                 || GET_TEMP_3_ADC() == n || GET_TEMP_4_ADC() == n || GET_TEMP_5_ADC() == n   \
85
+                                 || GET_BED_ADC() == n                                                        \
86
+                                 || GET_CHAMBER_ADC() == n                                                    \
87
+                                 || GET_FILAMENT_WIDTH_ADC() == n                                             \
88
+                                 || GET_BUTTONS_ADC() == n)
89
+
90
+#define ADC0_IS_REQUIRED    IS_ADC_REQUIRED(0)
91
+#define ADC1_IS_REQUIRED    IS_ADC_REQUIRED(1)
92
+#define ADC_IS_REQUIRED     (ADC0_IS_REQUIRED || ADC1_IS_REQUIRED)
93
+#if ADC0_IS_REQUIRED
94
+  #define FIRST_ADC     0
95
+#else
96
+  #define FIRST_ADC     1
97
+#endif
98
+#if ADC1_IS_REQUIRED
99
+  #define LAST_ADC      1
100
+#else
101
+  #define LAST_ADC      0
102
+#endif
103
+
104
+#define DMA_IS_REQUIRED     ADC_IS_REQUIRED
105
+
106
+// ------------------------
107
+// Types
108
+// ------------------------
109
+
110
+#if DMA_IS_REQUIRED
111
+
112
+  // Struct must be 32 bits aligned because of DMA accesses but fields needs to be 8 bits packed
113
+  typedef struct  __attribute__((aligned(4), packed)) {
114
+    ADC_INPUTCTRL_Type INPUTCTRL;
115
+  } HAL_DMA_DAC_Registers;    // DMA transfered registers
116
+
117
+#endif
118
+
119
+// ------------------------
120
+// Private Variables
121
+// ------------------------
122
+
123
+uint16_t HAL_adc_result;
124
+
125
+#if ADC_IS_REQUIRED
126
+
127
+  // Pins used by ADC inputs. Order must be ADC0 inputs first then ADC1
128
+  const uint8_t adc_pins[] = {
129
+    // ADC0 pins
130
+    #if GET_TEMP_0_ADC() == 0
131
+      TEMP_0_PIN,
132
+    #endif
133
+    #if GET_TEMP_1_ADC() == 0
134
+      TEMP_1_PIN,
135
+    #endif
136
+    #if GET_TEMP_2_ADC() == 0
137
+      TEMP_2_PIN,
138
+    #endif
139
+    #if GET_TEMP_3_ADC() == 0
140
+      TEMP_3_PIN,
141
+    #endif
142
+    #if GET_TEMP_4_ADC() == 0
143
+      TEMP_4_PIN,
144
+    #endif
145
+    #if GET_TEMP_5_ADC() == 0
146
+      TEMP_5_PIN,
147
+    #endif
148
+    #if GET_BED_ADC() == 0
149
+      TEMP_BED_PIN,
150
+    #endif
151
+    #if GET_CHAMBER_ADC() == 0
152
+      TEMP_CHAMBER_PIN,
153
+    #endif
154
+    #if GET_FILAMENT_WIDTH_ADC() == 0
155
+      FILWIDTH_PIN,
156
+    #endif
157
+    #if GET_BUTTONS_ADC() == 0
158
+      ADC_KEYPAD_PIN,
159
+    #endif
160
+    // ADC1 pins
161
+    #if GET_TEMP_0_ADC() == 1
162
+      TEMP_0_PIN,
163
+    #endif
164
+    #if GET_TEMP_1_ADC() == 1
165
+      TEMP_1_PIN,
166
+    #endif
167
+    #if GET_TEMP_2_ADC() == 1
168
+      TEMP_2_PIN,
169
+    #endif
170
+    #if GET_TEMP_3_ADC() == 1
171
+      TEMP_3_PIN,
172
+    #endif
173
+    #if GET_TEMP_4_ADC() == 1
174
+      TEMP_4_PIN,
175
+    #endif
176
+    #if GET_TEMP_5_ADC() == 1
177
+      TEMP_5_PIN,
178
+    #endif
179
+    #if GET_BED_ADC() == 1
180
+      TEMP_BED_PIN,
181
+    #endif
182
+    #if GET_CHAMBER_ADC() == 1
183
+      TEMP_CHAMBER_PIN,
184
+    #endif
185
+    #if GET_FILAMENT_WIDTH_ADC() == 1
186
+      FILWIDTH_PIN,
187
+    #endif
188
+    #if GET_BUTTONS_ADC() == 1
189
+      ADC_KEYPAD_PIN,
190
+    #endif
191
+  };
192
+
193
+  uint16_t HAL_adc_results[COUNT(adc_pins)];
194
+
195
+  #if ADC0_IS_REQUIRED
196
+    Adafruit_ZeroDMA adc0ProgramDMA,
197
+                     adc0ReadDMA;
198
+
199
+    const HAL_DMA_DAC_Registers adc0_dma_regs_list[] = {
200
+      #if GET_TEMP_0_ADC() == 0
201
+        { PIN_TO_INPUTCTRL(TEMP_0_PIN) },
202
+      #endif
203
+      #if GET_TEMP_1_ADC() == 0
204
+        { PIN_TO_INPUTCTRL(TEMP_1_PIN) },
205
+      #endif
206
+      #if GET_TEMP_2_ADC() == 0
207
+        { PIN_TO_INPUTCTRL(TEMP_2_PIN) },
208
+      #endif
209
+      #if GET_TEMP_3_ADC() == 0
210
+        { PIN_TO_INPUTCTRL(TEMP_3_PIN) },
211
+      #endif
212
+      #if GET_TEMP_4_ADC() == 0
213
+        { PIN_TO_INPUTCTRL(TEMP_4_PIN) },
214
+      #endif
215
+      #if GET_TEMP_5_ADC() == 0
216
+        { PIN_TO_INPUTCTRL(TEMP_5_PIN) },
217
+      #endif
218
+      #if GET_BED_ADC() == 0
219
+        { PIN_TO_INPUTCTRL(TEMP_BED_PIN) },
220
+      #endif
221
+      #if GET_CHAMBER_ADC() == 0
222
+        { PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) },
223
+      #endif
224
+      #if GET_FILAMENT_WIDTH_ADC() == 0
225
+        { PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
226
+      #endif
227
+      #if GET_BUTTONS_ADC() == 0
228
+        { PIN_TO_INPUTCTRL(ADC_KEYPAD_PIN) },
229
+      #endif
230
+    };
231
+
232
+    #define ADC0_AINCOUNT   COUNT(adc0_dma_regs_list)
233
+  #endif // ADC0_IS_REQUIRED
234
+
235
+  #if ADC1_IS_REQUIRED
236
+    Adafruit_ZeroDMA adc1ProgramDMA,
237
+                     adc1ReadDMA;
238
+
239
+    const HAL_DMA_DAC_Registers adc1_dma_regs_list[] = {
240
+      #if GET_TEMP_0_ADC() == 1
241
+        { PIN_TO_INPUTCTRL(TEMP_0_PIN) },
242
+      #endif
243
+      #if GET_TEMP_1_ADC() == 1
244
+        { PIN_TO_INPUTCTRL(TEMP_1_PIN) },
245
+      #endif
246
+      #if GET_TEMP_2_ADC() == 1
247
+        { PIN_TO_INPUTCTRL(TEMP_2_PIN) },
248
+      #endif
249
+      #if GET_TEMP_3_ADC() == 1
250
+        { PIN_TO_INPUTCTRL(TEMP_3_PIN) },
251
+      #endif
252
+      #if GET_TEMP_4_ADC() == 1
253
+        { PIN_TO_INPUTCTRL(TEMP_4_PIN) },
254
+      #endif
255
+      #if GET_TEMP_5_ADC() == 1
256
+        { PIN_TO_INPUTCTRL(TEMP_5_PIN) },
257
+      #endif
258
+      #if GET_BED_ADC() == 1
259
+        { PIN_TO_INPUTCTRL(TEMP_BED_PIN) },
260
+      #endif
261
+      #if GET_CHAMBER_ADC() == 1
262
+        { PIN_TO_INPUTCTRL(TEMP_CHAMBER_PIN) },
263
+      #endif
264
+      #if GET_FILAMENT_WIDTH_ADC() == 1
265
+        { PIN_TO_INPUTCTRL(FILWIDTH_PIN) },
266
+      #endif
267
+      #if GET_BUTTONS_ADC() == 1
268
+        { PIN_TO_INPUTCTRL(ADC_KEYPAD_PIN) },
269
+      #endif
270
+    };
271
+
272
+    #define ADC1_AINCOUNT   COUNT(adc1_dma_regs_list)
273
+  #endif // ADC1_IS_REQUIRED
274
+
275
+#endif // ADC_IS_REQUIRED
276
+
277
+// ------------------------
278
+// Private functions
279
+// ------------------------
280
+
281
+#if DMA_IS_REQUIRED
282
+
283
+  void dma_init() {
284
+    DmacDescriptor *descriptor;
285
+
286
+    #if ADC0_IS_REQUIRED
287
+      adc0ProgramDMA.setTrigger(ADC0_DMAC_ID_SEQ);
288
+      adc0ProgramDMA.setAction(DMA_TRIGGER_ACTON_BEAT);
289
+      adc0ProgramDMA.loop(true);
290
+      if (adc0ProgramDMA.allocate() == DMA_STATUS_OK) {
291
+        descriptor = adc0ProgramDMA.addDescriptor(
292
+          (void *)adc0_dma_regs_list,         // SRC
293
+          (void *)&ADC0->DSEQDATA.reg,        // DEST
294
+          sizeof(adc0_dma_regs_list) / 4,     // CNT
295
+          DMA_BEAT_SIZE_WORD,
296
+          true,                               // SRCINC
297
+          false,                              // DSTINC
298
+          DMA_ADDRESS_INCREMENT_STEP_SIZE_1,  // STEPSIZE
299
+          DMA_STEPSEL_SRC                     // STEPSEL
300
+        );
301
+        if (descriptor != nullptr)
302
+          descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
303
+        adc0ProgramDMA.startJob();
304
+      }
305
+
306
+      adc0ReadDMA.setTrigger(ADC0_DMAC_ID_RESRDY);
307
+      adc0ReadDMA.setAction(DMA_TRIGGER_ACTON_BEAT);
308
+      adc0ReadDMA.loop(true);
309
+      if (adc0ReadDMA.allocate() == DMA_STATUS_OK) {
310
+        adc0ReadDMA.addDescriptor(
311
+          (void *)&ADC0->RESULT.reg,          // SRC
312
+          &HAL_adc_results,                   // DEST
313
+          ADC0_AINCOUNT,                      // CNT
314
+          DMA_BEAT_SIZE_HWORD,
315
+          false,                              // SRCINC
316
+          true,                               // DSTINC
317
+          DMA_ADDRESS_INCREMENT_STEP_SIZE_1,  // STEPSIZE
318
+          DMA_STEPSEL_DST                     // STEPSEL
319
+        );
320
+        adc0ReadDMA.startJob();
321
+      }
322
+    #endif
323
+    #if ADC1_IS_REQUIRED
324
+      adc1ProgramDMA.setTrigger(ADC1_DMAC_ID_SEQ);
325
+      adc1ProgramDMA.setAction(DMA_TRIGGER_ACTON_BEAT);
326
+      adc1ProgramDMA.loop(true);
327
+      if (adc1ProgramDMA.allocate() == DMA_STATUS_OK) {
328
+        descriptor = adc1ProgramDMA.addDescriptor(
329
+          (void *)adc1_dma_regs_list,         // SRC
330
+          (void *)&ADC1->DSEQDATA.reg,        // DEST
331
+          sizeof(adc1_dma_regs_list) / 4,     // CNT
332
+          DMA_BEAT_SIZE_WORD,
333
+          true,                               // SRCINC
334
+          false,                              // DSTINC
335
+          DMA_ADDRESS_INCREMENT_STEP_SIZE_1,  // STEPSIZE
336
+          DMA_STEPSEL_SRC                     // STEPSEL
337
+        );
338
+        if (descriptor != nullptr)
339
+          descriptor->BTCTRL.bit.EVOSEL = DMA_EVENT_OUTPUT_BEAT;
340
+        adc1ProgramDMA.startJob();
341
+      }
342
+
343
+      adc1ReadDMA.setTrigger(ADC1_DMAC_ID_RESRDY);
344
+      adc1ReadDMA.setAction(DMA_TRIGGER_ACTON_BEAT);
345
+      adc1ReadDMA.loop(true);
346
+      if (adc1ReadDMA.allocate() == DMA_STATUS_OK) {
347
+        adc1ReadDMA.addDescriptor(
348
+          (void *)&ADC1->RESULT.reg,          // SRC
349
+          &HAL_adc_results[ADC0_AINCOUNT],    // DEST
350
+          ADC1_AINCOUNT,                      // CNT
351
+          DMA_BEAT_SIZE_HWORD,
352
+          false,                              // SRCINC
353
+          true,                               // DSTINC
354
+          DMA_ADDRESS_INCREMENT_STEP_SIZE_1,  // STEPSIZE
355
+          DMA_STEPSEL_DST                     // STEPSEL
356
+        );
357
+        adc1ReadDMA.startJob();
358
+      }
359
+    #endif
360
+
361
+    DMAC->PRICTRL0.bit.RRLVLEN0 = true;                         // Activate round robin for DMA channels used by ADCs
362
+  }
363
+
364
+#endif // DMA_IS_REQUIRED
365
+
366
+// ------------------------
367
+// Public functions
368
+// ------------------------
369
+
370
+// HAL initialization task
371
+void HAL_init(void) {
372
+  #if DMA_IS_REQUIRED
373
+    dma_init();
374
+  #endif
375
+  #if ENABLED(SDSUPPORT)
376
+    #if SD_CONNECTION_IS(ONBOARD) && PIN_EXISTS(SD_DETECT)    // SD_DETECT_PIN may be remove when NO_SD_HOST_DRIVE is not defined in configuration_adv
377
+      SET_INPUT_PULLUP(SD_DETECT_PIN);
378
+    #endif
379
+    OUT_WRITE(SDSS, HIGH);  // Try to set SDSS inactive before any other SPI users start up
380
+  #endif
381
+}
382
+
383
+// HAL idle task
384
+/*
385
+void HAL_idletask(void) {
386
+}
387
+*/
388
+
389
+void HAL_clear_reset_source(void) { }
390
+
391
+#pragma push_macro("WDT")
392
+#undef WDT    // Required to be able to use '.bit.WDT'. Compiler wrongly replace struct field with WDT define 
393
+uint8_t HAL_get_reset_source(void) {
394
+  RSTC_RCAUSE_Type resetCause;
395
+
396
+  resetCause.reg = REG_RSTC_RCAUSE;
397
+  if (resetCause.bit.POR)                                   return RST_POWER_ON;
398
+  else if (resetCause.bit.EXT)                              return RST_EXTERNAL;
399
+  else if (resetCause.bit.BODCORE || resetCause.bit.BODVDD) return RST_BROWN_OUT;
400
+  else if (resetCause.bit.WDT)                              return RST_WATCHDOG;
401
+  else if (resetCause.bit.SYST || resetCause.bit.NVM)       return RST_SOFTWARE;
402
+  else if (resetCause.bit.BACKUP)                           return RST_BACKUP;
403
+  return 0;
404
+}
405
+#pragma pop_macro("WDT")
406
+
407
+extern "C" {
408
+  void * _sbrk(int incr);
409
+
410
+  extern unsigned int __bss_end__; // end of bss section
411
+}
412
+
413
+// Return free memory between end of heap (or end bss) and whatever is current
414
+int freeMemory() {
415
+  int free_memory, heap_end = (int)_sbrk(0);
416
+  return (int)&free_memory - (heap_end ? heap_end : (int)&__bss_end__);
417
+}
418
+
419
+// ------------------------
420
+// ADC
421
+// ------------------------
422
+
423
+void HAL_adc_init(void) {
424
+  #if ADC_IS_REQUIRED
425
+    memset(HAL_adc_results, 0xFF, sizeof(HAL_adc_results));                 // Fill result with invalid values
426
+
427
+    for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi)
428
+        pinPeripheral(adc_pins[pi], PIO_ANALOG);
429
+
430
+    for (uint8_t ai = FIRST_ADC; ai <= LAST_ADC; ++ai) {
431
+      Adc* adc = ((Adc*[])ADC_INSTS)[ai];
432
+
433
+      // ADC clock setup
434
+      GCLK->PCHCTRL[ADC0_GCLK_ID + ai].bit.CHEN = false;
435
+      SYNC(GCLK->PCHCTRL[ADC0_GCLK_ID + ai].bit.CHEN);
436
+      GCLK->PCHCTRL[ADC0_GCLK_ID + ai].reg = GCLK_PCHCTRL_GEN_GCLK1 | GCLK_PCHCTRL_CHEN;   // 48MHz startup code programmed
437
+      SYNC(!GCLK->PCHCTRL[ADC0_GCLK_ID + ai].bit.CHEN);
438
+      adc->CTRLA.bit.PRESCALER = ADC_CTRLA_PRESCALER_DIV32_Val;             // 1.5MHZ adc clock
439
+
440
+      // ADC setup
441
+      // Preloaded data (fixed for all ADC instances hence not loaded by DMA)
442
+      adc->REFCTRL.bit.REFSEL = ADC_REFCTRL_REFSEL_AREFA_Val;               // VRefA pin
443
+      SYNC(adc->SYNCBUSY.bit.REFCTRL);
444
+      adc->CTRLB.bit.RESSEL = ADC_CTRLB_RESSEL_10BIT_Val;
445
+      SYNC(adc->SYNCBUSY.bit.CTRLB);
446
+      adc->SAMPCTRL.bit.SAMPLEN = (6 - 1);                                  // Sampling clocks
447
+      // Registers loaded by DMA
448
+      adc->DSEQCTRL.bit.INPUTCTRL = true;
449
+
450
+      adc->DSEQCTRL.bit.AUTOSTART = true;                                   // Start conversion after DMA sequence
451
+
452
+      adc->CTRLA.bit.ENABLE = true;                                         // Enable ADC
453
+      SYNC(adc->SYNCBUSY.bit.ENABLE);
454
+    }
455
+  #endif // ADC_IS_REQUIRED
456
+}
457
+
458
+void HAL_adc_start_conversion(const uint8_t adc_pin) {
459
+  #if ADC_IS_REQUIRED
460
+    for (uint8_t pi = 0; pi < COUNT(adc_pins); ++pi) {
461
+      if (adc_pin == adc_pins[pi]) {
462
+        HAL_adc_result = HAL_adc_results[pi];
463
+        return;
464
+      }
465
+    }
466
+  #endif
467
+
468
+  HAL_adc_result = 0xFFFF;
469
+}
470
+
471
+uint16_t HAL_adc_get_result(void) {
472
+  return HAL_adc_result;
473
+}
474
+
475
+#endif // __SAMD51__

+ 141
- 0
Marlin/src/HAL/HAL_SAMD51/HAL.h Bestand weergeven

@@ -0,0 +1,141 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+#define CPU_32_BIT
24
+
25
+#include "../shared/Marduino.h"
26
+#include "../shared/math_32bit.h"
27
+#include "../shared/HAL_SPI.h"
28
+#include "fastio_SAMD51.h"
29
+#include "watchdog_SAMD51.h"
30
+#include "HAL_timers_SAMD51.h"
31
+
32
+#ifdef ADAFRUIT_GRAND_CENTRAL_M4
33
+  #include "MarlinSerial_AGCM4.h"
34
+
35
+  // Serial ports
36
+  #if !WITHIN(SERIAL_PORT, -1, 3)
37
+    #error "SERIAL_PORT must be from -1 to 3"
38
+  #endif
39
+
40
+  // MYSERIAL0 required before MarlinSerial includes!
41
+  #if SERIAL_PORT == -1
42
+    #define MYSERIAL0 Serial
43
+  #elif SERIAL_PORT == 0
44
+    #define MYSERIAL0 Serial1
45
+  #elif SERIAL_PORT == 1
46
+    #define MYSERIAL0 Serial2
47
+  #elif SERIAL_PORT == 2
48
+    #define MYSERIAL0 Serial3
49
+  #else
50
+    #define MYSERIAL0 Serial4
51
+  #endif
52
+
53
+  #ifdef SERIAL_PORT_2
54
+    #if !WITHIN(SERIAL_PORT_2, -1, 3)
55
+      #error "SERIAL_PORT_2 must be from -1 to 3"
56
+    #elif SERIAL_PORT_2 == SERIAL_PORT
57
+      #error "SERIAL_PORT_2 must be different than SERIAL_PORT"
58
+    #endif
59
+    #define NUM_SERIAL 2
60
+    #if SERIAL_PORT_2 == -1
61
+      #define MYSERIAL1 Serial
62
+    #elif SERIAL_PORT_2 == 0
63
+      #define MYSERIAL1 Serial1
64
+    #elif SERIAL_PORT_2 == 1
65
+      #define MYSERIAL1 Serial2
66
+    #elif SERIAL_PORT_2 == 2
67
+      #define MYSERIAL1 Serial3
68
+    #else
69
+      #define MYSERIAL1 Serial4
70
+    #endif
71
+  #else
72
+    #define NUM_SERIAL 1
73
+  #endif
74
+
75
+#endif // ADAFRUIT_GRAND_CENTRAL_M4
76
+
77
+typedef int8_t pin_t;
78
+
79
+//#define HAL_SERVO_LIB Servo
80
+
81
+//
82
+// Interrupts
83
+//
84
+#define CRITICAL_SECTION_START  uint32_t primask = __get_PRIMASK(); __disable_irq()
85
+#define CRITICAL_SECTION_END    if (!primask) __enable_irq()
86
+#define ISRS_ENABLED() (!__get_PRIMASK())
87
+#define ENABLE_ISRS()  __enable_irq()
88
+#define DISABLE_ISRS() __disable_irq()
89
+
90
+#define cli() __disable_irq()       // Disable interrupts
91
+#define sei() __enable_irq()        // Enable interrupts
92
+
93
+void HAL_clear_reset_source(void);  // clear reset reason
94
+uint8_t HAL_get_reset_source(void); // get reset reason
95
+
96
+//
97
+// EEPROM
98
+//
99
+void eeprom_write_byte(uint8_t *pos, unsigned char value);
100
+uint8_t eeprom_read_byte(uint8_t *pos);
101
+
102
+//
103
+// ADC
104
+//
105
+extern uint16_t HAL_adc_result;     // result of last ADC conversion
106
+
107
+#define HAL_ANALOG_SELECT(pin)
108
+
109
+void HAL_adc_init(void);
110
+
111
+#define HAL_START_ADC(pin)  HAL_adc_start_conversion(pin)
112
+#define HAL_READ_ADC()      HAL_adc_result
113
+#define HAL_ADC_READY()     true
114
+
115
+void HAL_adc_start_conversion(const uint8_t adc_pin);
116
+uint16_t HAL_adc_get_result(void);
117
+
118
+//
119
+// Pin Map
120
+//
121
+#define GET_PIN_MAP_PIN(index) index
122
+#define GET_PIN_MAP_INDEX(pin) pin
123
+#define PARSED_PIN_INDEX(code, dval) parser.intval(code, dval)
124
+
125
+//
126
+// Tone
127
+//
128
+void toneInit();
129
+void tone(const pin_t _pin, const unsigned int frequency, const unsigned long duration=0);
130
+void noTone(const pin_t _pin);
131
+
132
+// Enable hooks into idle and setup for HAL
133
+void HAL_init(void);
134
+/*#define HAL_IDLETASK 1
135
+void HAL_idletask(void);*/
136
+
137
+//
138
+// Utility functions
139
+//
140
+FORCE_INLINE void _delay_ms(const int delay_ms) { delay(delay_ms); }
141
+int freeMemory(void);

+ 151
- 0
Marlin/src/HAL/HAL_SAMD51/HAL_spi_SAMD51.cpp Bestand weergeven

@@ -0,0 +1,151 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+/**
23
+ * Hardware and software SPI implementations are included in this file.
24
+ *
25
+ * Control of the slave select pin(s) is handled by the calling routines and
26
+ * SAMD51 let hardware SPI handling to remove SS from its logic.
27
+ */
28
+
29
+#ifdef __SAMD51__
30
+
31
+// --------------------------------------------------------------------------
32
+// Includes
33
+// --------------------------------------------------------------------------
34
+
35
+#include "../../inc/MarlinConfig.h"
36
+#include <SPI.h>
37
+
38
+// --------------------------------------------------------------------------
39
+// Public functions
40
+// --------------------------------------------------------------------------
41
+
42
+#if EITHER(SOFTWARE_SPI, FORCE_SOFT_SPI)
43
+
44
+  // ------------------------
45
+  // Software SPI
46
+  // ------------------------
47
+  #error "Software SPI not supported for SAMD51. Use Hardware SPI."
48
+
49
+  #if SD_CONNECTION_IS(ONBOARD)
50
+  #endif
51
+
52
+#else // !SOFTWARE_SPI
53
+
54
+  #ifdef ADAFRUIT_GRAND_CENTRAL_M4
55
+    #if SD_CONNECTION_IS(ONBOARD)
56
+      #define sdSPI SDCARD_SPI
57
+    #else
58
+      #define sdSPI SPI
59
+    #endif
60
+  #endif
61
+
62
+  static SPISettings spiConfig;
63
+
64
+  // ------------------------
65
+  // Hardware SPI
66
+  // ------------------------
67
+  void spiBegin(void) {
68
+    spiInit(SPI_HALF_SPEED);
69
+  }
70
+
71
+  void spiInit(uint8_t spiRate) {
72
+    // Use datarates Marlin uses
73
+    uint32_t clock;
74
+    switch (spiRate) {
75
+      case SPI_FULL_SPEED:      clock = 8000000; break;
76
+      case SPI_HALF_SPEED:      clock = 4000000; break;
77
+      case SPI_QUARTER_SPEED:   clock = 2000000; break;
78
+      case SPI_EIGHTH_SPEED:    clock = 1000000; break;
79
+      case SPI_SIXTEENTH_SPEED: clock =  500000; break;
80
+      case SPI_SPEED_5:         clock =  250000; break;
81
+      case SPI_SPEED_6:         clock =  125000; break;
82
+      default:                  clock = 4000000; break; // Default from the SPI library
83
+    }
84
+    spiConfig = SPISettings(clock, MSBFIRST, SPI_MODE0);
85
+    sdSPI.begin();
86
+  }
87
+
88
+  /**
89
+   * @brief  Receives a single byte from the SPI port.
90
+   *
91
+   * @return Byte received
92
+   *
93
+   * @details
94
+   */
95
+  uint8_t spiRec(void) {
96
+    sdSPI.beginTransaction(spiConfig);
97
+    uint8_t returnByte = sdSPI.transfer(0xFF);
98
+    sdSPI.endTransaction();
99
+    return returnByte;
100
+  }
101
+
102
+  /**
103
+   * @brief  Receives a number of bytes from the SPI port to a buffer
104
+   *
105
+   * @param  buf   Pointer to starting address of buffer to write to.
106
+   * @param  nbyte Number of bytes to receive.
107
+   * @return Nothing
108
+   */
109
+  void spiRead(uint8_t* buf, uint16_t nbyte) {
110
+    if (nbyte == 0) return;
111
+    memset(buf, 0xFF, nbyte);
112
+    sdSPI.beginTransaction(spiConfig);
113
+    sdSPI.transfer(buf, nbyte);
114
+    sdSPI.endTransaction();
115
+  }
116
+
117
+  /**
118
+   * @brief  Sends a single byte on SPI port
119
+   *
120
+   * @param  b Byte to send
121
+   *
122
+   * @details
123
+   */
124
+  void spiSend(uint8_t b) {
125
+    sdSPI.beginTransaction(spiConfig);
126
+    sdSPI.transfer(b);
127
+    sdSPI.endTransaction();
128
+  }
129
+
130
+  /**
131
+   * @brief  Write token and then write from 512 byte buffer to SPI (for SD card)
132
+   *
133
+   * @param  buf   Pointer with buffer start address
134
+   * @return Nothing
135
+   *
136
+   * @details Uses DMA
137
+   */
138
+  void spiSendBlock(uint8_t token, const uint8_t* buf) {
139
+    sdSPI.beginTransaction(spiConfig);
140
+    sdSPI.transfer(token);
141
+    sdSPI.transfer((uint8_t*)buf, nullptr, 512);
142
+    sdSPI.endTransaction();
143
+  }
144
+
145
+  void spiBeginTransaction(uint32_t spiClock, uint8_t bitOrder, uint8_t dataMode) {
146
+    spiConfig = SPISettings(spiClock, (BitOrder)bitOrder, dataMode);
147
+    sdSPI.beginTransaction(spiConfig);
148
+  }
149
+#endif // !SOFTWARE_SPI
150
+
151
+#endif // __SAMD51__

+ 135
- 0
Marlin/src/HAL/HAL_SAMD51/HAL_timers_SAMD51.cpp Bestand weergeven

@@ -0,0 +1,135 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+#ifdef __SAMD51__
23
+
24
+// --------------------------------------------------------------------------
25
+// Includes
26
+// --------------------------------------------------------------------------
27
+#include "../../inc/MarlinConfig.h"
28
+#include "HAL_timers_SAMD51.h"
29
+
30
+// --------------------------------------------------------------------------
31
+// Local defines
32
+// --------------------------------------------------------------------------
33
+
34
+#define NUM_HARDWARE_TIMERS 8
35
+
36
+// --------------------------------------------------------------------------
37
+// Private Variables
38
+// --------------------------------------------------------------------------
39
+
40
+const tTimerConfig TimerConfig[NUM_HARDWARE_TIMERS] = {
41
+  { TC0, TC0_IRQn, TC_PRIORITY(0) },
42
+  { TC1, TC1_IRQn, TC_PRIORITY(1) },
43
+  { TC2, TC2_IRQn, TC_PRIORITY(2) },
44
+  { TC3, TC3_IRQn, TC_PRIORITY(3) },
45
+  { TC4, TC4_IRQn, TC_PRIORITY(4) },
46
+  { TC5, TC5_IRQn, TC_PRIORITY(5) },
47
+  { TC6, TC6_IRQn, TC_PRIORITY(6) },
48
+  { TC7, TC7_IRQn, TC_PRIORITY(7) }
49
+};
50
+
51
+// --------------------------------------------------------------------------
52
+// Private functions
53
+// --------------------------------------------------------------------------
54
+
55
+FORCE_INLINE void Disable_Irq(IRQn_Type irq) {
56
+  NVIC_DisableIRQ(irq);
57
+
58
+  // We NEED memory barriers to ensure Interrupts are actually disabled!
59
+  // ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
60
+  __DSB();
61
+  __ISB();
62
+}
63
+
64
+// --------------------------------------------------------------------------
65
+// Public functions
66
+// --------------------------------------------------------------------------
67
+
68
+void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency) {
69
+  Tc * const tc = TimerConfig[timer_num].pTimer;
70
+  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
71
+
72
+  // Disable interrupt, just in case it was already enabled
73
+  Disable_Irq(irq);
74
+
75
+  // Disable timer interrupt
76
+  tc->COUNT32.INTENCLR.reg = TC_INTENCLR_OVF; // disable overflow interrupt
77
+
78
+  // TCn clock setup
79
+  const uint8_t clockID = GCLK_CLKCTRL_IDs[TCC_INST_NUM + timer_num];
80
+  GCLK->PCHCTRL[clockID].bit.CHEN = false;
81
+  SYNC(GCLK->PCHCTRL[clockID].bit.CHEN);
82
+  GCLK->PCHCTRL[clockID].reg = GCLK_PCHCTRL_GEN_GCLK0 | GCLK_PCHCTRL_CHEN;   // 120MHz startup code programmed
83
+  SYNC(!GCLK->PCHCTRL[clockID].bit.CHEN);
84
+
85
+  // Stop timer, just in case, to be able to reconfigure it
86
+  tc->COUNT32.CTRLA.bit.ENABLE = false;
87
+  SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
88
+
89
+  // Reset timer
90
+  tc->COUNT32.CTRLA.bit.SWRST = true;
91
+  SYNC(tc->COUNT32.SYNCBUSY.bit.SWRST);
92
+
93
+  NVIC_SetPriority(irq, TimerConfig[timer_num].priority);
94
+
95
+  // Wave mode, reset counter on overflow on 0 (I use count down to prevent double buffer use)
96
+  tc->COUNT32.WAVE.reg = TC_WAVE_WAVEGEN_MFRQ;
97
+  tc->COUNT32.CTRLA.reg = TC_CTRLA_MODE_COUNT32 | TC_CTRLA_PRESCALER_DIV1;
98
+  tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_DIR;
99
+  SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB);
100
+
101
+  // Set compare value
102
+  tc->COUNT32.COUNT.reg = tc->COUNT32.CC[0].reg = HAL_TIMER_RATE / frequency;
103
+
104
+  // And start timer
105
+  tc->COUNT32.CTRLA.bit.ENABLE = true;
106
+  SYNC(tc->COUNT32.SYNCBUSY.bit.ENABLE);
107
+
108
+  // Enable interrupt on RC compare
109
+  tc->COUNT32.INTENSET.reg = TC_INTENCLR_OVF; // enable overflow interrupt
110
+
111
+  // Finally, enable IRQ
112
+  NVIC_EnableIRQ(irq);
113
+}
114
+
115
+void HAL_timer_enable_interrupt(const uint8_t timer_num) {
116
+  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
117
+  NVIC_EnableIRQ(irq);
118
+}
119
+
120
+void HAL_timer_disable_interrupt(const uint8_t timer_num) {
121
+  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
122
+  Disable_Irq(irq);
123
+}
124
+
125
+// missing from CMSIS: Check if interrupt is enabled or not
126
+static bool NVIC_GetEnabledIRQ(IRQn_Type IRQn) {
127
+  return (NVIC->ISER[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F))) != 0;
128
+}
129
+
130
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num) {
131
+  IRQn_Type irq = TimerConfig[timer_num].IRQ_Id;
132
+  return NVIC_GetEnabledIRQ(irq);
133
+}
134
+
135
+#endif // __SAMD51__

+ 117
- 0
Marlin/src/HAL/HAL_SAMD51/HAL_timers_SAMD51.h Bestand weergeven

@@ -0,0 +1,117 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+#include <stdint.h>
24
+
25
+// --------------------------------------------------------------------------
26
+// Defines
27
+// --------------------------------------------------------------------------
28
+
29
+typedef uint32_t hal_timer_t;
30
+#define HAL_TIMER_TYPE_MAX 0xFFFFFFFF
31
+
32
+#define HAL_TIMER_RATE      SystemCoreClock  // frequency of timers peripherals
33
+
34
+#define STEP_TIMER_NUM      0  // index of timer to use for stepper (also +1 for 32bits counter)
35
+#define PULSE_TIMER_NUM     STEP_TIMER_NUM
36
+#define TONE_TIMER_NUM      2  // index of timer to use for beeper tones (also +1 for 32bits counter)
37
+#define TEMP_TIMER_NUM      4  // index of timer to use for temperature (also +1 for 32bits counter)
38
+
39
+#define TEMP_TIMER_FREQUENCY   1000 // temperature interrupt frequency
40
+
41
+#define STEPPER_TIMER_RATE          HAL_TIMER_RATE   // frequency of stepper timer (HAL_TIMER_RATE / STEPPER_TIMER_PRESCALE)
42
+#define STEPPER_TIMER_TICKS_PER_US  ((STEPPER_TIMER_RATE) / 1000000) // stepper timer ticks per µs
43
+#define STEPPER_TIMER_PRESCALE      (CYCLES_PER_MICROSECOND / STEPPER_TIMER_TICKS_PER_US)
44
+
45
+#define PULSE_TIMER_RATE          STEPPER_TIMER_RATE
46
+#define PULSE_TIMER_PRESCALE      STEPPER_TIMER_PRESCALE
47
+#define PULSE_TIMER_TICKS_PER_US  STEPPER_TIMER_TICKS_PER_US
48
+
49
+#define ENABLE_STEPPER_DRIVER_INTERRUPT()   HAL_timer_enable_interrupt(STEP_TIMER_NUM)
50
+#define DISABLE_STEPPER_DRIVER_INTERRUPT()  HAL_timer_disable_interrupt(STEP_TIMER_NUM)
51
+#define STEPPER_ISR_ENABLED()               HAL_timer_interrupt_enabled(STEP_TIMER_NUM)
52
+
53
+#define ENABLE_TEMPERATURE_INTERRUPT()  HAL_timer_enable_interrupt(TEMP_TIMER_NUM)
54
+#define DISABLE_TEMPERATURE_INTERRUPT() HAL_timer_disable_interrupt(TEMP_TIMER_NUM)
55
+
56
+#define TC_PRIORITY(t)        (t == STEP_TIMER_NUM || t == PULSE_TIMER_NUM) ? 2     \
57
+                               : (t == TEMP_TIMER_NUM) ? 6                          \
58
+                               : (t == TONE_TIMER_NUM) ? 5 : 7
59
+#define _TC_HANDLER(t)        void TC##t##_Handler()
60
+#define TC_HANDLER(t)         _TC_HANDLER(t)
61
+#define HAL_STEP_TIMER_ISR()  TC_HANDLER(STEP_TIMER_NUM)
62
+#if STEP_TIMER_NUM != PULSE_TIMER_NUM
63
+  #define HAL_PULSE_TIMER_ISR()  TC_HANDLER(PULSE_TIMER_NUM)
64
+#endif
65
+#define HAL_TEMP_TIMER_ISR()  TC_HANDLER(TEMP_TIMER_NUM)
66
+#define HAL_TONE_TIMER_ISR()  TC_HANDLER(TONE_TIMER_NUM)
67
+
68
+// --------------------------------------------------------------------------
69
+// Types
70
+// --------------------------------------------------------------------------
71
+
72
+typedef struct {
73
+  Tc          *pTimer;
74
+  IRQn_Type   IRQ_Id;
75
+  uint8_t     priority;
76
+} tTimerConfig;
77
+
78
+// --------------------------------------------------------------------------
79
+// Public Variables
80
+// --------------------------------------------------------------------------
81
+
82
+extern const tTimerConfig TimerConfig[];
83
+
84
+// --------------------------------------------------------------------------
85
+// Public functions
86
+// --------------------------------------------------------------------------
87
+
88
+void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
89
+
90
+FORCE_INLINE static void HAL_timer_set_compare(const uint8_t timer_num, const hal_timer_t compare) {
91
+  Tc * const tc = TimerConfig[timer_num].pTimer;
92
+  tc->COUNT32.CC[0].reg = HAL_TIMER_TYPE_MAX - compare;
93
+}
94
+
95
+FORCE_INLINE static hal_timer_t HAL_timer_get_compare(const uint8_t timer_num) {
96
+  Tc * const tc = TimerConfig[timer_num].pTimer;
97
+  return (hal_timer_t)(HAL_TIMER_TYPE_MAX - tc->COUNT32.CC[0].reg);
98
+}
99
+
100
+FORCE_INLINE static hal_timer_t HAL_timer_get_count(const uint8_t timer_num) {
101
+  Tc * const tc = TimerConfig[timer_num].pTimer;
102
+  tc->COUNT32.CTRLBSET.reg = TC_CTRLBCLR_CMD_READSYNC;
103
+  SYNC(tc->COUNT32.SYNCBUSY.bit.CTRLB || tc->COUNT32.SYNCBUSY.bit.COUNT);
104
+  return HAL_TIMER_TYPE_MAX - tc->COUNT32.COUNT.reg;
105
+}
106
+
107
+void HAL_timer_enable_interrupt(const uint8_t timer_num);
108
+void HAL_timer_disable_interrupt(const uint8_t timer_num);
109
+bool HAL_timer_interrupt_enabled(const uint8_t timer_num);
110
+
111
+FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
112
+  Tc * const tc = TimerConfig[timer_num].pTimer;
113
+  // Clear interrupt flag
114
+  tc->COUNT32.INTFLAG.reg = TC_INTFLAG_OVF;
115
+}
116
+
117
+#define HAL_timer_isr_epilogue(timer_num)

+ 55
- 0
Marlin/src/HAL/HAL_SAMD51/MarlinSerial_AGCM4.cpp Bestand weergeven

@@ -0,0 +1,55 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+#ifdef ADAFRUIT_GRAND_CENTRAL_M4
23
+
24
+/**
25
+ * Framework doesn't define some serial to save sercom resources
26
+ * hence if these are used I need to define them
27
+ */
28
+
29
+#include "../../inc/MarlinConfig.h"
30
+
31
+#if SERIAL_PORT == 1 || SERIAL_PORT_2 == 1
32
+  Uart Serial2(&sercom4, PIN_SERIAL2_RX, PIN_SERIAL2_TX, PAD_SERIAL2_RX, PAD_SERIAL2_TX);
33
+  void SERCOM4_0_Handler() { Serial2.IrqHandler(); }
34
+  void SERCOM4_1_Handler() { Serial2.IrqHandler(); }
35
+  void SERCOM4_2_Handler() { Serial2.IrqHandler(); }
36
+  void SERCOM4_3_Handler() { Serial2.IrqHandler(); }
37
+#endif
38
+
39
+#if SERIAL_PORT == 2 || SERIAL_PORT_2 == 2
40
+  Uart Serial3(&sercom1, PIN_SERIAL3_RX, PIN_SERIAL3_TX, PAD_SERIAL3_RX, PAD_SERIAL3_TX);
41
+  void SERCOM1_0_Handler() { Serial3.IrqHandler(); }
42
+  void SERCOM1_1_Handler() { Serial3.IrqHandler(); }
43
+  void SERCOM1_2_Handler() { Serial3.IrqHandler(); }
44
+  void SERCOM1_3_Handler() { Serial3.IrqHandler(); }
45
+#endif
46
+
47
+#if SERIAL_PORT == 3 || SERIAL_PORT_2 == 3
48
+  Uart Serial4(&sercom5, PIN_SERIAL4_RX, PIN_SERIAL4_TX, PAD_SERIAL4_RX, PAD_SERIAL4_TX);
49
+  void SERCOM5_0_Handler() { Serial4.IrqHandler(); }
50
+  void SERCOM5_1_Handler() { Serial4.IrqHandler(); }
51
+  void SERCOM5_2_Handler() { Serial4.IrqHandler(); }
52
+  void SERCOM5_3_Handler() { Serial4.IrqHandler(); }
53
+#endif
54
+
55
+#endif // ADAFRUIT_GRAND_CENTRAL_M4

+ 25
- 0
Marlin/src/HAL/HAL_SAMD51/MarlinSerial_AGCM4.h Bestand weergeven

@@ -0,0 +1,25 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+extern Uart Serial2;
24
+extern Uart Serial3;
25
+extern Uart Serial4;

+ 70
- 0
Marlin/src/HAL/HAL_SAMD51/SAMD51.h Bestand weergeven

@@ -0,0 +1,70 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+#define SYNC(sc)    while (sc) {   \
24
+                      asm("");     \
25
+                    }
26
+
27
+// Get SAMD port/pin from specified arduino pin
28
+#define GET_SAMD_PORT(P)    _GET_SAMD_PORT(PIN_TO_SAMD_PIN(P))
29
+#define GET_SAMD_PIN(P)     _GET_SAMD_PIN(PIN_TO_SAMD_PIN(P))
30
+
31
+// Get external interrupt line associated to specified arduino pin
32
+#define PIN_TO_EILINE(P)    _SAMDPORTPIN_TO_EILINE(GET_SAMD_PORT(P), GET_SAMD_PIN(P))
33
+
34
+// Get adc/ain associated to specified arduino pin
35
+#define PIN_TO_ADC(P)       (ANAPIN_TO_ADCAIN(P) >> 8)
36
+#define PIN_TO_AIN(P)       (ANAPIN_TO_ADCAIN(P) & 0xFF)
37
+
38
+// Private defines
39
+#define PIN_TO_SAMD_PIN(P)    DIO##P##_PIN
40
+
41
+#define _GET_SAMD_PORT(P)     ((P) >> 5)
42
+#define _GET_SAMD_PIN(P)      ((P) & 0x1F)
43
+
44
+// Get external interrupt line
45
+#define _SAMDPORTPIN_TO_EILINE(P,B)   ((P == 0 && WITHIN(B, 0, 31) && B != 8 && B != 26 && B != 28 && B != 29) ? (B) & 0xF    \
46
+                                       : (P == 1 && (WITHIN(B, 0, 25) || WITHIN(B, 30, 31))) ? (B) & 0xF                      \
47
+                                       : (P == 1 && WITHIN(B, 26, 29)) ? 12 + (B) - 26                                        \
48
+                                       : (P == 2 && (WITHIN(B, 0, 6) || WITHIN(B, 10, 31)) && B != 29) ? (B) & 0xF            \
49
+                                       : (P == 2 && B == 7) ? 9                                                               \
50
+                                       : (P == 3 && WITHIN(B, 0, 1)) ? (B)                                                    \
51
+                                       : (P == 3 && WITHIN(B, 8, 12)) ? 3 + (B) - 8                                           \
52
+                                       : (P == 3 && WITHIN(B, 20, 21)) ? 10 + (B) - 20                                        \
53
+                                       : -1)
54
+
55
+// Get adc/ain
56
+#define ANAPIN_TO_ADCAIN(P)     _PIN_TO_ADCAIN(ANAPIN_TO_SAMDPIN(P))
57
+#define _PIN_TO_ADCAIN(P)       _SAMDPORTPIN_TO_ADCAIN(_GET_SAMD_PORT(P), _GET_SAMD_PIN(P))
58
+
59
+#define _SAMDPORTPIN_TO_ADCAIN(P,B)       ((P == 0 && WITHIN(B, 2, 3)) ? 0x000 + (B) - 2            \
60
+                                           : (P == 0 && WITHIN(B, 4, 7)) ? 0x000 + (B)              \
61
+                                           : (P == 0 && WITHIN(B, 8, 9)) ? 0x100 + 2 + (B) - 8      \
62
+                                           : (P == 0 && WITHIN(B, 10, 11)) ? 0x000 + (B)            \
63
+                                           : (P == 1 && WITHIN(B, 0, 3)) ? 0x000 + 12 + (B)         \
64
+                                           : (P == 1 && WITHIN(B, 4, 7)) ? 0x100 + 6 + (B) - 4      \
65
+                                           : (P == 1 && WITHIN(B, 8, 9)) ? 0x100 + (B) - 8          \
66
+                                           : (P == 2 && WITHIN(B, 0, 1)) ? 0x100 + 10 + (B)         \
67
+                                           : (P == 2 && WITHIN(B, 2, 3)) ? 0x100 + 4 + (B) - 2      \
68
+                                           : (P == 2 && WITHIN(B, 30, 31)) ? 0x100 + 12 + (B) - 30  \
69
+                                           : (P == 3 && WITHIN(B, 0, 1)) ? 0x100 + 14 + (B)         \
70
+                                           : -1)

+ 48
- 0
Marlin/src/HAL/HAL_SAMD51/SanityCheck.h Bestand weergeven

@@ -0,0 +1,48 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+/**
23
+ * Test SAMD51 specific configuration values for errors at compile-time.
24
+ */
25
+
26
+#if defined(ADAFRUIT_GRAND_CENTRAL_M4) && SD_CONNECTION_IS(CUSTOM_CABLE)
27
+  #error "No custom SD drive cable defined for this board."
28
+#endif
29
+
30
+#if defined(MAX6675_SCK_PIN) && defined(MAX6675_DO_PIN) && (MAX6675_SCK_PIN == SCK1 || MAX6675_DO_PIN == MISO1)
31
+  #error "OnBoard SPI BUS can't be shared with other devices."
32
+#endif
33
+
34
+#if ENABLED(EMERGENCY_PARSER)
35
+  #error "EMERGENCY_PARSER is not yet implemented for STM32F4. Disable EMERGENCY_PARSER to continue."
36
+#endif
37
+
38
+#if ENABLED(SDIO_SUPPORT)
39
+  #error "SDIO_SUPPORT is not supported."
40
+#endif
41
+
42
+#if ENABLED(FAST_PWM_FAN)
43
+  #error "FAST_PWM_FAN is not yet implemented for this platform."
44
+#endif
45
+
46
+#if ENABLED(EEPROM_SETTINGS) && NONE(SPI_EEPROM, I2C_EEPROM)
47
+  #warning "Did you activate the SmartEEPROM? See https://github.com/GMagician/SAMD51-SmartEEprom-Activator"
48
+#endif

+ 59
- 0
Marlin/src/HAL/HAL_SAMD51/Tone.cpp Bestand weergeven

@@ -0,0 +1,59 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+/**
23
+ * Description: Tone function for Arduino Due and compatible (SAM3X8E)
24
+ * Derived from http://forum.arduino.cc/index.php?topic=136500.msg2903012#msg2903012
25
+ */
26
+
27
+#ifdef __SAMD51__
28
+
29
+#include "../../inc/MarlinConfig.h"
30
+#include "HAL_timers_SAMD51.h"
31
+
32
+static pin_t tone_pin;
33
+volatile static int32_t toggles;
34
+
35
+void tone(const pin_t _pin, const unsigned int frequency, const unsigned long duration) {
36
+  tone_pin = _pin;
37
+  toggles = 2 * frequency * duration / 1000;
38
+  HAL_timer_start(TONE_TIMER_NUM, 2 * frequency);
39
+}
40
+
41
+void noTone(const pin_t _pin) {
42
+  HAL_timer_disable_interrupt(TONE_TIMER_NUM);
43
+  extDigitalWrite(_pin, LOW);
44
+}
45
+
46
+HAL_TONE_TIMER_ISR() {
47
+  static bool pin_state = false;
48
+  HAL_timer_isr_prologue(TONE_TIMER_NUM);
49
+
50
+  if (toggles) {
51
+    toggles--;
52
+    extDigitalWrite(tone_pin, (pin_state = !pin_state));
53
+  }
54
+  else noTone(tone_pin);                         // turn off interrupt
55
+
56
+  HAL_timer_isr_epilogue(TONE_TIMER_NUM);
57
+}
58
+
59
+#endif // __SAMD51__

+ 184
- 0
Marlin/src/HAL/HAL_SAMD51/endstop_interrupts.h Bestand weergeven

@@ -0,0 +1,184 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+/**
24
+ * Endstop interrupts for ATMEL SAMD51 based targets.
25
+ *
26
+ * On SAMD51, all pins support external interrupt capability.
27
+ * Any pin can be used for external interrupts, but there are some restrictions.
28
+ * At most 16 different external interrupts can be used at one time.
29
+ * Further, you can’t just pick any 16 pins to use. This is because every pin on the SAMD51
30
+ * connects to what is called an EXTINT line, and only one pin per EXTINT line can be used for external 
31
+ * interrupts at a time
32
+ */
33
+
34
+/**
35
+ * Endstop Interrupts
36
+ *
37
+ * Without endstop interrupts the endstop pins must be polled continually in
38
+ * the temperature-ISR via endstops.update(), most of the time finding no change.
39
+ * With this feature endstops.update() is called only when we know that at
40
+ * least one endstop has changed state, saving valuable CPU cycles.
41
+ *
42
+ * This feature only works when all used endstop pins can generate an 'external interrupt'.
43
+ *
44
+ * Test whether pins issue interrupts on your board by flashing 'pin_interrupt_test.ino'.
45
+ * (Located in Marlin/buildroot/share/pin_interrupt_test/pin_interrupt_test.ino)
46
+ */
47
+
48
+#include "../../module/endstops.h"
49
+
50
+#define MATCH_EILINE(P1,P2)     (P1 != P2 && PIN_TO_EILINE(P1) == PIN_TO_EILINE(P2))
51
+#if HAS_X_MAX
52
+  #define MATCH_X_MAX_EILINE(P) MATCH_EILINE(P, X_MAX_PIN)
53
+#else
54
+  #define MATCH_X_MAX_EILINE(P) false
55
+#endif
56
+#if HAS_X_MIN
57
+  #define MATCH_X_MIN_EILINE(P) MATCH_EILINE(P, X_MIN_PIN)
58
+#else
59
+  #define MATCH_X_MIN_EILINE(P) false
60
+#endif
61
+#if HAS_Y_MAX
62
+   #define MATCH_Y_MAX_EILINE(P) MATCH_EILINE(P, Y_MAX_PIN)
63
+#else
64
+   #define MATCH_Y_MAX_EILINE(P) false
65
+#endif
66
+#if HAS_Y_MIN
67
+  #define MATCH_Y_MIN_EILINE(P) MATCH_EILINE(P, Y_MIN_PIN)
68
+#else
69
+  #define MATCH_Y_MIN_EILINE(P) false
70
+#endif
71
+#if HAS_Z_MAX
72
+   #define MATCH_Z_MAX_EILINE(P) MATCH_EILINE(P, Z_MAX_PIN)
73
+#else
74
+  #define MATCH_Z_MAX_EILINE(P) false
75
+#endif
76
+#if HAS_Z_MIN
77
+  #define MATCH_Z_MIN_EILINE(P) MATCH_EILINE(P, Z_MIN_PIN)
78
+#else
79
+  #define MATCH_Z_MIN_EILINE(P) false
80
+#endif
81
+#if HAS_Z2_MAX
82
+  #define MATCH_Z2_MAX_EILINE(P) MATCH_EILINE(P, Z2_MAX_PIN)
83
+#else
84
+  #define MATCH_Z2_MAX_EILINE(P) false
85
+#endif
86
+#if HAS_Z2_MIN
87
+  #define MATCH_Z2_MIN_EILINE(P) MATCH_EILINE(P, Z2_MIN_PIN)
88
+#else
89
+  #define MATCH_Z2_MIN_EILINE(P) false
90
+#endif
91
+#if HAS_Z3_MAX
92
+  #define MATCH_Z3_MAX_EILINE(P) MATCH_EILINE(P, Z3_MAX_PIN)
93
+#else
94
+  #define MATCH_Z3_MAX_EILINE(P) false
95
+#endif
96
+#if HAS_Z3_MIN
97
+  #define MATCH_Z3_MIN_EILINE(P) MATCH_EILINE(P, Z3_MIN_PIN)
98
+#else
99
+  #define MATCH_Z3_MIN_EILINE(P) false
100
+#endif
101
+#if HAS_Z_MIN_PROBE_PIN
102
+  #define MATCH_Z_MIN_PROBE_EILINE(P)   MATCH_EILINE(P, Z_MIN_PROBE_PIN)
103
+#else
104
+  #define MATCH_Z_MIN_PROBE_EILINE(P) false
105
+#endif
106
+#define AVAILABLE_EILINE(P)     (PIN_TO_EILINE(P) != -1                                 \
107
+                                 && !MATCH_X_MAX_EILINE(P) && !MATCH_X_MIN_EILINE(P)    \
108
+                                 && !MATCH_Y_MAX_EILINE(P) && !MATCH_Y_MIN_EILINE(P)    \
109
+                                 && !MATCH_Z_MAX_EILINE(P) && !MATCH_Z_MIN_EILINE(P)    \
110
+                                 && !MATCH_Z2_MAX_EILINE(P) && !MATCH_Z2_MIN_EILINE(P)  \
111
+                                 && !MATCH_Z3_MAX_EILINE(P) && !MATCH_Z3_MIN_EILINE(P)  \
112
+                                 && !MATCH_Z_MIN_PROBE_EILINE(P))
113
+
114
+// One ISR for all EXT-Interrupts
115
+void endstop_ISR(void) { endstops.update(); }
116
+
117
+void setup_endstop_interrupts(void) {
118
+  #if HAS_X_MAX
119
+    #if !AVAILABLE_EILINE(X_MAX_PIN)
120
+      static_assert(false, "X_MAX_PIN has no EXTINT line available.");
121
+    #endif
122
+    attachInterrupt(X_MAX_PIN, endstop_ISR, CHANGE);
123
+  #endif
124
+  #if HAS_X_MIN
125
+    #if !AVAILABLE_EILINE(X_MIN_PIN)
126
+      static_assert(false, "X_MIN_PIN has no EXTINT line available.");
127
+    #endif
128
+    attachInterrupt(X_MIN_PIN, endstop_ISR, CHANGE);
129
+  #endif
130
+  #if HAS_Y_MAX
131
+    #if !AVAILABLE_EILINE(Y_MAX_PIN)
132
+      static_assert(false, "Y_MAX_PIN has no EXTINT line available.");
133
+    #endif
134
+    attachInterrupt(Y_MAX_PIN, endstop_ISR, CHANGE);
135
+  #endif
136
+  #if HAS_Y_MIN
137
+    #if !AVAILABLE_EILINE(Y_MIN_PIN)
138
+      static_assert(false, "Y_MIN_PIN has no EXTINT line available.");
139
+    #endif
140
+    attachInterrupt(Y_MIN_PIN, endstop_ISR, CHANGE);
141
+  #endif
142
+  #if HAS_Z_MAX
143
+    #if !AVAILABLE_EILINE(Z_MAX_PIN)
144
+      static_assert(false, "Z_MAX_PIN has no EXTINT line available.");
145
+    #endif
146
+    attachInterrupt(Z_MAX_PIN, endstop_ISR, CHANGE);
147
+  #endif
148
+  #if HAS_Z_MIN
149
+    #if !AVAILABLE_EILINE(Z_MIN_PIN)
150
+      static_assert(false, "Z_MIN_PIN has no EXTINT line available.");
151
+    #endif
152
+    attachInterrupt(Z_MIN_PIN, endstop_ISR, CHANGE);
153
+  #endif
154
+  #if HAS_Z2_MAX
155
+    #if !AVAILABLE_EILINE(Z2_MAX_PIN)
156
+      static_assert(false, "Z2_MAX_PIN has no EXTINT line available.");
157
+    #endif
158
+    attachInterrupt(Z2_MAX_PIN, endstop_ISR, CHANGE);
159
+  #endif
160
+  #if HAS_Z2_MIN
161
+    #if !AVAILABLE_EILINE(Z2_MIN_PIN)
162
+      static_assert(false, "Z2_MIN_PIN has no EXTINT line available.");
163
+    #endif
164
+    attachInterrupt(Z2_MIN_PIN, endstop_ISR, CHANGE);
165
+  #endif
166
+  #if HAS_Z3_MAX
167
+    #if !AVAILABLE_EILINE(Z3_MAX_PIN)
168
+      static_assert(false, "Z3_MAX_PIN has no EXTINT line available.");
169
+    #endif
170
+    attachInterrupt(Z3_MAX_PIN, endstop_ISR, CHANGE);
171
+  #endif
172
+  #if HAS_Z3_MIN
173
+    #if !AVAILABLE_EILINE(Z3_MIN_PIN)
174
+      static_assert(false, "Z3_MIN_PIN has no EXTINT line available.");
175
+    #endif
176
+    attachInterrupt(Z3_MIN_PIN, endstop_ISR, CHANGE);
177
+  #endif
178
+  #if HAS_Z_MIN_PROBE_PIN
179
+    #if !AVAILABLE_EILINE(Z_MIN_PROBE_PIN)
180
+      static_assert(false, "Z_MIN_PROBE_PIN has no EXTINT line available.");
181
+    #endif
182
+    attachInterrupt(Z_MIN_PROBE_PIN, endstop_ISR, CHANGE);
183
+  #endif
184
+}

+ 251
- 0
Marlin/src/HAL/HAL_SAMD51/fastio_SAMD51.h Bestand weergeven

@@ -0,0 +1,251 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+/**
24
+ * Fast IO functions for SAMD51
25
+ */
26
+
27
+#include "SAMD51.h"
28
+
29
+/**
30
+ * Utility functions
31
+ */
32
+
33
+#ifndef MASK
34
+  #define MASK(PIN) (1 << PIN)
35
+#endif
36
+
37
+/**
38
+ * Magic I/O routines
39
+ *
40
+ * Now you can simply SET_OUTPUT(STEP); WRITE(STEP, HIGH); WRITE(STEP, LOW);
41
+ */
42
+
43
+// Read a pin
44
+#define READ(IO)        ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].IN.reg & MASK(GET_SAMD_PIN(IO))) != 0)
45
+
46
+// Write to a pin
47
+#define WRITE(IO,V)     do{                                                     \
48
+                          const EPortType port = (EPortType)GET_SAMD_PORT(IO);  \
49
+                          const uint32_t mask = MASK(GET_SAMD_PIN(IO));         \
50
+                                                                                \
51
+                          if (V) PORT->Group[port].OUTSET.reg = mask;           \
52
+                          else PORT->Group[port].OUTCLR.reg = mask;             \
53
+                        }while(0)
54
+
55
+// Toggle a pin
56
+#define TOGGLE(IO)      PORT->Group[(EPortType)GET_SAMD_PORT(IO)].OUTTGL.reg = MASK(GET_SAMD_PIN(IO));
57
+
58
+// Set pin as input
59
+#define SET_INPUT(IO)           do{                                                                 \
60
+                                  const EPortType port = (EPortType)GET_SAMD_PORT(IO);              \
61
+                                  const uint32_t pin = GET_SAMD_PIN(IO);                            \
62
+                                                                                                    \
63
+                                  PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_INEN);  \
64
+                                  PORT->Group[port].DIRCLR.reg = MASK(pin);                         \
65
+                                }while(0)
66
+// Set pin as input with pullup
67
+#define SET_INPUT_PULLUP(IO)    do{                                                                                       \
68
+                                  const EPortType port = (EPortType)GET_SAMD_PORT(IO);                                    \
69
+                                  const uint32_t pin = GET_SAMD_PIN(IO);                                                  \
70
+                                  const uint32_t mask = MASK(pin);                                                        \
71
+                                                                                                                          \
72
+                                  PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);   \
73
+                                  PORT->Group[port].DIRCLR.reg = mask;                                                    \
74
+                                  PORT->Group[port].OUTSET.reg = mask;                                                    \
75
+                                }while(0)
76
+// Set pin as input with pulldown
77
+#define SET_INPUT_PULLDOWN(IO)  do{                                                                                       \
78
+                                  const EPortType port = (EPortType)GET_SAMD_PORT(IO);                                    \
79
+                                  const uint32_t pin = GET_SAMD_PIN(IO);                                                  \
80
+                                  const uint32_t mask = MASK(pin);                                                        \
81
+                                                                                                                          \
82
+                                  PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_INEN | PORT_PINCFG_PULLEN);   \
83
+                                  PORT->Group[port].DIRCLR.reg = mask;                                                    \
84
+                                  PORT->Group[port].OUTCLR.reg = mask;                                                    \
85
+                                }while(0)
86
+// Set pin as output (push pull)
87
+#define SET_OUTPUT(IO)          do{                                                                 \
88
+                                  const EPortType port = (EPortType)GET_SAMD_PORT(IO);              \
89
+                                  const uint32_t pin = GET_SAMD_PIN(IO);                            \
90
+                                                                                                    \
91
+                                  PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_INEN);  \
92
+                                  PORT->Group[port].DIRSET.reg = MASK(pin);                         \
93
+                                }while(0)
94
+// Set pin as output (open drain)
95
+#define SET_OUTPUT_OD(IO)       do{                                                                   \
96
+                                  const EPortType port = (EPortType)GET_SAMD_PORT(IO);                \
97
+                                  const uint32_t pin = GET_SAMD_PIN(IO);                              \
98
+                                                                                                      \
99
+                                  PORT->Group[port].PINCFG[pin].reg = (uint8_t)(PORT_PINCFG_PULLEN);  \
100
+                                  PORT->Group[port].DIRCLR.reg = MASK(pin);                           \
101
+                                }while(0)
102
+// Set pin as PWM (push pull)
103
+#define SET_PWM(IO)             SET_OUTPUT(IO)
104
+// Set pin as PWM (open drain)
105
+#define SET_PWM_OD(IO)          SET_OUTPUT_OD(IO)
106
+
107
+// check if pin is an output
108
+#define IS_OUTPUT(IO)            ((PORT->Group[(EPortType)GET_SAMD_PORT(IO)].DIR.reg & MASK(GET_SAMD_PIN(IO))) \
109
+                                 || (PORT->Group[(EPortType)GET_SAMD_PORT(IO)].PINCFG[GET_SAMD_PIN(IO)].reg & (PORT_PINCFG_INEN | PORT_PINCFG_PULLEN)) == PORT_PINCFG_PULLEN)
110
+// check if pin is an input
111
+#define IS_INPUT(IO)            !IS_OUTPUT(IO)
112
+
113
+// Shorthand
114
+#define OUT_WRITE(IO,V)         do{ SET_OUTPUT(IO); WRITE(IO,V); }while(0)
115
+#define OUT_WRITE_OD(IO,V)      do{ SET_OUTPUT_OD(IO); WRITE(IO,V); }while(0)
116
+
117
+// digitalRead/Write wrappers
118
+#define extDigitalRead(IO)      digitalRead(IO)
119
+#define extDigitalWrite(IO,V)   digitalWrite(IO,V)
120
+
121
+/**
122
+ * Ports and functions
123
+ * Added as necessary or if I feel like it- not a comprehensive list!
124
+ */
125
+
126
+#ifdef ADAFRUIT_GRAND_CENTRAL_M4
127
+
128
+  /*
129
+   * Adafruit Grand Central M4 has a lot of PWMs the availables are listed here.
130
+   * Some of these share the same source and so can't be used in the same time
131
+   */
132
+  #define PWM_PIN(P)        (WITHIN(P, 2, 13) || WITHIN(P, 22, 23) || WITHIN(P, 44, 45) || P == 48)
133
+
134
+  // Return fullfilled ADCx->INPUTCTRL.reg
135
+  #define PIN_TO_INPUTCTRL(P)     (  (PIN_TO_AIN(P) == 0) ? ADC_INPUTCTRL_MUXPOS_AIN0   \
136
+                                   : (PIN_TO_AIN(P) == 1) ? ADC_INPUTCTRL_MUXPOS_AIN1   \
137
+                                   : (PIN_TO_AIN(P) == 2) ? ADC_INPUTCTRL_MUXPOS_AIN2   \
138
+                                   : (PIN_TO_AIN(P) == 3) ? ADC_INPUTCTRL_MUXPOS_AIN3   \
139
+                                   : (PIN_TO_AIN(P) == 4) ? ADC_INPUTCTRL_MUXPOS_AIN4   \
140
+                                   : (PIN_TO_AIN(P) == 5) ? ADC_INPUTCTRL_MUXPOS_AIN5   \
141
+                                   : (PIN_TO_AIN(P) == 6) ? ADC_INPUTCTRL_MUXPOS_AIN6   \
142
+                                   : (PIN_TO_AIN(P) == 7) ? ADC_INPUTCTRL_MUXPOS_AIN7   \
143
+                                   : (PIN_TO_AIN(P) == 8) ? ADC_INPUTCTRL_MUXPOS_AIN8   \
144
+                                   : (PIN_TO_AIN(P) == 9) ? ADC_INPUTCTRL_MUXPOS_AIN9   \
145
+                                   : (PIN_TO_AIN(P) == 10) ? ADC_INPUTCTRL_MUXPOS_AIN10 \
146
+                                   : (PIN_TO_AIN(P) == 11) ? ADC_INPUTCTRL_MUXPOS_AIN11 \
147
+                                   : (PIN_TO_AIN(P) == 12) ? ADC_INPUTCTRL_MUXPOS_AIN12 \
148
+                                   : (PIN_TO_AIN(P) == 13) ? ADC_INPUTCTRL_MUXPOS_AIN13 \
149
+                                   : (PIN_TO_AIN(P) == 14) ? ADC_INPUTCTRL_MUXPOS_AIN14 \
150
+                                   : ADC_INPUTCTRL_MUXPOS_AIN15)
151
+
152
+  #define ANAPIN_TO_SAMDPIN(P)    (  (P == 0) ? PIN_TO_SAMD_PIN(67)   \
153
+                                   : (P == 1) ? PIN_TO_SAMD_PIN(68)   \
154
+                                   : (P == 2) ? PIN_TO_SAMD_PIN(69)   \
155
+                                   : (P == 3) ? PIN_TO_SAMD_PIN(70)   \
156
+                                   : (P == 4) ? PIN_TO_SAMD_PIN(71)   \
157
+                                   : (P == 5) ? PIN_TO_SAMD_PIN(72)   \
158
+                                   : (P == 6) ? PIN_TO_SAMD_PIN(73)   \
159
+                                   : (P == 7) ? PIN_TO_SAMD_PIN(74)   \
160
+                                   : (P == 8) ? PIN_TO_SAMD_PIN(54)   \
161
+                                   : (P == 9) ? PIN_TO_SAMD_PIN(55)   \
162
+                                   : (P == 10) ? PIN_TO_SAMD_PIN(56)  \
163
+                                   : (P == 11) ? PIN_TO_SAMD_PIN(57)  \
164
+                                   : (P == 12) ? PIN_TO_SAMD_PIN(58)  \
165
+                                   : (P == 13) ? PIN_TO_SAMD_PIN(59)  \
166
+                                   : (P == 14) ? PIN_TO_SAMD_PIN(60)  \
167
+                                   : (P == 15) ? PIN_TO_SAMD_PIN(61)  \
168
+                                   : (P == 16) ? PIN_TO_SAMD_PIN(12)  \
169
+                                   : (P == 17) ? PIN_TO_SAMD_PIN(13)  \
170
+                                   : PIN_TO_SAMD_PIN(9))
171
+
172
+  #define digitalPinToAnalogInput(P) (WITHIN(P, 67, 74) ? (P) - 67 : WITHIN(P, 54, 61) ? 8 + (P) - 54 : WITHIN(P, 12, 13) ? 16 + (P) - 12 : P == 9 ? 18 : -1)
173
+
174
+  /*
175
+   * pins
176
+   */
177
+
178
+   // PORTA
179
+  #define DIO67_PIN   PIN_PA02    // A0
180
+  #define DIO59_PIN   PIN_PA04    // A13
181
+  #define DIO68_PIN   PIN_PA05    // A1
182
+  #define DIO60_PIN   PIN_PA06    // A14
183
+  #define DIO61_PIN   PIN_PA07    // A15
184
+  #define DIO26_PIN   PIN_PA12
185
+  #define DIO27_PIN   PIN_PA13
186
+  #define DIO28_PIN   PIN_PA14
187
+  #define DIO23_PIN   PIN_PA15
188
+  #define DIO37_PIN   PIN_PA16
189
+  #define DIO36_PIN   PIN_PA17
190
+  #define DIO35_PIN   PIN_PA18
191
+  #define DIO34_PIN   PIN_PA19
192
+  #define DIO33_PIN   PIN_PA20
193
+  #define DIO32_PIN   PIN_PA21
194
+  #define DIO31_PIN   PIN_PA22
195
+  #define DIO30_PIN   PIN_PA23
196
+  // PORTB
197
+  #define DIO12_PIN   PIN_PB00    // A16
198
+  #define DIO13_PIN   PIN_PB01    // A17
199
+  #define DIO9_PIN    PIN_PB02    // A18
200
+  #define DIO69_PIN   PIN_PB03    // A2
201
+  #define DIO74_PIN   PIN_PB04    // A7
202
+  #define DIO54_PIN   PIN_PB05    // A8
203
+  #define DIO55_PIN   PIN_PB06    // A9
204
+  #define DIO56_PIN   PIN_PB07    // A10
205
+  #define DIO57_PIN   PIN_PB08    // A11
206
+  #define DIO58_PIN   PIN_PB09    // A12
207
+  #define DIO18_PIN   PIN_PB12
208
+  #define DIO19_PIN   PIN_PB13
209
+  #define DIO39_PIN   PIN_PB14
210
+  #define DIO38_PIN   PIN_PB15
211
+  #define DIO14_PIN   PIN_PB16
212
+  #define DIO15_PIN   PIN_PB17
213
+  #define DIO8_PIN    PIN_PB18
214
+  #define DIO29_PIN   PIN_PB19
215
+  #define DIO20_PIN   PIN_PB20
216
+  #define DIO21_PIN   PIN_PB21
217
+  #define DIO10_PIN   PIN_PB22
218
+  #define DIO11_PIN   PIN_PB23
219
+  #define DIO1_PIN    PIN_PB24
220
+  #define DIO0_PIN    PIN_PB25
221
+  #define DIO83_PIN   PIN_PB28    // SD_CS
222
+  #define DIO95_PIN   PIN_PB31    // SD_CD
223
+  // PORTC
224
+  #define DIO70_PIN   PIN_PC00    // A3
225
+  #define DIO71_PIN   PIN_PC01    // A4
226
+  #define DIO72_PIN   PIN_PC02    // A5
227
+  #define DIO73_PIN   PIN_PC03    // A6
228
+  #define DIO48_PIN   PIN_PC04
229
+  #define DIO49_PIN   PIN_PC05
230
+  #define DIO46_PIN   PIN_PC06
231
+  #define DIO47_PIN   PIN_PC07
232
+  #define DIO45_PIN   PIN_PC10
233
+  #define DIO44_PIN   PIN_PC11
234
+  #define DIO41_PIN   PIN_PC12
235
+  #define DIO40_PIN   PIN_PC13
236
+  #define DIO43_PIN   PIN_PC14
237
+  #define DIO42_PIN   PIN_PC15
238
+  #define DIO25_PIN   PIN_PC16
239
+  #define DIO24_PIN   PIN_PC17
240
+  #define DIO2_PIN    PIN_PC18
241
+  #define DIO3_PIN    PIN_PC19
242
+  #define DIO4_PIN    PIN_PC20
243
+  #define DIO5_PIN    PIN_PC21
244
+  #define DIO16_PIN   PIN_PC22
245
+  #define DIO17_PIN   PIN_PC23
246
+  // PORTD
247
+  #define DIO22_PIN   PIN_PD12
248
+  #define DIO6_PIN    PIN_PD20
249
+  #define DIO7_PIN    PIN_PD21
250
+
251
+#endif // ADAFRUIT_GRAND_CENTRAL_M4

+ 129
- 0
Marlin/src/HAL/HAL_SAMD51/persistent_store_eeprom.cpp Bestand weergeven

@@ -0,0 +1,129 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+#ifdef __SAMD51__
23
+
24
+#include "../../inc/MarlinConfig.h"
25
+
26
+#if ENABLED(EEPROM_SETTINGS)
27
+
28
+#include "../shared/persistent_store_api.h"
29
+
30
+#if NONE(SPI_EEPROM, I2C_EEPROM)
31
+  #define NVMCTRL_CMD(c)    do{                                                 \
32
+                              SYNC(!NVMCTRL->STATUS.bit.READY);                 \
33
+                              NVMCTRL->INTFLAG.bit.DONE = true;                 \
34
+                              NVMCTRL->CTRLB.reg = c | NVMCTRL_CTRLB_CMDEX_KEY; \
35
+                              SYNC(NVMCTRL->INTFLAG.bit.DONE);                  \
36
+                            }while(0)
37
+  #define NVMCTRL_FLUSH()   do{                                           \
38
+                              if (NVMCTRL->SEESTAT.bit.LOAD)              \
39
+                                NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_SEEFLUSH);  \
40
+                            }while(0)
41
+#endif
42
+
43
+bool PersistentStore::access_start() {
44
+  #if NONE(SPI_EEPROM, I2C_EEPROM)
45
+    NVMCTRL->SEECFG.reg = NVMCTRL_SEECFG_WMODE_BUFFERED;  // Buffered mode and segment reallocation active
46
+  #endif
47
+
48
+  return true; 
49
+}
50
+
51
+bool PersistentStore::access_finish() {
52
+  #if NONE(SPI_EEPROM, I2C_EEPROM)
53
+    NVMCTRL_FLUSH();
54
+    if (!NVMCTRL->SEESTAT.bit.LOCK)
55
+      NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_LSEE);    // Lock E2P data write access
56
+  #endif
57
+
58
+  return true;
59
+}
60
+
61
+bool PersistentStore::write_data(int &pos, const uint8_t *value, size_t size, uint16_t *crc) {
62
+  #if NONE(SPI_EEPROM, I2C_EEPROM)
63
+    if (NVMCTRL->SEESTAT.bit.RLOCK)
64
+      NVMCTRL_CMD(NVMCTRL_CTRLB_CMD_USEE);    // Unlock E2P data write access
65
+  #endif
66
+
67
+  while (size--) {
68
+    const uint8_t v = *value;
69
+    #if ANY(SPI_EEPROM, I2C_EEPROM)
70
+      uint8_t * const p = (uint8_t * const)pos;
71
+      if (v != eeprom_read_byte(p)) {
72
+        eeprom_write_byte(p, v);
73
+        delay(2);
74
+        if (eeprom_read_byte(p) != v) {
75
+          SERIAL_ECHO_MSG(MSG_ERR_EEPROM_WRITE);
76
+          return true;
77
+        }
78
+      }
79
+    #else
80
+      SYNC(NVMCTRL->SEESTAT.bit.BUSY);
81
+      if (NVMCTRL->INTFLAG.bit.SEESFULL)
82
+        NVMCTRL_FLUSH();      // Next write will trigger a sector reallocation. I need to flush 'pagebuffer'
83
+      ((volatile uint8_t *)SEEPROM_ADDR)[pos] = v;
84
+      SYNC(!NVMCTRL->INTFLAG.bit.SEEWRC);
85
+    #endif
86
+    crc16(crc, &v, 1);
87
+    pos++;
88
+    value++;
89
+  }
90
+  return false;
91
+}
92
+
93
+bool PersistentStore::read_data(int &pos, uint8_t* value, size_t size, uint16_t *crc, const bool writing/*=true*/) {
94
+  while (size--) {
95
+    uint8_t c;
96
+    #if ANY(SPI_EEPROM, I2C_EEPROM)
97
+      c = eeprom_read_byte((uint8_t*)pos);
98
+    #else
99
+      SYNC(NVMCTRL->SEESTAT.bit.BUSY);
100
+      c = ((volatile uint8_t *)SEEPROM_ADDR)[pos];
101
+    #endif
102
+    if (writing) *value = c;
103
+    crc16(crc, &c, 1);
104
+    pos++;
105
+    value++;
106
+  }
107
+  return false;
108
+}
109
+
110
+size_t PersistentStore::capacity() {
111
+  #if ANY(SPI_EEPROM, I2C_EEPROM)
112
+    return E2END + 1;
113
+  #else
114
+    const uint8_t psz = NVMCTRL->SEESTAT.bit.PSZ,
115
+                  sblk = NVMCTRL->SEESTAT.bit.SBLK;
116
+
117
+         if (!psz && !sblk)         return     0;
118
+    else if (psz <= 2)              return (0x200 << psz);
119
+    else if (sblk == 1 || psz == 3) return  4096;
120
+    else if (sblk == 2 || psz == 4) return  8192;
121
+    else if (sblk <= 4 || psz == 5) return 16384;
122
+    else if (sblk >= 9 && psz == 7) return 65536;
123
+    else                            return 32768;
124
+  #endif
125
+}
126
+
127
+#endif // EEPROM_SETTINGS
128
+
129
+#endif // __SAMD51__

+ 153
- 0
Marlin/src/HAL/HAL_SAMD51/pinsDebug.h Bestand weergeven

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

+ 54
- 0
Marlin/src/HAL/HAL_SAMD51/spi_pins.h Bestand weergeven

@@ -0,0 +1,54 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+#ifdef ADAFRUIT_GRAND_CENTRAL_M4
24
+
25
+ /*
26
+  * AGCM4 Default SPI Pins
27
+  *
28
+  *         SS    SCK   MISO   MOSI
29
+  *       +-------------------------+
30
+  *  SPI  | 53    52     50     51  |
31
+  *  SPI1 | 83    81     80     82  |
32
+  *       +-------------------------+
33
+  * Any pin can be used for Chip Select (SS_PIN)
34
+  */
35
+  #ifndef SCK_PIN
36
+    #define SCK_PIN       52
37
+  #endif
38
+  #ifndef MISO_PIN
39
+    #define MISO_PIN      50
40
+  #endif
41
+  #ifndef MOSI_PIN
42
+    #define MOSI_PIN      51
43
+  #endif
44
+  #ifndef SDSS
45
+    #define SDSS          53
46
+  #endif
47
+
48
+#else
49
+
50
+  #error "Unsupported board!"
51
+
52
+#endif
53
+
54
+#define SS_PIN        SDSS

+ 53
- 0
Marlin/src/HAL/HAL_SAMD51/watchdog_SAMD51.cpp Bestand weergeven

@@ -0,0 +1,53 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+
22
+#ifdef __SAMD51__
23
+
24
+#include "../../inc/MarlinConfig.h"
25
+
26
+#if ENABLED(USE_WATCHDOG)
27
+
28
+  #include "watchdog_SAMD51.h"
29
+
30
+  void watchdog_init(void) {
31
+    // The low-power oscillator used by the WDT runs at 32,768 Hz with
32
+    // a 1:32 prescale, thus 1024 Hz, though probably not super precise.
33
+
34
+    // Setup WDT clocks
35
+    MCLK->APBAMASK.bit.OSC32KCTRL_ = true;
36
+    MCLK->APBAMASK.bit.WDT_ = true;
37
+    OSC32KCTRL->OSCULP32K.bit.EN1K = true;      // Enable out 1K (this is what WDT uses)
38
+
39
+    WDT->CTRLA.bit.ENABLE = false;              // Disable watchdog for config
40
+    SYNC(WDT->SYNCBUSY.bit.ENABLE);
41
+
42
+    WDT->INTENCLR.reg = WDT_INTENCLR_EW;        // Disable early warning interrupt
43
+    WDT->CONFIG.reg = WDT_CONFIG_PER_CYC4096;   // Set at least 4s period for chip reset
44
+
45
+    watchdog_reset();
46
+
47
+    WDT->CTRLA.reg = WDT_CTRLA_ENABLE;          // Start watchdog now in normal mode
48
+    SYNC(WDT->SYNCBUSY.bit.ENABLE);
49
+  }
50
+
51
+#endif // USE_WATCHDOG
52
+
53
+#endif // __SAMD51__

+ 31
- 0
Marlin/src/HAL/HAL_SAMD51/watchdog_SAMD51.h Bestand weergeven

@@ -0,0 +1,31 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ *
4
+ * Copyright (C) 2019 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
5
+ * SAMD51 HAL developed by Giuliano Zaro (AKA GMagician)
6
+ *
7
+ * This program is free software: you can redistribute it and/or modify
8
+ * it under the terms of the GNU General Public License as published by
9
+ * the Free Software Foundation, either version 3 of the License, or
10
+ * (at your option) any later version.
11
+ *
12
+ * This program is distributed in the hope that it will be useful,
13
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
+ * GNU General Public License for more details.
16
+ *
17
+ * You should have received a copy of the GNU General Public License
18
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
+ *
20
+ */
21
+#pragma once
22
+
23
+// Initialize watchdog with a 4 second interrupt time
24
+void watchdog_init();
25
+
26
+// Reset watchdog. MUST be called at least every 4 seconds after the
27
+// first watchdog_init or SAMD will go into emergency procedures.
28
+inline void watchdog_reset() {
29
+  SYNC(WDT->SYNCBUSY.bit.CLEAR);        // Test first if previous is 'ongoing' to save time waiting for command execution
30
+  WDT->CLEAR.reg = WDT_CLEAR_CLEAR_KEY;
31
+}

+ 11
- 0
Marlin/src/HAL/shared/backtrace/unwmemaccess.cpp Bestand weergeven

@@ -129,6 +129,17 @@
129 129
 #define END_FLASH_ADDR    0x00140000
130 130
 #endif
131 131
 
132
+#ifdef __SAMD51P20A__
133
+// For SAMD51x20, valid address ranges are
134
+//  SRAM  (0x20000000 - 0x20040000) (256kb)
135
+//  FLASH (0x00000000 - 0x00100000) (1024kb)
136
+//
137
+#define START_SRAM_ADDR   0x20000000
138
+#define END_SRAM_ADDR     0x20040000
139
+#define START_FLASH_ADDR  0x00000000
140
+#define END_FLASH_ADDR    0x00100000
141
+#endif
142
+
132 143
 static bool validate_addr(uint32_t addr) {
133 144
 
134 145
   // Address must be in SRAM range

+ 5
- 0
Marlin/src/core/boards.h Bestand weergeven

@@ -303,6 +303,11 @@
303 303
 #define BOARD_ESP32                   6000
304 304
 
305 305
 //
306
+// SAMD51 ARM Cortex M4
307
+//
308
+#define BOARD_AGCM4_RURAMPS4D_13      6100
309
+
310
+//
306 311
 // Simulations
307 312
 //
308 313
 

+ 1
- 1
Marlin/src/core/drivers.h Bestand weergeven

@@ -120,7 +120,7 @@
120 120
                                    || AXIS_DRIVER_TYPE(A,TMC5160) )
121 121
 
122 122
 //
123
-// Stretching 'drivers.h' to include LPC SD options
123
+// Stretching 'drivers.h' to include LPC/SAMD51 SD options
124 124
 //
125 125
 #define _SDCARD_LCD          1
126 126
 #define _SDCARD_ONBOARD      2

+ 15
- 1
Marlin/src/gcode/calibrate/M100.cpp Bestand weergeven

@@ -75,7 +75,7 @@
75 75
 
76 76
   char *end_bss = &__bss_end__,
77 77
        *stacklimit = &__StackLimit,
78
-       *heaplimit = &__HeapLimit ;
78
+       *heaplimit = &__HeapLimit;
79 79
 
80 80
   #define MEMORY_END_CORRECTION 0x200
81 81
 
@@ -94,6 +94,20 @@
94 94
 
95 95
   #define MEMORY_END_CORRECTION 0x10000  // need to stay well below 0x20080000 or M100 F crashes
96 96
 
97
+#elif defined(__SAMD51__)
98
+
99
+  extern unsigned int __bss_end__, __StackLimit, __HeapLimit;
100
+  extern "C" void * _sbrk(int incr);
101
+
102
+  void *end_bss = &__bss_end__,
103
+       *stacklimit = &__StackLimit,
104
+       *heaplimit = &__HeapLimit;
105
+
106
+  #define MEMORY_END_CORRECTION 0x400
107
+
108
+  char *free_memory_start = (char *)_sbrk(0) + 0x200,     //  Leave some heap space
109
+       *free_memory_end = (char *)stacklimit - MEMORY_END_CORRECTION;
110
+
97 111
 #else
98 112
   #error "M100 - unsupported CPU"
99 113
 #endif

+ 2
- 0
Marlin/src/inc/Conditionals_LCD.h Bestand weergeven

@@ -605,3 +605,5 @@
605 605
 #endif
606 606
 
607 607
 #define IS_RE_ARM_BOARD (MB(RAMPS_14_RE_ARM_EFB) || MB(RAMPS_14_RE_ARM_EEB) || MB(RAMPS_14_RE_ARM_EFF) || MB(RAMPS_14_RE_ARM_EEF) || MB(RAMPS_14_RE_ARM_SF))
608
+
609
+#define HAS_SDCARD_CONNECTION EITHER(TARGET_LPC1768, ADAFRUIT_GRAND_CENTRAL_M4)

+ 7
- 0
Marlin/src/pins/pins.h Bestand weergeven

@@ -516,6 +516,13 @@
516 516
   #include "esp32/pins_ESP32.h"                 // ESP32                                  env:esp32
517 517
 
518 518
 //
519
+// Adafruit Grand Central M4 (SAMD51 ARM Cortex-M4)
520
+//
521
+
522
+#elif MB(AGCM4_RURAMPS4D_13)
523
+  #include "samd/pins_AGCM4_RURAMPS4D_13.h"     // SAMD51                                 env:adafruit_grandcentral_m4
524
+
525
+//
519 526
 // Linux Native Debug board
520 527
 //
521 528
 

+ 1
- 1
Marlin/src/pins/pinsDebug_list.h Bestand weergeven

@@ -51,7 +51,7 @@
51 51
 #if PIN_EXISTS(MAIN_VOLTAGE_MEASURE) && MAIN_VOLTAGE_MEASURE_PIN < NUM_ANALOG_INPUTS
52 52
   REPORT_NAME_ANALOG(__LINE__, MAIN_VOLTAGE_MEASURE_PIN)
53 53
 #endif
54
-#if !defined(ARDUINO_ARCH_SAM)  //TC1 & TC2 are macros in the SAM tool chain
54
+#if !defined(ARDUINO_ARCH_SAM) && !defined(ARDUINO_ARCH_SAMD)  //TC1 & TC2 are macros in the SAM/SAMD tool chain
55 55
   #if defined(TC1) && TC1 >= 0 && TC1 < NUM_ANALOG_INPUTS
56 56
     REPORT_NAME_ANALOG(__LINE__, TC1)
57 57
   #endif

+ 254
- 0
Marlin/src/pins/samd/pins_AGCM4_RURAMPS4D_13.h Bestand weergeven

@@ -0,0 +1,254 @@
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
+/**
23
+ * Adafruit Grand Central M4 pin assignments ported by Giuliano Zaro
24
+ */
25
+#ifndef ARDUINO_GRAND_CENTRAL_M4
26
+  #error "Oops! Select 'Adafruit Grand Central M4' in 'Tools > Board.'"
27
+#endif
28
+
29
+#define BOARD_NAME "RuRAMPS4AGCM4 v1.3"
30
+
31
+//
32
+// Servos
33
+//
34
+#define SERVO0_PIN          5
35
+#define SERVO1_PIN          3
36
+
37
+//
38
+// Limit Switches
39
+//
40
+#define X_MIN_PIN          45
41
+#define X_MAX_PIN          39
42
+#define Y_MIN_PIN          46
43
+#define Y_MAX_PIN          41
44
+#define Z_MIN_PIN          47
45
+#define Z_MAX_PIN          43
46
+
47
+//
48
+// Z Probe (when not Z_MIN_PIN)
49
+//
50
+#ifndef Z_MIN_PROBE_PIN
51
+  #define Z_MIN_PROBE_PIN  49
52
+#endif
53
+
54
+//
55
+// Steppers
56
+//
57
+#define X_STEP_PIN         37   // Support Extension Board
58
+#define X_DIR_PIN          36
59
+#define X_ENABLE_PIN       31
60
+#ifndef X_CS_PIN
61
+  #define X_CS_PIN         38
62
+#endif
63
+
64
+#define Y_STEP_PIN         32   // Support Extension Board
65
+#define Y_DIR_PIN          35
66
+#define Y_ENABLE_PIN       31
67
+#ifndef Y_CS_PIN
68
+  #define Y_CS_PIN         34
69
+#endif
70
+
71
+#define Z_STEP_PIN         30   // Support Extension Board
72
+#define Z_DIR_PIN           2
73
+#define Z_ENABLE_PIN       31
74
+#ifndef Z_CS_PIN
75
+  #define Z_CS_PIN         10
76
+#endif
77
+
78
+#define E0_STEP_PIN        29
79
+#define E0_DIR_PIN         28
80
+#define E0_ENABLE_PIN      33
81
+#ifndef E0_CS_PIN
82
+  #define E0_CS_PIN        14
83
+#endif
84
+
85
+#define E1_STEP_PIN        22
86
+#define E1_DIR_PIN         24
87
+#define E1_ENABLE_PIN      26
88
+#ifndef E1_CS_PIN
89
+  #define E1_CS_PIN        15
90
+#endif
91
+
92
+#define E2_STEP_PIN        25
93
+#define E2_DIR_PIN         23
94
+#define E2_ENABLE_PIN      27
95
+#ifndef E2_CS_PIN
96
+  #define E2_CS_PIN        74
97
+#endif
98
+
99
+#if USES_Z_MIN_PROBE_ENDSTOP
100
+  #define Z_MIN_PROBE_PIN  49
101
+#endif
102
+
103
+#if HAS_FILAMENT_SENSOR
104
+  #ifndef FIL_RUNOUT_PIN
105
+    #define FIL_RUNOUT_PIN   Y_MIN_PIN
106
+  #endif
107
+#endif
108
+
109
+//
110
+// Heaters / Fans
111
+//
112
+#define HEATER_0_PIN       13
113
+#define HEATER_1_PIN       12
114
+#define HEATER_2_PIN       11
115
+#define HEATER_BED_PIN      7   // BED H1
116
+
117
+#define FAN_PIN             9
118
+#define FAN1_PIN            8
119
+#define CONTROLLER_FAN_PIN -1
120
+
121
+//
122
+// Temperature Sensors
123
+//
124
+#define TEMP_0_PIN          0   // ANALOG A0
125
+#define TEMP_1_PIN          1   // ANALOG A1
126
+#define TEMP_2_PIN          2   // ANALOG A2
127
+#define TEMP_3_PIN          3   // ANALOG A3
128
+#define TEMP_BED_PIN        4   // ANALOG A4
129
+
130
+// The thermocouple uses Analog pins
131
+#if ENABLED(VER_WITH_THERMOCOUPLE) // Must be defined in Configuration.h
132
+  #define TEMP_4_PIN        5   // A5
133
+  #define TEMP_5_PIN        6   // A6 (Marlin 2.0 not support)
134
+#endif
135
+
136
+// SPI for Max6675 or Max31855 Thermocouple
137
+/*
138
+#if DISABLED(SDSUPPORT)
139
+  #define MAX6675_SS_PIN   53
140
+#else
141
+  #define MAX6675_SS_PIN   49
142
+#endif
143
+*/
144
+
145
+//
146
+// Misc. Functions
147
+//
148
+#define SDSS                4
149
+#define LED_PIN            -1   // 13 - HEATER_0_PIN
150
+#define PS_ON_PIN          -1   // 57
151
+
152
+// MKS TFT / Nextion Use internal USART-1
153
+#define TFT_LCD_MODULE_COM        1
154
+#define TFT_LCD_MODULE_BAUDRATE   115200
155
+
156
+// ESP WiFi Use internal USART-2
157
+#define ESP_WIFI_MODULE_COM       2
158
+#define ESP_WIFI_MODULE_BAUDRATE  115200
159
+#define ESP_WIFI_MODULE_RESET_PIN -1
160
+#define PIGGY_GPIO_PIN            -1
161
+
162
+//
163
+// EEPROM
164
+//
165
+#define E2END             0x7FFF  // 32Kb (24lc256)
166
+#define I2C_EEPROM                // EEPROM on I2C
167
+
168
+//
169
+// LCD / Controller
170
+//
171
+#if HAS_SPI_LCD
172
+
173
+  #if EITHER(RADDS_DISPLAY, REPRAP_DISCOUNT_SMART_CONTROLLER)
174
+
175
+    #define BEEPER_PIN     75
176
+    #define LCD_PINS_D4    48
177
+    #define LCD_PINS_D7    53
178
+    #define SD_DETECT_PIN  -1    // 51 can't be used, it's MOSI
179
+    #define LCD_PINS_RS    76
180
+    #define LCD_PINS_ENABLE 77
181
+
182
+  #elif ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER)
183
+
184
+    #define BEEPER_PIN     75
185
+    #define LCD_PINS_D4    48
186
+    #define SD_DETECT_PIN  -1    // 51 can't be used, it's MOSI
187
+    #define LCD_PINS_RS    76
188
+    #define LCD_PINS_ENABLE 77
189
+
190
+  #elif HAS_SSD1306_OLED_I2C
191
+
192
+    #define BEEPER_PIN     75
193
+    #define LCD_SDSS       10
194
+    #define SD_DETECT_PIN  -1    // 51 can't be used, it's MOSI
195
+
196
+  #elif ENABLED(FYSETC_MINI_12864)
197
+
198
+    #define BEEPER_PIN     75
199
+    #define DOGLCD_CS      77
200
+    #define DOGLCD_A0      76
201
+
202
+    //#define FORCE_SOFT_SPI    // Use this if default of hardware SPI causes display problems
203
+                                //   results in LCD soft SPI mode 3, SD soft SPI mode 0
204
+
205
+    #define LCD_RESET_PIN  48   // Must be high or open for LCD to operate normally.
206
+
207
+    #if EITHER(FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0)
208
+      #error "Pin compatibility check needed! Grand central M4 pins 50, 51 and 52 are not GPIO pins, they are wired to MISO, MOSI, and SCK."
209
+      #ifndef RGB_LED_R_PIN
210
+        #define RGB_LED_R_PIN 50   // D5
211
+      #endif
212
+      #ifndef RGB_LED_G_PIN
213
+        #define RGB_LED_G_PIN 52   // D6
214
+      #endif
215
+      #ifndef RGB_LED_B_PIN
216
+        #define RGB_LED_B_PIN 53   // D7
217
+      #endif
218
+    #elif ENABLED(FYSETC_MINI_12864_2_1)
219
+      #error "Pin compatibility check needed! Grand central M4 pins 50, 51 and 52 are not GPIO pins, they are wired to MISO, MOSI, and SCK."
220
+      #define NEOPIXEL_PIN    50   // D5
221
+    #endif
222
+
223
+  #elif ENABLED(MKS_MINI_12864)
224
+    #error "Pin compatibility check needed! Grand central M4 pins 50, 51 and 52 are not GPIO pins, they are wired to MISO, MOSI, and SCK."
225
+    #define ORIG_BEEPER_PIN 75
226
+
227
+    #define DOGLCD_A0      52
228
+    #define DOGLCD_CS      50
229
+
230
+    #define SD_DETECT_PIN  -1    // 51 can't be used, it's MOSI
231
+
232
+  #endif
233
+
234
+  #if ENABLED(NEWPANEL)
235
+    #define BTN_EN1        44
236
+    #define BTN_EN2        42
237
+    #define BTN_ENC        40
238
+  #endif
239
+
240
+#endif // HAS_SPI_LCD
241
+
242
+//
243
+// SD Support
244
+//
245
+#ifndef SDCARD_CONNECTION
246
+  #define SDCARD_CONNECTION ONBOARD
247
+#endif
248
+
249
+#if SD_CONNECTION_IS(ONBOARD)
250
+  #undef SDSS
251
+  #define SDSS             83
252
+  #undef SD_DETECT_PIN
253
+  #define SD_DETECT_PIN    95
254
+#endif

+ 2
- 1
README.md Bestand weergeven

@@ -1,4 +1,4 @@
1
-# Marlin 3D Printer Firmware
1
+# Marlin 3D Printer Firmware
2 2
 
3 3
 [![Build Status](https://travis-ci.org/MarlinFirmware/Marlin.svg?branch=bugfix-2.0.x)](https://travis-ci.org/MarlinFirmware/Marlin)
4 4
 ![GitHub](https://img.shields.io/github/license/marlinfirmware/marlin.svg)
@@ -49,6 +49,7 @@ Marlin 2.0 introduces a layer of abstraction so that all the existing high-level
49 49
   ----|---------|-----|-----|----|-----|---
50 50
   [STEVAL-3DP001V1](http://www.st.com/en/evaluation-tools/steval-3dp001v1.html)|[STM32F401VE Arm-Cortex M4](http://www.st.com/en/microcontrollers/stm32f401ve.html)|84MHz|512k|64+32k|3.3-5V|yes
51 51
   [Smoothieboard](http://reprap.org/wiki/Smoothieboard)|LPC1769 ARM-Cortex M3|120MHz|512k|64k|3.3-5V|no
52
+  [Adafruit Grand Central M4](https://www.adafruit.com/product/4064)|ARM-Cortex M4|120MHz|1M|256k|3.3V|yes
52 53
 
53 54
 ## Submitting Patches
54 55
 

+ 14
- 0
buildroot/share/tests/adafruit_grandcentral_m4-tests Bestand weergeven

@@ -0,0 +1,14 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Build tests for Adafruit Grand Central M4 (ATMEL ARM Cortex-M4)
4
+#
5
+
6
+# exit on first failure
7
+set -e
8
+
9
+restore_configs
10
+opt_set MOTHERBOARD BOARD_AGCM4_RURAMPS4D_13
11
+exec_test $1 $2 "Build Grand Central M4 Default Configuration"
12
+
13
+# clean up
14
+restore_configs

+ 1
- 1
config/default/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/3DFabXYZ/Migbot/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/AlephObjects/TAZ4/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Alfawise/U20/Configuration_adv.h Bestand weergeven

@@ -1040,7 +1040,7 @@
1040 1040
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1041 1041
   //#define BINARY_FILE_TRANSFER
1042 1042
 
1043
-  #ifdef TARGET_LPC1768
1043
+  #if HAS_SDCARD_CONNECTION
1044 1044
     /**
1045 1045
      * Set this option to one of the following (or the board's defaults apply):
1046 1046
      *

+ 1
- 1
config/examples/AliExpress/UM2pExt/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/A2/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/A2plus/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/A6/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/A8/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/A8plus/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Anet/E16/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/AnyCubic/i3/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/ArmEd/Configuration_adv.h Bestand weergeven

@@ -1041,7 +1041,7 @@
1041 1041
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1042 1042
   //#define BINARY_FILE_TRANSFER
1043 1043
 
1044
-  #ifdef TARGET_LPC1768
1044
+  #if HAS_SDCARD_CONNECTION
1045 1045
     /**
1046 1046
      * Set this option to one of the following (or the board's defaults apply):
1047 1047
      *

+ 1
- 1
config/examples/BIBO/TouchX/cyclops/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/BIBO/TouchX/default/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/BQ/Hephestos/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/BQ/Hephestos_2/Configuration_adv.h Bestand weergeven

@@ -1045,7 +1045,7 @@
1045 1045
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1046 1046
   //#define BINARY_FILE_TRANSFER
1047 1047
 
1048
-  #ifdef TARGET_LPC1768
1048
+  #if HAS_SDCARD_CONNECTION
1049 1049
     /**
1050 1050
      * Set this option to one of the following (or the board's defaults apply):
1051 1051
      *

+ 1
- 1
config/examples/BQ/WITBOX/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Cartesio/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-10/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-10S/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-10_5S/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-10mini/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-20 Pro/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-20/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/CR-8/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/Ender-2/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/Ender-3/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/Ender-4/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Creality/Ender-5/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Dagoma/Disco Ultimate/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/EVNOVO (Artillery)/Sidewinder X1/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Einstart-S/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/FYSETC/AIO_II/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/FYSETC/Cheetah/BLTouch/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/FYSETC/Cheetah/base/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/FYSETC/F6_13/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Felix/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/FlashForge/CreatorPro/Configuration_adv.h Bestand weergeven

@@ -1036,7 +1036,7 @@
1036 1036
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1037 1037
   //#define BINARY_FILE_TRANSFER
1038 1038
 
1039
-  #ifdef TARGET_LPC1768
1039
+  #if HAS_SDCARD_CONNECTION
1040 1040
     /**
1041 1041
      * Set this option to one of the following (or the board's defaults apply):
1042 1042
      *

+ 1
- 1
config/examples/FolgerTech/i3-2020/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Formbot/Raptor/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Formbot/T_Rex_2+/Configuration_adv.h Bestand weergeven

@@ -1041,7 +1041,7 @@
1041 1041
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1042 1042
   //#define BINARY_FILE_TRANSFER
1043 1043
 
1044
-  #ifdef TARGET_LPC1768
1044
+  #if HAS_SDCARD_CONNECTION
1045 1045
     /**
1046 1046
      * Set this option to one of the following (or the board's defaults apply):
1047 1047
      *

+ 1
- 1
config/examples/Formbot/T_Rex_3/Configuration_adv.h Bestand weergeven

@@ -1041,7 +1041,7 @@
1041 1041
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1042 1042
   //#define BINARY_FILE_TRANSFER
1043 1043
 
1044
-  #ifdef TARGET_LPC1768
1044
+  #if HAS_SDCARD_CONNECTION
1045 1045
     /**
1046 1046
      * Set this option to one of the following (or the board's defaults apply):
1047 1047
      *

+ 1
- 1
config/examples/Geeetech/A10/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Geeetech/A10M/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Geeetech/A20M/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Geeetech/MeCreator2/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Geeetech/Prusa i3 Pro C/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Geeetech/Prusa i3 Pro W/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Infitary/i3-M508/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/JGAurora/A1/Configuration_adv.h Bestand weergeven

@@ -1042,7 +1042,7 @@
1042 1042
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1043 1043
   //#define BINARY_FILE_TRANSFER
1044 1044
 
1045
-  #ifdef TARGET_LPC1768
1045
+  #if HAS_SDCARD_CONNECTION
1046 1046
     /**
1047 1047
      * Set this option to one of the following (or the board's defaults apply):
1048 1048
      *

+ 1
- 1
config/examples/JGAurora/A5/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/JGAurora/A5S/Configuration_adv.h Bestand weergeven

@@ -1042,7 +1042,7 @@
1042 1042
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1043 1043
   //#define BINARY_FILE_TRANSFER
1044 1044
 
1045
-  #ifdef TARGET_LPC1768
1045
+  #if HAS_SDCARD_CONNECTION
1046 1046
     /**
1047 1047
      * Set this option to one of the following (or the board's defaults apply):
1048 1048
      *

+ 1
- 1
config/examples/MakerParts/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Malyan/M150/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Malyan/M200/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Micromake/C1/enhanced/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Mks/Robin/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Mks/Sbase/Configuration_adv.h Bestand weergeven

@@ -1038,7 +1038,7 @@
1038 1038
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1039 1039
   //#define BINARY_FILE_TRANSFER
1040 1040
 
1041
-  #ifdef TARGET_LPC1768
1041
+  #if HAS_SDCARD_CONNECTION
1042 1042
     /**
1043 1043
      * Set this option to one of the following (or the board's defaults apply):
1044 1044
      *

+ 1
- 1
config/examples/RapideLite/RL200/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/RigidBot/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/SCARA/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/STM32/Black_STM32F407VET6/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Sanguinololu/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Tevo/Michelangelo/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Tevo/Tarantula Pro/Configuration_adv.h Bestand weergeven

@@ -1033,7 +1033,7 @@
1033 1033
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1034 1034
   //#define BINARY_FILE_TRANSFER
1035 1035
 
1036
-  #ifdef TARGET_LPC1768
1036
+  #if HAS_SDCARD_CONNECTION
1037 1037
     /**
1038 1038
      * Set this option to one of the following (or the board's defaults apply):
1039 1039
      *

+ 1
- 1
config/examples/Tevo/Tornado/V1 (MKS Base)/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/Tevo/Tornado/V2 (MKS GEN-L)/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 1
- 1
config/examples/TheBorg/Configuration_adv.h Bestand weergeven

@@ -1037,7 +1037,7 @@
1037 1037
   // Add an optimized binary file transfer mode, initiated with 'M28 B1'
1038 1038
   //#define BINARY_FILE_TRANSFER
1039 1039
 
1040
-  #ifdef TARGET_LPC1768
1040
+  #if HAS_SDCARD_CONNECTION
1041 1041
     /**
1042 1042
      * Set this option to one of the following (or the board's defaults apply):
1043 1043
      *

+ 0
- 0
config/examples/TinyBoy2/Configuration_adv.h Bestand weergeven


Some files were not shown because too many files changed in this diff

Laden…
Annuleren
Opslaan