Переглянути джерело

BTT SKR-SE-BX (STM32H743IIT6 ARM Cortex M7) and BIQU_BX_TFT70 (#21536)

BigTreeTech 3 роки тому
джерело
коміт
b483a8d652
Аккаунт користувача з таким Email не знайдено
30 змінених файлів з 3694 додано та 17 видалено
  1. 1
    0
      .github/workflows/test-builds.yml
  2. 5
    0
      Marlin/Configuration.h
  3. 1
    1
      Marlin/src/HAL/STM32/MarlinSPI.cpp
  4. 2
    2
      Marlin/src/HAL/STM32/inc/SanityCheck.h
  5. 390
    0
      Marlin/src/HAL/STM32/tft/tft_ltdc.cpp
  6. 155
    0
      Marlin/src/HAL/STM32/tft/tft_ltdc.h
  7. 1
    1
      Marlin/src/HAL/STM32/timers.cpp
  8. 1
    0
      Marlin/src/core/boards.h
  9. 24
    1
      Marlin/src/inc/Conditionals_LCD.h
  10. 5
    5
      Marlin/src/inc/SanityCheck.h
  11. 2
    2
      Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp
  12. 1
    1
      Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_view_screen.cpp
  13. 3
    0
      Marlin/src/lcd/tft/tft.h
  14. 927
    0
      Marlin/src/lcd/tft/ui_1024x600.cpp
  15. 43
    0
      Marlin/src/lcd/tft/ui_1024x600.h
  16. 4
    0
      Marlin/src/lcd/tft/ui_common.h
  17. 14
    1
      Marlin/src/lcd/tft_io/tft_io.cpp
  18. 5
    2
      Marlin/src/lcd/tft_io/tft_io.h
  19. 2
    0
      Marlin/src/pins/pins.h
  20. 226
    0
      Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h
  21. 56
    0
      buildroot/share/PlatformIO/boards/BTT_SKR_SE_BX.json
  22. 491
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PeripheralPins.c
  23. 50
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PinNamesVar.h
  24. 479
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/hal_conf_extra.h
  25. 208
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/ldscript.ld
  26. 332
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.cpp
  27. 222
    0
      buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.h
  28. 18
    0
      buildroot/tests/BTT_SKR_SE_BX
  29. 1
    1
      ini/features.ini
  30. 25
    0
      ini/stm32f7.ini

+ 1
- 0
.github/workflows/test-builds.yml Переглянути файл

@@ -89,6 +89,7 @@ jobs:
89 89
         - mks_robin_nano35_stm32
90 90
         - NUCLEO_F767ZI
91 91
         - REMRAM_V1
92
+        - BTT_SKR_SE_BX
92 93
 
93 94
         # Put lengthy tests last
94 95
 

+ 5
- 0
Marlin/Configuration.h Переглянути файл

@@ -2497,6 +2497,11 @@
2497 2497
 //#define ANET_ET5_TFT35
2498 2498
 
2499 2499
 //
2500
+// 1024x600, 7", RGB Stock Display from BIQU-BX
2501
+//
2502
+//#define BIQU_BX_TFT70
2503
+
2504
+//
2500 2505
 // Generic TFT with detailed options
2501 2506
 //
2502 2507
 //#define TFT_GENERIC

+ 1
- 1
Marlin/src/HAL/STM32/MarlinSPI.cpp Переглянути файл

@@ -19,7 +19,7 @@
19 19
  * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20 20
  *
21 21
  */
22
-#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
22
+#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC) && !defined(STM32H7xx)
23 23
 
24 24
 #include "MarlinSPI.h"
25 25
 

+ 2
- 2
Marlin/src/HAL/STM32/inc/SanityCheck.h Переглянути файл

@@ -52,6 +52,6 @@
52 52
   #error "SERIAL_STATS_DROPPED_RX is not supported on STM32."
53 53
 #endif
54 54
 
55
-#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32F4xx, STM32F1xx)
56
-  #error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32F4 and STM32F1 hardware."
55
+#if ANY(TFT_COLOR_UI, TFT_LVGL_UI, TFT_CLASSIC_UI) && NOT_TARGET(STM32H7xx, STM32F4xx, STM32F1xx)
56
+  #error "TFT_COLOR_UI, TFT_LVGL_UI and TFT_CLASSIC_UI are currently only supported on STM32H7, STM32F4 and STM32F1 hardware."
57 57
 #endif

+ 390
- 0
Marlin/src/HAL/STM32/tft/tft_ltdc.cpp Переглянути файл

@@ -0,0 +1,390 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#if defined(ARDUINO_ARCH_STM32) && !defined(STM32GENERIC)
23
+
24
+#include "../../../inc/MarlinConfig.h"
25
+
26
+#if HAS_LTDC_TFT
27
+
28
+#include "tft_ltdc.h"
29
+#include "pinconfig.h"
30
+
31
+#define FRAME_BUFFER_ADDRESS 0XC0000000  // SDRAM address
32
+
33
+#define SDRAM_TIMEOUT                            ((uint32_t)0xFFFF)
34
+#define REFRESH_COUNT                            ((uint32_t)0x02A5)  // SDRAM refresh counter
35
+
36
+#define SDRAM_MODEREG_BURST_LENGTH_1             ((uint16_t)0x0000)
37
+#define SDRAM_MODEREG_BURST_LENGTH_2             ((uint16_t)0x0001)
38
+#define SDRAM_MODEREG_BURST_LENGTH_4             ((uint16_t)0x0002)
39
+#define SDRAM_MODEREG_BURST_LENGTH_8             ((uint16_t)0x0004)
40
+#define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL      ((uint16_t)0x0000)
41
+#define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED     ((uint16_t)0x0008)
42
+#define SDRAM_MODEREG_CAS_LATENCY_2              ((uint16_t)0x0020)
43
+#define SDRAM_MODEREG_CAS_LATENCY_3              ((uint16_t)0x0030)
44
+#define SDRAM_MODEREG_OPERATING_MODE_STANDARD    ((uint16_t)0x0000)
45
+#define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000)
46
+#define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE     ((uint16_t)0x0200)
47
+
48
+
49
+void SDRAM_Initialization_Sequence(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command) {
50
+
51
+  __IO uint32_t tmpmrd =0;
52
+  /* Step 1:  Configure a clock configuration enable command */
53
+  Command->CommandMode = FMC_SDRAM_CMD_CLK_ENABLE;
54
+  Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
55
+  Command->AutoRefreshNumber = 1;
56
+  Command->ModeRegisterDefinition = 0;
57
+  /* Send the command */
58
+  HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
59
+
60
+  /* Step 2: Insert 100 us minimum delay */
61
+  /* Inserted delay is equal to 1 ms due to systick time base unit (ms) */
62
+  HAL_Delay(1);
63
+
64
+  /* Step 3: Configure a PALL (precharge all) command */
65
+  Command->CommandMode = FMC_SDRAM_CMD_PALL;
66
+  Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
67
+  Command->AutoRefreshNumber = 1;
68
+  Command->ModeRegisterDefinition = 0;
69
+  /* Send the command */
70
+  HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
71
+
72
+  /* Step 4 : Configure a Auto-Refresh command */
73
+  Command->CommandMode = FMC_SDRAM_CMD_AUTOREFRESH_MODE;
74
+  Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
75
+  Command->AutoRefreshNumber = 8;
76
+  Command->ModeRegisterDefinition = 0;
77
+  /* Send the command */
78
+  HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
79
+
80
+  /* Step 5: Program the external memory mode register */
81
+  tmpmrd = (uint32_t)(SDRAM_MODEREG_BURST_LENGTH_1          |
82
+                      SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL   |
83
+                      SDRAM_MODEREG_CAS_LATENCY_2           |
84
+                      SDRAM_MODEREG_OPERATING_MODE_STANDARD |
85
+                      SDRAM_MODEREG_WRITEBURST_MODE_SINGLE);
86
+
87
+  Command->CommandMode = FMC_SDRAM_CMD_LOAD_MODE;
88
+  Command->CommandTarget = FMC_SDRAM_CMD_TARGET_BANK1;
89
+  Command->AutoRefreshNumber = 1;
90
+  Command->ModeRegisterDefinition = tmpmrd;
91
+  /* Send the command */
92
+  HAL_SDRAM_SendCommand(hsdram, Command, SDRAM_TIMEOUT);
93
+
94
+  /* Step 6: Set the refresh rate counter */
95
+  /* Set the device refresh rate */
96
+  HAL_SDRAM_ProgramRefreshRate(hsdram, REFRESH_COUNT);
97
+}
98
+
99
+void SDRAM_Config() {
100
+
101
+  __HAL_RCC_SYSCFG_CLK_ENABLE();
102
+  __HAL_RCC_FMC_CLK_ENABLE();
103
+
104
+  SDRAM_HandleTypeDef      hsdram;
105
+  FMC_SDRAM_TimingTypeDef  SDRAM_Timing;
106
+  FMC_SDRAM_CommandTypeDef command;
107
+
108
+  /* Configure the SDRAM device */
109
+  hsdram.Instance = FMC_SDRAM_DEVICE;
110
+  hsdram.Init.SDBank             = FMC_SDRAM_BANK1;
111
+  hsdram.Init.ColumnBitsNumber   = FMC_SDRAM_COLUMN_BITS_NUM_9;
112
+  hsdram.Init.RowBitsNumber      = FMC_SDRAM_ROW_BITS_NUM_13;
113
+  hsdram.Init.MemoryDataWidth    = FMC_SDRAM_MEM_BUS_WIDTH_16;
114
+  hsdram.Init.InternalBankNumber = FMC_SDRAM_INTERN_BANKS_NUM_4;
115
+  hsdram.Init.CASLatency         = FMC_SDRAM_CAS_LATENCY_2;
116
+  hsdram.Init.WriteProtection    = FMC_SDRAM_WRITE_PROTECTION_DISABLE;
117
+  hsdram.Init.SDClockPeriod      = FMC_SDRAM_CLOCK_PERIOD_2;
118
+  hsdram.Init.ReadBurst          = FMC_SDRAM_RBURST_ENABLE;
119
+  hsdram.Init.ReadPipeDelay      = FMC_SDRAM_RPIPE_DELAY_0;
120
+
121
+  /* Timing configuration for 100Mhz as SDRAM clock frequency (System clock is up to 200Mhz) */
122
+  SDRAM_Timing.LoadToActiveDelay    = 2;
123
+  SDRAM_Timing.ExitSelfRefreshDelay = 8;
124
+  SDRAM_Timing.SelfRefreshTime      = 6;
125
+  SDRAM_Timing.RowCycleDelay        = 6;
126
+  SDRAM_Timing.WriteRecoveryTime    = 2;
127
+  SDRAM_Timing.RPDelay              = 2;
128
+  SDRAM_Timing.RCDDelay             = 2;
129
+
130
+  /* Initialize the SDRAM controller */
131
+  if (HAL_SDRAM_Init(&hsdram, &SDRAM_Timing) != HAL_OK)
132
+  {
133
+    /* Initialization Error */
134
+  }
135
+
136
+  /* Program the SDRAM external device */
137
+  SDRAM_Initialization_Sequence(&hsdram, &command);
138
+}
139
+
140
+void LTDC_Config() {
141
+
142
+  __HAL_RCC_LTDC_CLK_ENABLE();
143
+  __HAL_RCC_DMA2D_CLK_ENABLE();
144
+
145
+  RCC_PeriphCLKInitTypeDef  PeriphClkInitStruct;
146
+
147
+  /* The PLL3R is configured to provide the LTDC PCLK clock */
148
+  /* PLL3_VCO Input = HSE_VALUE / PLL3M = 25Mhz / 5 = 5 Mhz */
149
+  /* PLL3_VCO Output = PLL3_VCO Input * PLL3N = 5Mhz * 160 = 800 Mhz */
150
+  /* PLLLCDCLK = PLL3_VCO Output/PLL3R = 800Mhz / 16 = 50Mhz */
151
+  /* LTDC clock frequency = PLLLCDCLK = 50 Mhz */
152
+  PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_LTDC;
153
+  PeriphClkInitStruct.PLL3.PLL3M = 5;
154
+  PeriphClkInitStruct.PLL3.PLL3N = 160;
155
+  PeriphClkInitStruct.PLL3.PLL3FRACN = 0;
156
+  PeriphClkInitStruct.PLL3.PLL3P = 2;
157
+  PeriphClkInitStruct.PLL3.PLL3Q = 2;
158
+  PeriphClkInitStruct.PLL3.PLL3R = (800 / LTDC_LCD_CLK);
159
+  PeriphClkInitStruct.PLL3.PLL3VCOSEL = RCC_PLL3VCOWIDE;
160
+  PeriphClkInitStruct.PLL3.PLL3RGE = RCC_PLL3VCIRANGE_2;
161
+  HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
162
+
163
+  LTDC_HandleTypeDef hltdc_F;
164
+  LTDC_LayerCfgTypeDef pLayerCfg;
165
+
166
+  /* LTDC Initialization -------------------------------------------------------*/
167
+
168
+  /* Polarity configuration */
169
+  /* Initialize the horizontal synchronization polarity as active low */
170
+  hltdc_F.Init.HSPolarity = LTDC_HSPOLARITY_AL;
171
+  /* Initialize the vertical synchronization polarity as active low */
172
+  hltdc_F.Init.VSPolarity = LTDC_VSPOLARITY_AL;
173
+  /* Initialize the data enable polarity as active low */
174
+  hltdc_F.Init.DEPolarity = LTDC_DEPOLARITY_AL;
175
+  /* Initialize the pixel clock polarity as input pixel clock */
176
+  hltdc_F.Init.PCPolarity = LTDC_PCPOLARITY_IPC;
177
+
178
+  /* Timing configuration */
179
+  hltdc_F.Init.HorizontalSync = (LTDC_LCD_HSYNC - 1);
180
+  hltdc_F.Init.VerticalSync = (LTDC_LCD_VSYNC - 1);
181
+  hltdc_F.Init.AccumulatedHBP = (LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
182
+  hltdc_F.Init.AccumulatedVBP = (LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
183
+  hltdc_F.Init.AccumulatedActiveH = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP - 1);
184
+  hltdc_F.Init.AccumulatedActiveW = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP - 1);
185
+  hltdc_F.Init.TotalHeigh = (TFT_HEIGHT + LTDC_LCD_VSYNC + LTDC_LCD_VBP + LTDC_LCD_VFP - 1);
186
+  hltdc_F.Init.TotalWidth = (TFT_WIDTH + LTDC_LCD_HSYNC + LTDC_LCD_HBP + LTDC_LCD_HFP - 1);
187
+
188
+  /* Configure R,G,B component values for LCD background color : all black background */
189
+  hltdc_F.Init.Backcolor.Blue = 0;
190
+  hltdc_F.Init.Backcolor.Green = 0;
191
+  hltdc_F.Init.Backcolor.Red = 0;
192
+
193
+  hltdc_F.Instance = LTDC;
194
+
195
+/* Layer0 Configuration ------------------------------------------------------*/
196
+
197
+  /* Windowing configuration */
198
+  pLayerCfg.WindowX0 = 0;
199
+  pLayerCfg.WindowX1 = TFT_WIDTH;
200
+  pLayerCfg.WindowY0 = 0;
201
+  pLayerCfg.WindowY1 = TFT_HEIGHT;
202
+
203
+  /* Pixel Format configuration*/
204
+  pLayerCfg.PixelFormat = LTDC_PIXEL_FORMAT_RGB565;
205
+
206
+  /* Start Address configuration : frame buffer is located at SDRAM memory */
207
+  pLayerCfg.FBStartAdress = (uint32_t)(FRAME_BUFFER_ADDRESS);
208
+
209
+  /* Alpha constant (255 == totally opaque) */
210
+  pLayerCfg.Alpha = 255;
211
+
212
+  /* Default Color configuration (configure A,R,G,B component values) : no background color */
213
+  pLayerCfg.Alpha0 = 0; /* fully transparent */
214
+  pLayerCfg.Backcolor.Blue = 0;
215
+  pLayerCfg.Backcolor.Green = 0;
216
+  pLayerCfg.Backcolor.Red = 0;
217
+
218
+  /* Configure blending factors */
219
+  pLayerCfg.BlendingFactor1 = LTDC_BLENDING_FACTOR1_CA;
220
+  pLayerCfg.BlendingFactor2 = LTDC_BLENDING_FACTOR2_CA;
221
+
222
+  /* Configure the number of lines and number of pixels per line */
223
+  pLayerCfg.ImageWidth  = TFT_WIDTH;
224
+  pLayerCfg.ImageHeight = TFT_HEIGHT;
225
+
226
+  /* Configure the LTDC */
227
+  if (HAL_LTDC_Init(&hltdc_F) != HAL_OK)
228
+  {
229
+    /* Initialization Error */
230
+  }
231
+
232
+  /* Configure the Layer*/
233
+  if (HAL_LTDC_ConfigLayer(&hltdc_F, &pLayerCfg, 0) != HAL_OK)
234
+  {
235
+    /* Initialization Error */
236
+  }
237
+}
238
+
239
+uint16_t TFT_LTDC::x_min = 0;
240
+uint16_t TFT_LTDC::x_max = 0;
241
+uint16_t TFT_LTDC::y_min = 0;
242
+uint16_t TFT_LTDC::y_max = 0;
243
+uint16_t TFT_LTDC::x_cur = 0;
244
+uint16_t TFT_LTDC::y_cur = 0;
245
+uint8_t TFT_LTDC::reg = 0;
246
+volatile uint16_t* TFT_LTDC::framebuffer = (volatile uint16_t* )FRAME_BUFFER_ADDRESS;
247
+
248
+void TFT_LTDC::Init() {
249
+
250
+  // SDRAM pins init
251
+  for (uint16_t i = 0; PinMap_SDRAM[i].pin != NC; i++)
252
+    pinmap_pinout(PinMap_SDRAM[i].pin, PinMap_SDRAM);
253
+
254
+  // SDRAM peripheral config
255
+  SDRAM_Config();
256
+
257
+  // LTDC pins init
258
+  for (uint16_t i = 0; PinMap_LTDC[i].pin != NC; i++)
259
+    pinmap_pinout(PinMap_LTDC[i].pin, PinMap_LTDC);
260
+
261
+  // LTDC peripheral config
262
+  LTDC_Config();
263
+}
264
+
265
+uint32_t TFT_LTDC::GetID() {
266
+  return 0xABAB;
267
+}
268
+
269
+uint32_t TFT_LTDC::ReadID(tft_data_t Reg) {
270
+  return 0xABAB;
271
+}
272
+
273
+bool TFT_LTDC::isBusy() {
274
+  return false;
275
+}
276
+
277
+uint16_t TFT_LTDC::ReadPoint(uint16_t x, uint16_t y) {
278
+  return framebuffer[(TFT_WIDTH * y) + x];
279
+}
280
+
281
+void TFT_LTDC::DrawPoint(uint16_t x, uint16_t y, uint16_t color) {
282
+  framebuffer[(TFT_WIDTH * y) + x] = color;
283
+}
284
+
285
+void TFT_LTDC::DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color) {
286
+
287
+  if (sx == ex || sy == ey) return;
288
+
289
+  uint16_t offline = TFT_WIDTH - (ex - sx);
290
+  uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
291
+
292
+  DMA2D->CR &= ~(1 << 0);
293
+  DMA2D->CR = 3 << 16;
294
+  DMA2D->OPFCCR = 0X02;
295
+  DMA2D->OOR = offline;
296
+  DMA2D->OMAR = addr;
297
+  DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
298
+  DMA2D->OCOLR = color;
299
+  DMA2D->CR |= 1<<0;
300
+
301
+  uint32_t timeout = 0;
302
+  while((DMA2D->ISR & (1<<1)) == 0)
303
+  {
304
+    timeout++;
305
+    if(timeout>0X1FFFFF)break;
306
+  }
307
+  DMA2D->IFCR |= 1<<1;
308
+}
309
+
310
+void TFT_LTDC::DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors) {
311
+
312
+  if (sx == ex || sy == ey) return;
313
+
314
+  uint16_t offline = TFT_WIDTH - (ex - sx);
315
+  uint32_t addr = (uint32_t)&framebuffer[(TFT_WIDTH * sy) + sx];
316
+
317
+  DMA2D->CR &= ~(1 << 0);
318
+  DMA2D->CR = 0 << 16;
319
+  DMA2D->FGPFCCR = 0X02;
320
+  DMA2D->FGOR = 0;
321
+  DMA2D->OOR = offline;
322
+  DMA2D->FGMAR = (uint32_t)colors;
323
+  DMA2D->OMAR = addr;
324
+  DMA2D->NLR = (ey - sy) | ((ex - sx) << 16);
325
+  DMA2D->CR |= 1<<0;
326
+
327
+  uint32_t timeout = 0;
328
+  while((DMA2D->ISR & (1<<1)) == 0)
329
+  {
330
+    timeout++;
331
+    if(timeout>0X1FFFFF)break;
332
+  }
333
+  DMA2D->IFCR |= 1<<1;
334
+}
335
+
336
+void TFT_LTDC::WriteData(uint16_t data) {
337
+  switch (reg) {
338
+    case 0x01: x_cur = x_min = data; return;
339
+    case 0x02: x_max = data; return;
340
+    case 0x03: y_cur = y_min = data; return;
341
+    case 0x04: y_max = data; return;
342
+  }
343
+  Transmit(data);
344
+}
345
+
346
+void TFT_LTDC::Transmit(tft_data_t Data) {
347
+  DrawPoint(x_cur, y_cur, Data);
348
+  x_cur++;
349
+  if (x_cur > x_max) {
350
+    x_cur = x_min;
351
+    y_cur++;
352
+    if (y_cur > y_max) y_cur = y_min;
353
+  }
354
+}
355
+
356
+void TFT_LTDC::WriteReg(uint16_t Reg) {
357
+  reg = Reg;
358
+}
359
+
360
+void TFT_LTDC::TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count) {
361
+
362
+  while (x_cur != x_min && Count) {
363
+    Transmit(*Data);
364
+    if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
365
+    Count--;
366
+  }
367
+
368
+  uint16_t width = x_max - x_min + 1;
369
+  uint16_t height = Count / width;
370
+  uint16_t x_end_cnt = Count - (width * height);
371
+
372
+  if (height) {
373
+    if (MemoryIncrease == DMA_PINC_ENABLE) {
374
+      DrawImage(x_min, y_cur, x_min + width, y_cur + height, Data);
375
+      Data += width * height;
376
+    } else {
377
+      DrawRect(x_min, y_cur, x_min + width, y_cur + height, *Data);
378
+    }
379
+    y_cur += height;
380
+  }
381
+
382
+  while (x_end_cnt) {
383
+    Transmit(*Data);
384
+    if (MemoryIncrease == DMA_PINC_ENABLE) Data++;
385
+    x_end_cnt--;
386
+  }
387
+}
388
+
389
+#endif // HAS_LTDC_TFT
390
+#endif // ARDUINO_ARCH_STM32 && !STM32GENERIC

+ 155
- 0
Marlin/src/HAL/STM32/tft/tft_ltdc.h Переглянути файл

@@ -0,0 +1,155 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#include "../../../inc/MarlinConfig.h"
25
+
26
+#ifdef STM32H7xx
27
+  #include "stm32h7xx_hal.h"
28
+#else
29
+  #error "LTDC TFT is currently only supported on STM32H7 hardware."
30
+#endif
31
+
32
+#define DATASIZE_8BIT  SPI_DATASIZE_8BIT
33
+#define DATASIZE_16BIT SPI_DATASIZE_16BIT
34
+#define TFT_IO_DRIVER  TFT_LTDC
35
+
36
+#define TFT_DATASIZE DATASIZE_16BIT
37
+typedef uint16_t tft_data_t;
38
+
39
+class TFT_LTDC {
40
+  private:
41
+    static volatile uint16_t *framebuffer;
42
+    static uint16_t x_min, x_max, y_min, y_max, x_cur, y_cur;
43
+    static uint8_t reg;
44
+
45
+    static uint32_t ReadID(tft_data_t Reg);
46
+
47
+    static uint16_t ReadPoint(uint16_t x, uint16_t y);
48
+    static void DrawPoint(uint16_t x, uint16_t y, uint16_t color);
49
+    static void DrawRect(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t color);
50
+    static void DrawImage(uint16_t sx, uint16_t sy, uint16_t ex, uint16_t ey, uint16_t *colors);
51
+    static void Transmit(tft_data_t Data);
52
+    static void TransmitDMA(uint32_t MemoryIncrease, uint16_t *Data, uint16_t Count);
53
+
54
+  public:
55
+    static void Init();
56
+    static uint32_t GetID();
57
+    static bool isBusy();
58
+    static void Abort() { /*__HAL_DMA_DISABLE(&DMAtx);*/ }
59
+
60
+    static void DataTransferBegin(uint16_t DataWidth = TFT_DATASIZE) {}
61
+    static void DataTransferEnd() {};
62
+
63
+    static void WriteData(uint16_t Data);
64
+    static void WriteReg(uint16_t Reg);
65
+
66
+    static void WriteSequence(uint16_t *Data, uint16_t Count) { TransmitDMA(DMA_PINC_ENABLE, Data, Count); }
67
+    static void WriteMultiple(uint16_t Color, uint16_t Count) { static uint16_t Data; Data = Color; TransmitDMA(DMA_PINC_DISABLE, &Data, Count); }
68
+    static void WriteMultiple(uint16_t Color, uint32_t Count) {
69
+      static uint16_t Data; Data = Color;
70
+      while (Count > 0) {
71
+        TransmitDMA(DMA_MINC_DISABLE, &Data, Count > 0xFFFF ? 0xFFFF : Count);
72
+        Count = Count > 0xFFFF ? Count - 0xFFFF : 0;
73
+      }
74
+    }
75
+};
76
+
77
+const PinMap PinMap_LTDC[] = {
78
+  {PF_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_DE
79
+  {PG_7,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_CLK
80
+  {PI_9,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_VSYNC
81
+  {PI_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_HSYNC
82
+
83
+  {PG_6,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R7
84
+  {PH_12, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R6
85
+  {PH_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R5
86
+  {PH_10, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R4
87
+  {PH_9,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_R3
88
+
89
+  {PI_2,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G7
90
+  {PI_1,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G6
91
+  {PI_0,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G5
92
+  {PH_15, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G4
93
+  {PH_14, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G3
94
+  {PH_13, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_G2
95
+
96
+  {PI_7,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B7
97
+  {PI_6,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B6
98
+  {PI_5,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B5
99
+  {PI_4,  LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B4
100
+  {PG_11, LTDC, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_LTDC)}, // LCD_B3
101
+  {NC,    NP,    0}
102
+};
103
+
104
+const PinMap PinMap_SDRAM[] = {
105
+  {PC_0,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNWE
106
+  {PC_2,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNE0
107
+  {PC_3,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCKE0
108
+  {PE_0,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL0
109
+  {PE_1,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_NBL1
110
+  {PF_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNRAS
111
+  {PG_8,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDCLK
112
+  {PG_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_SDNCAS
113
+  {PG_4,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA0
114
+  {PG_5,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_BA1
115
+  {PD_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D0
116
+  {PD_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D1
117
+  {PD_0,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D2
118
+  {PD_1,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D3
119
+  {PE_7,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D4
120
+  {PE_8,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D5
121
+  {PE_9,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D6
122
+  {PE_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D7
123
+  {PE_11, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D8
124
+  {PE_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D9
125
+  {PE_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D10
126
+  {PE_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D11
127
+  {PE_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D12
128
+  {PD_8,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D13
129
+  {PD_9,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D14
130
+  {PD_10, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_D15
131
+  {PF_0,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A0
132
+  {PF_1,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A1
133
+  {PF_2,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A2
134
+  {PF_3,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A3
135
+  {PF_4,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A4
136
+  {PF_5,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A5
137
+  {PF_12, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A6
138
+  {PF_13, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A7
139
+  {PF_14, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A8
140
+  {PF_15, FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A9
141
+  {PG_0,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A10
142
+  {PG_1,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A11
143
+  {PG_2,  FMC_Bank1_R, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_FMC)}, // FMC_A12
144
+  {NC,    NP,    0}
145
+};
146
+
147
+const PinMap PinMap_QUADSPI[] = {
148
+  {PB_2,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_CLK
149
+  {PB_10, QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_NCS
150
+  {PF_6,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO3
151
+  {PF_7,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_QUADSPI)}, // QUADSPI_BK1_IO2
152
+  {PF_8,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO0
153
+  {PF_9,  QUADSPI, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_QUADSPI)}, // QUADSPI_BK1_IO1
154
+  {NC,    NP,    0}
155
+};

+ 1
- 1
Marlin/src/HAL/STM32/timers.cpp Переглянути файл

@@ -74,7 +74,7 @@
74 74
 #elif defined(STM32F401xC) || defined(STM32F401xE)
75 75
   #define MCU_STEP_TIMER  9
76 76
   #define MCU_TEMP_TIMER 10
77
-#elif defined(STM32F4xx) || defined(STM32F7xx)
77
+#elif defined(STM32F4xx) || defined(STM32F7xx) || defined(STM32H7xx)
78 78
   #define MCU_STEP_TIMER  6           // STM32F401 has no TIM6, TIM7, or TIM8
79 79
   #define MCU_TEMP_TIMER 14           // TIM7 is consumed by Software Serial if used.
80 80
 #endif

+ 1
- 0
Marlin/src/core/boards.h Переглянути файл

@@ -390,6 +390,7 @@
390 390
 #define BOARD_TEENSY41                5001  // Teensy 4.1
391 391
 #define BOARD_T41U5XBB                5002  // T41U5XBB Teensy 4.1 breakout board
392 392
 #define BOARD_NUCLEO_F767ZI           5003  // ST NUCLEO-F767ZI Dev Board
393
+#define BOARD_BTT_SKR_SE_BX           5004  // BigTreeTech SKR SE BX (STM32H743II)
393 394
 
394 395
 //
395 396
 // Espressif ESP32 WiFi

+ 24
- 1
Marlin/src/inc/Conditionals_LCD.h Переглянути файл

@@ -1119,6 +1119,10 @@
1119 1119
   #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
1120 1120
   #define TFT_RES_480x320
1121 1121
   #define TFT_INTERFACE_FSMC
1122
+#elif ENABLED(BIQU_BX_TFT70)        // RGB
1123
+  #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
1124
+  #define TFT_RES_1024x600
1125
+  #define TFT_INTERFACE_LTDC
1122 1126
 #elif ENABLED(TFT_GENERIC)
1123 1127
   #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
1124 1128
   #if NONE(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
@@ -1141,9 +1145,13 @@
1141 1145
   #define TFT_WIDTH  480
1142 1146
   #define TFT_HEIGHT 320
1143 1147
   #define GRAPHICAL_TFT_UPSCALE 3
1148
+#elif ENABLED(TFT_RES_1024x600)
1149
+  #define TFT_WIDTH  1024
1150
+  #define TFT_HEIGHT 600
1151
+  #define GRAPHICAL_TFT_UPSCALE 4
1144 1152
 #endif
1145 1153
 
1146
-// FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi).h
1154
+// FSMC/SPI TFT Panels using standard HAL/tft/tft_(fsmc|spi|ltdc).h
1147 1155
 #if ENABLED(TFT_INTERFACE_FSMC)
1148 1156
   #define HAS_FSMC_TFT 1
1149 1157
   #if TFT_SCALED_DOGLCD
@@ -1158,6 +1166,13 @@
1158 1166
   #elif HAS_TFT_LVGL_UI
1159 1167
     #define HAS_TFT_LVGL_UI_SPI 1
1160 1168
   #endif
1169
+#elif ENABLED(TFT_INTERFACE_LTDC)
1170
+  #define HAS_LTDC_TFT 1
1171
+  #if TFT_SCALED_DOGLCD
1172
+    #define HAS_LTDC_GRAPHICAL_TFT 1
1173
+  #elif HAS_TFT_LVGL_UI
1174
+    #define HAS_TFT_LVGL_UI_LTDC 1
1175
+  #endif
1161 1176
 #endif
1162 1177
 
1163 1178
 #if ENABLED(TFT_COLOR_UI)
@@ -1179,6 +1194,10 @@
1179 1194
     #elif ENABLED(TFT_INTERFACE_FSMC)
1180 1195
       #define TFT_480x272
1181 1196
     #endif
1197
+  #elif TFT_HEIGHT == 600
1198
+    #if ENABLED(TFT_INTERFACE_LTDC)
1199
+      #define TFT_1024x600_LTDC
1200
+    #endif
1182 1201
   #endif
1183 1202
 #endif
1184 1203
 
@@ -1188,9 +1207,13 @@
1188 1207
   #define HAS_UI_480x320 1
1189 1208
 #elif EITHER(TFT_480x272, TFT_480x272_SPI)
1190 1209
   #define HAS_UI_480x272 1
1210
+#elif defined(TFT_1024x600_LTDC)
1211
+  #define HAS_UI_1024x600 1
1191 1212
 #endif
1192 1213
 #if ANY(HAS_UI_320x240, HAS_UI_480x320, HAS_UI_480x272)
1193 1214
   #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) // Fewer lines with touch buttons onscreen
1215
+#elif HAS_UI_1024x600
1216
+  #define LCD_HEIGHT TERN(TOUCH_SCREEN, 12, 13) // Fewer lines with touch buttons onscreen
1194 1217
 #endif
1195 1218
 
1196 1219
 // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046'

+ 5
- 5
Marlin/src/inc/SanityCheck.h Переглянути файл

@@ -2404,7 +2404,7 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2404 2404
 #undef IS_EXTUI
2405 2405
 #undef IS_LEGACY_TFT
2406 2406
 
2407
-#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35)
2407
+#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70)
2408 2408
   #if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
2409 2409
     #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one."
2410 2410
   #elif 1 < ENABLED(TFT_COLOR_UI) + ENABLED(TFT_CLASSIC_UI) + ENABLED(TFT_LVGL_UI)
@@ -2426,16 +2426,16 @@ static_assert(hbm[Z_AXIS] >= 0, "HOMING_BUMP_MM.Z must be greater than or equal
2426 2426
   #error "Please enable only one LCD_SCREEN_ROT_* option: 0, 90, 180, or 270."
2427 2427
 #endif
2428 2428
 
2429
-#if MANY(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320)
2430
-  #error "Please select only one of TFT_RES_480x320, TFT_RES_480x320, or TFT_RES_480x272."
2429
+#if MANY(TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320, TFT_RES_1024x600)
2430
+  #error "Please select only one of TFT_RES_320x240, TFT_RES_480x272, TFT_RES_480x320, or TFT_RES_1024x600."
2431 2431
 #endif
2432 2432
 
2433 2433
 #if HAS_TFT_LVGL_UI && DISABLED(TFT_RES_480x320)
2434 2434
   #error "(FMSC|SPI)TFT_LVGL_UI requires TFT_RES_480x320."
2435 2435
 #endif
2436 2436
 
2437
-#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 3)
2438
-  #error "GRAPHICAL_TFT_UPSCALE must be set to 2 or 3."
2437
+#if defined(GRAPHICAL_TFT_UPSCALE) && !WITHIN(GRAPHICAL_TFT_UPSCALE, 2, 4)
2438
+  #error "GRAPHICAL_TFT_UPSCALE must be 2, 3, or 4."
2439 2439
 #endif
2440 2440
 
2441 2441
 /**

+ 2
- 2
Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp Переглянути файл

@@ -55,14 +55,14 @@
55 55
 
56 56
 #include "../../inc/MarlinConfig.h"
57 57
 
58
-#if HAS_MARLINUI_U8GLIB && (PIN_EXISTS(FSMC_CS) || HAS_SPI_GRAPHICAL_TFT)
58
+#if HAS_MARLINUI_U8GLIB && (PIN_EXISTS(FSMC_CS) || HAS_SPI_GRAPHICAL_TFT || HAS_LTDC_GRAPHICAL_TFT)
59 59
 
60 60
 #include "HAL_LCD_com_defines.h"
61 61
 #include "marlinui_DOGM.h"
62 62
 
63 63
 #include <string.h>
64 64
 
65
-#if EITHER(LCD_USE_DMA_FSMC, LCD_USE_DMA_SPI)
65
+#if ANY(LCD_USE_DMA_FSMC, LCD_USE_DMA_SPI, HAS_LTDC_GRAPHICAL_TFT)
66 66
   #define HAS_LCD_IO 1
67 67
 #endif
68 68
 

+ 1
- 1
Marlin/src/lcd/extui/lib/ftdi_eve_touch_ui/screens/bed_mesh_view_screen.cpp Переглянути файл

@@ -55,7 +55,7 @@ constexpr static float gaugeThickness = 0.25;
55 55
 static float meshGetter(uint8_t x, uint8_t y, void*) {
56 56
   xy_uint8_t pos;
57 57
   pos.x = x;
58
-  pos.y = y;  
58
+  pos.y = y;
59 59
   return ExtUI::getMeshPoint(pos);
60 60
 }
61 61
 

+ 3
- 0
Marlin/src/lcd/tft/tft.h Переглянути файл

@@ -46,6 +46,9 @@
46 46
 #elif HAS_UI_480x272
47 47
   #define TFT_WIDTH         480
48 48
   #define TFT_HEIGHT        272
49
+#elif HAS_UI_1024x600
50
+  #define TFT_WIDTH         1024
51
+  #define TFT_HEIGHT        600
49 52
 #else
50 53
   #error "Unsupported display resolution!"
51 54
 #endif

+ 927
- 0
Marlin/src/lcd/tft/ui_1024x600.cpp Переглянути файл

@@ -0,0 +1,927 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+
23
+#include "../../inc/MarlinConfigPre.h"
24
+
25
+#if HAS_UI_1024x600
26
+
27
+#include "ui_common.h"
28
+
29
+#include "../marlinui.h"
30
+#include "../menu/menu.h"
31
+#include "../../libs/numtostr.h"
32
+
33
+#include "../../sd/cardreader.h"
34
+#include "../../module/temperature.h"
35
+#include "../../module/printcounter.h"
36
+#include "../../module/planner.h"
37
+#include "../../module/motion.h"
38
+
39
+#if DISABLED(LCD_PROGRESS_BAR) && BOTH(FILAMENT_LCD_DISPLAY, SDSUPPORT)
40
+  #include "../../feature/filwidth.h"
41
+  #include "../../gcode/parser.h"
42
+#endif
43
+
44
+#if ENABLED(AUTO_BED_LEVELING_UBL)
45
+  #include "../../feature/bedlevel/bedlevel.h"
46
+#endif
47
+
48
+void MarlinUI::tft_idle() {
49
+  #if ENABLED(TOUCH_SCREEN)
50
+    if (draw_menu_navigation) {
51
+      add_control(104, TFT_HEIGHT - 34, PAGE_UP, imgPageUp, encoderTopLine > 0);
52
+      add_control(344, TFT_HEIGHT - 34, PAGE_DOWN, imgPageDown, encoderTopLine + LCD_HEIGHT < screen_items);
53
+      add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
54
+      draw_menu_navigation = false;
55
+    }
56
+  #endif
57
+
58
+  tft.queue.async();
59
+  TERN_(TOUCH_SCREEN, touch.idle());
60
+}
61
+
62
+#if ENABLED(SHOW_BOOTSCREEN)
63
+  void MarlinUI::show_bootscreen() {
64
+    tft.queue.reset();
65
+
66
+    tft.canvas(0, 0, TFT_WIDTH, TFT_HEIGHT);
67
+    #if ENABLED(BOOT_MARLIN_LOGO_SMALL)
68
+      #define BOOT_LOGO_W 195   // MarlinLogo195x59x16
69
+      #define BOOT_LOGO_H  59
70
+      #define SITE_URL_Y (TFT_HEIGHT - 70)
71
+      tft.set_background(COLOR_BACKGROUND);
72
+    #else
73
+      #define BOOT_LOGO_W TFT_WIDTH   // MarlinLogo480x320x16
74
+      #define BOOT_LOGO_H TFT_HEIGHT
75
+      #define SITE_URL_Y (TFT_HEIGHT - 90)
76
+    #endif
77
+    tft.add_image((TFT_WIDTH - BOOT_LOGO_W) / 2, (TFT_HEIGHT - BOOT_LOGO_H) / 2, imgBootScreen);
78
+    #ifdef WEBSITE_URL
79
+      tft_string.set(WEBSITE_URL);
80
+      tft.add_text(tft_string.center(TFT_WIDTH), SITE_URL_Y, COLOR_WEBSITE_URL, tft_string);
81
+    #endif
82
+
83
+    tft.queue.sync();
84
+    safe_delay(BOOTSCREEN_TIMEOUT);
85
+    clear_lcd();
86
+  }
87
+#endif
88
+
89
+void MarlinUI::draw_kill_screen() {
90
+  tft.queue.reset();
91
+  tft.fill(0, 0, TFT_WIDTH, TFT_HEIGHT, COLOR_KILL_SCREEN_BG);
92
+
93
+  uint16_t line = 2;
94
+
95
+  menu_line(line++, COLOR_KILL_SCREEN_BG);
96
+  tft_string.set(status_message);
97
+  tft_string.trim();
98
+  tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
99
+
100
+  line++;
101
+  menu_line(line++, COLOR_KILL_SCREEN_BG);
102
+  tft_string.set(GET_TEXT(MSG_HALTED));
103
+  tft_string.trim();
104
+  tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
105
+
106
+  menu_line(line++, COLOR_KILL_SCREEN_BG);
107
+  tft_string.set(GET_TEXT(MSG_PLEASE_RESET));
108
+  tft_string.trim();
109
+  tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
110
+
111
+  tft.queue.sync();
112
+}
113
+
114
+void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater) {
115
+  MarlinImage image = imgHotEnd;
116
+  uint16_t Color;
117
+  celsius_t currentTemperature, targetTemperature;
118
+
119
+  if (Heater >= 0) { // HotEnd
120
+    currentTemperature = thermalManager.degHotend(Heater);
121
+    targetTemperature = thermalManager.degTargetHotend(Heater);
122
+  }
123
+  #if HAS_HEATED_BED
124
+    else if (Heater == H_BED) {
125
+      currentTemperature = thermalManager.degBed();
126
+      targetTemperature = thermalManager.degTargetBed();
127
+    }
128
+  #endif
129
+  #if HAS_TEMP_CHAMBER
130
+    else if (Heater == H_CHAMBER) {
131
+      currentTemperature = thermalManager.degChamber();
132
+      #if HAS_HEATED_CHAMBER
133
+        targetTemperature = thermalManager.degTargetChamber();
134
+      #else
135
+        targetTemperature = ABSOLUTE_ZERO;
136
+      #endif
137
+    }
138
+  #endif
139
+  #if HAS_TEMP_COOLER
140
+    else if (Heater == H_COOLER) {
141
+      currentTemperature = thermalManager.degCooler();
142
+      targetTemperature = TERN(HAS_COOLER, thermalManager.degTargetCooler(), ABSOLUTE_ZERO);
143
+    }
144
+  #endif
145
+  else return;
146
+
147
+  TERN_(TOUCH_SCREEN, if (targetTemperature >= 0) touch.add_control(HEATER, x, y, 80, 120, Heater));
148
+  tft.canvas(x, y, 80, 120);
149
+  tft.set_background(COLOR_BACKGROUND);
150
+
151
+  Color = currentTemperature < 0 ? COLOR_INACTIVE : COLOR_COLD;
152
+
153
+  if (Heater >= 0) { // HotEnd
154
+    if (currentTemperature >= 50) Color = COLOR_HOTEND;
155
+  }
156
+  #if HAS_HEATED_BED
157
+    else if (Heater == H_BED) {
158
+      if (currentTemperature >= 50) Color = COLOR_HEATED_BED;
159
+      image = targetTemperature > 0 ? imgBedHeated : imgBed;
160
+    }
161
+  #endif
162
+  #if HAS_TEMP_CHAMBER
163
+    else if (Heater == H_CHAMBER) {
164
+      if (currentTemperature >= 50) Color = COLOR_CHAMBER;
165
+      image = targetTemperature > 0 ? imgChamberHeated : imgChamber;
166
+    }
167
+  #endif
168
+
169
+  tft.add_image(8, 28, image, Color);
170
+
171
+  tft_string.set((uint8_t *)i16tostr3rj(currentTemperature));
172
+  tft_string.add(LCD_STR_DEGREE);
173
+  tft_string.trim();
174
+  tft.add_text(tft_string.center(80) + 2, 82, Color, tft_string);
175
+
176
+  if (targetTemperature >= 0) {
177
+    tft_string.set((uint8_t *)i16tostr3rj(targetTemperature));
178
+    tft_string.add(LCD_STR_DEGREE);
179
+    tft_string.trim();
180
+    tft.add_text(tft_string.center(80) + 2, 8, Color, tft_string);
181
+  }
182
+}
183
+
184
+void draw_fan_status(uint16_t x, uint16_t y, const bool blink) {
185
+  TERN_(TOUCH_SCREEN, touch.add_control(FAN, x, y, 80, 120));
186
+  tft.canvas(x, y, 80, 120);
187
+  tft.set_background(COLOR_BACKGROUND);
188
+
189
+  uint8_t fanSpeed = thermalManager.fan_speed[0];
190
+  MarlinImage image;
191
+
192
+  if (fanSpeed >= 127)
193
+    image = blink ? imgFanFast1 : imgFanFast0;
194
+  else if (fanSpeed > 0)
195
+    image = blink ? imgFanSlow1 : imgFanSlow0;
196
+  else
197
+    image = imgFanIdle;
198
+
199
+  tft.add_image(8, 20, image, COLOR_FAN);
200
+
201
+  tft_string.set((uint8_t *)ui8tostr4pctrj(thermalManager.fan_speed[0]));
202
+  tft_string.trim();
203
+  tft.add_text(tft_string.center(80) + 6, 82, COLOR_FAN, tft_string);
204
+}
205
+
206
+void MarlinUI::draw_status_screen() {
207
+  const bool blink = get_blink();
208
+
209
+  TERN_(TOUCH_SCREEN, touch.clear());
210
+
211
+  // heaters and fan
212
+  uint16_t i, x, y = TFT_STATUS_TOP_Y;
213
+
214
+  for (i = 0 ; i < ITEMS_COUNT; i++) {
215
+    x = (TFT_WIDTH / ITEMS_COUNT - 80) / 2  + (TFT_WIDTH * i / ITEMS_COUNT);
216
+    switch (i) {
217
+      #ifdef ITEM_E0
218
+        case ITEM_E0: draw_heater_status(x, y, H_E0); break;
219
+      #endif
220
+      #ifdef ITEM_E1
221
+        case ITEM_E1: draw_heater_status(x, y, H_E1); break;
222
+      #endif
223
+      #ifdef ITEM_E2
224
+        case ITEM_E2: draw_heater_status(x, y, H_E2); break;
225
+      #endif
226
+      #ifdef ITEM_BED
227
+        case ITEM_BED: draw_heater_status(x, y, H_BED); break;
228
+      #endif
229
+      #ifdef ITEM_CHAMBER
230
+        case ITEM_CHAMBER: draw_heater_status(x, y, H_CHAMBER); break;
231
+      #endif
232
+      #ifdef ITEM_FAN
233
+        case ITEM_FAN: draw_fan_status(x, y, blink); break;
234
+      #endif
235
+    }
236
+  }
237
+
238
+  y += 200;
239
+
240
+  // coordinates
241
+  tft.canvas(4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT);
242
+  tft.set_background(COLOR_BACKGROUND);
243
+  tft.add_rectangle(0, 0, TFT_WIDTH - 8, FONT_LINE_HEIGHT, COLOR_AXIS_HOMED);
244
+
245
+  tft.add_text(200, 3, COLOR_AXIS_HOMED , "X");
246
+  tft.add_text(500, 3, COLOR_AXIS_HOMED , "Y");
247
+  tft.add_text(800, 3, COLOR_AXIS_HOMED , "Z");
248
+
249
+  bool not_homed = axis_should_home(X_AXIS);
250
+  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_X_POSITION(current_position.x)));
251
+  tft.add_text(300 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
252
+
253
+  not_homed = axis_should_home(Y_AXIS);
254
+  tft_string.set(blink && not_homed ? "?" : ftostr4sign(LOGICAL_Y_POSITION(current_position.y)));
255
+  tft.add_text(600 - tft_string.width(), 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
256
+
257
+  uint16_t offset = 32;
258
+  not_homed = axis_should_home(Z_AXIS);
259
+  if (blink && not_homed)
260
+    tft_string.set("?");
261
+  else {
262
+    const float z = LOGICAL_Z_POSITION(current_position.z);
263
+    tft_string.set(ftostr52sp((int16_t)z));
264
+    tft_string.rtrim();
265
+    offset += tft_string.width();
266
+
267
+    tft_string.set(ftostr52sp(z));
268
+    offset -= tft_string.width();
269
+  }
270
+  tft.add_text(900 - tft_string.width() - offset, 3, not_homed ? COLOR_AXIS_NOT_HOMED : COLOR_AXIS_HOMED, tft_string);
271
+  TERN_(TOUCH_SCREEN, touch.add_control(MOVE_AXIS, 4, y, TFT_WIDTH - 8, FONT_LINE_HEIGHT));
272
+
273
+  y += 100;
274
+  // feed rate
275
+  tft.canvas(274, y, 100, 32);
276
+  tft.set_background(COLOR_BACKGROUND);
277
+  uint16_t color = feedrate_percentage == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
278
+  tft.add_image(0, 0, imgFeedRate, color);
279
+  tft_string.set(i16tostr3rj(feedrate_percentage));
280
+  tft_string.add('%');
281
+  tft.add_text(36, 1, color , tft_string);
282
+  TERN_(TOUCH_SCREEN, touch.add_control(FEEDRATE, 96, 176, 100, 32));
283
+
284
+  // flow rate
285
+  tft.canvas(650, y, 100, 32);
286
+  tft.set_background(COLOR_BACKGROUND);
287
+  color = planner.flow_percentage[0] == 100 ? COLOR_RATE_100 : COLOR_RATE_ALTERED;
288
+  tft.add_image(0, 0, imgFlowRate, color);
289
+  tft_string.set(i16tostr3rj(planner.flow_percentage[active_extruder]));
290
+  tft_string.add('%');
291
+  tft.add_text(36, 1, color , tft_string);
292
+  TERN_(TOUCH_SCREEN, touch.add_control(FLOWRATE, 284, 176, 100, 32, active_extruder));
293
+
294
+  #if ENABLED(TOUCH_SCREEN)
295
+    add_control(404, y, menu_main, imgSettings);
296
+    TERN_(SDSUPPORT, add_control(12, y, menu_media, imgSD, !printingIsActive(), COLOR_CONTROL_ENABLED, card.isMounted() && printingIsActive() ? COLOR_BUSY : COLOR_CONTROL_DISABLED));
297
+  #endif
298
+
299
+  y += 100;
300
+  // print duration
301
+  char buffer[14];
302
+  duration_t elapsed = print_job_timer.duration();
303
+  elapsed.toDigital(buffer);
304
+
305
+  tft.canvas((TFT_WIDTH - 128) / 2, y, 128, 29);
306
+  tft.set_background(COLOR_BACKGROUND);
307
+  tft_string.set(buffer);
308
+  tft.add_text(tft_string.center(128), 0, COLOR_PRINT_TIME, tft_string);
309
+
310
+  y += 50;
311
+  // progress bar
312
+  const uint8_t progress = ui.get_progress_percent();
313
+  tft.canvas(4, y, TFT_WIDTH - 8, 9);
314
+  tft.set_background(COLOR_PROGRESS_BG);
315
+  tft.add_rectangle(0, 0, TFT_WIDTH - 8, 9, COLOR_PROGRESS_FRAME);
316
+  if (progress)
317
+    tft.add_bar(1, 1, ((TFT_WIDTH - 10) * progress) / 100, 7, COLOR_PROGRESS_BAR);
318
+
319
+  y += 50;
320
+  // status message
321
+  tft.canvas(0, y, TFT_WIDTH, FONT_LINE_HEIGHT - 5);
322
+  tft.set_background(COLOR_BACKGROUND);
323
+  tft_string.set(status_message);
324
+  tft_string.trim();
325
+  tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_STATUS_MESSAGE, tft_string);
326
+}
327
+
328
+// Low-level draw_edit_screen can be used to draw an edit screen from anyplace
329
+void MenuEditItemBase::draw_edit_screen(PGM_P const pstr, const char * const value/*=nullptr*/) {
330
+  ui.encoder_direction_normal();
331
+  TERN_(TOUCH_SCREEN, touch.clear());
332
+
333
+  uint16_t line = 1;
334
+
335
+  menu_line(line++);
336
+  tft_string.set(pstr, itemIndex, itemString);
337
+  tft_string.trim();
338
+  tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
339
+
340
+  TERN_(AUTO_BED_LEVELING_UBL, if (ui.external_control) line++);  // ftostr52() will overwrite *value so *value has to be displayed first
341
+
342
+  menu_line(line);
343
+  tft_string.set(value);
344
+  tft_string.trim();
345
+  tft.add_text(tft_string.center(TFT_WIDTH), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
346
+
347
+  #if ENABLED(AUTO_BED_LEVELING_UBL)
348
+    if (ui.external_control) {
349
+      menu_line(line - 1);
350
+
351
+      tft_string.set(X_LBL);
352
+      tft.add_text((TFT_WIDTH / 2 - 120), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
353
+      tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.x)));
354
+      tft_string.trim();
355
+      tft.add_text((TFT_WIDTH / 2 - 16) - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
356
+
357
+      tft_string.set(Y_LBL);
358
+      tft.add_text((TFT_WIDTH / 2 + 16), MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
359
+      tft_string.set(ftostr52(LOGICAL_X_POSITION(current_position.y)));
360
+      tft_string.trim();
361
+      tft.add_text((TFT_WIDTH / 2 + 120) - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
362
+    }
363
+  #endif
364
+
365
+  extern screenFunc_t _manual_move_func_ptr;
366
+  if (ui.currentScreen != _manual_move_func_ptr && !ui.external_control) {
367
+
368
+    #define SLIDER_LENGTH 336
369
+    #define SLIDER_Y_POSITION 186
370
+
371
+    tft.canvas((TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION, SLIDER_LENGTH, 16);
372
+    tft.set_background(COLOR_BACKGROUND);
373
+
374
+    int16_t position = (SLIDER_LENGTH - 2) * ui.encoderPosition / maxEditValue;
375
+    tft.add_bar(0, 7, 1, 2, ui.encoderPosition == 0 ? COLOR_SLIDER_INACTIVE : COLOR_SLIDER);
376
+    tft.add_bar(1, 6, position, 4, COLOR_SLIDER);
377
+    tft.add_bar(position + 1, 6, SLIDER_LENGTH - 2 - position, 4, COLOR_SLIDER_INACTIVE);
378
+    tft.add_bar(SLIDER_LENGTH - 1, 7, 1, 2, int32_t(ui.encoderPosition) == maxEditValue ? COLOR_SLIDER : COLOR_SLIDER_INACTIVE);
379
+
380
+    #if ENABLED(TOUCH_SCREEN)
381
+      tft.add_image((SLIDER_LENGTH - 8) * ui.encoderPosition / maxEditValue, 0, imgSlider, COLOR_SLIDER);
382
+      touch.add_control(SLIDER, (TFT_WIDTH - SLIDER_LENGTH) / 2, SLIDER_Y_POSITION - 8, SLIDER_LENGTH, 32, maxEditValue);
383
+    #endif
384
+  }
385
+
386
+  tft.draw_edit_screen_buttons();
387
+}
388
+
389
+void TFT::draw_edit_screen_buttons() {
390
+  #if ENABLED(TOUCH_SCREEN)
391
+    add_control(64, TFT_HEIGHT - 64, DECREASE, imgDecrease);
392
+    add_control(352, TFT_HEIGHT - 64, INCREASE, imgIncrease);
393
+    add_control(208, TFT_HEIGHT - 64, CLICK, imgConfirm);
394
+  #endif
395
+}
396
+
397
+// The Select Screen presents a prompt and two "buttons"
398
+void MenuItem_confirm::draw_select_screen(PGM_P const yes, PGM_P const no, const bool yesno, PGM_P const pref, const char * const string/*=nullptr*/, PGM_P const suff/*=nullptr*/) {
399
+  uint16_t line = 1;
400
+
401
+  if (!string) line++;
402
+
403
+  menu_line(line++);
404
+  tft_string.set(pref);
405
+  tft_string.trim();
406
+  tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
407
+
408
+  if (string) {
409
+    menu_line(line++);
410
+    tft_string.set(string);
411
+    tft_string.trim();
412
+    tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
413
+  }
414
+
415
+  if (suff) {
416
+    menu_line(line);
417
+    tft_string.set(suff);
418
+    tft_string.trim();
419
+    tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
420
+  }
421
+  #if ENABLED(TOUCH_SCREEN)
422
+    add_control(88, TFT_HEIGHT - 64, CANCEL, imgCancel, true, yesno ? HALF(COLOR_CONTROL_CANCEL) : COLOR_CONTROL_CANCEL);
423
+    add_control(328, TFT_HEIGHT - 64, CONFIRM, imgConfirm, true, yesno ? COLOR_CONTROL_CONFIRM : HALF(COLOR_CONTROL_CONFIRM));
424
+  #else
425
+    menu_line(++line);
426
+    if (no) {
427
+      tft_string.set(no);
428
+      tft_string.trim();
429
+      tft.add_text(tft_string.center(TFT_WIDTH / 2), 0, !yesno ? COLOR_RED : COLOR_MENU_TEXT, tft_string);
430
+    }
431
+
432
+    if (yes) {
433
+      tft_string.set(yes);
434
+      tft_string.trim();
435
+      tft.add_text(TFT_WIDTH / 2 + tft_string.center(TFT_WIDTH / 2), 0, yesno ? COLOR_RED : COLOR_MENU_TEXT, tft_string);
436
+    }
437
+  #endif
438
+}
439
+
440
+#if ENABLED(ADVANCED_PAUSE_FEATURE)
441
+
442
+  void MarlinUI::draw_hotend_status(const uint8_t row, const uint8_t extruder) {
443
+    #if ENABLED(TOUCH_SCREEN)
444
+      touch.clear();
445
+      draw_menu_navigation = false;
446
+      touch.add_control(RESUME_CONTINUE , 0, 0, TFT_WIDTH, TFT_HEIGHT);
447
+    #endif
448
+
449
+    menu_line(row);
450
+    tft_string.set(GET_TEXT(MSG_FILAMENT_CHANGE_NOZZLE));
451
+    tft_string.add('E');
452
+    tft_string.add((char)('1' + extruder));
453
+    tft_string.add(' ');
454
+    tft_string.add(i16tostr3rj(thermalManager.degHotend(extruder)));
455
+    tft_string.add(LCD_STR_DEGREE);
456
+    tft_string.add(" / ");
457
+    tft_string.add(i16tostr3rj(thermalManager.degTargetHotend(extruder)));
458
+    tft_string.add(LCD_STR_DEGREE);
459
+    tft_string.trim();
460
+    tft.add_text(tft_string.center(TFT_WIDTH), 0, COLOR_MENU_TEXT, tft_string);
461
+  }
462
+
463
+#endif // ADVANCED_PAUSE_FEATURE
464
+
465
+#if ENABLED(AUTO_BED_LEVELING_UBL)
466
+  #define GRID_OFFSET_X   8
467
+  #define GRID_OFFSET_Y   8
468
+  #define GRID_WIDTH      192
469
+  #define GRID_HEIGHT     192
470
+  #define CONTROL_OFFSET  16
471
+
472
+  void MarlinUI::ubl_plot(const uint8_t x_plot, const uint8_t y_plot) {
473
+
474
+    tft.canvas(GRID_OFFSET_X, GRID_OFFSET_Y, GRID_WIDTH, GRID_HEIGHT);
475
+    tft.set_background(COLOR_BACKGROUND);
476
+    tft.add_rectangle(0, 0, GRID_WIDTH, GRID_HEIGHT, COLOR_WHITE);
477
+
478
+    for (uint16_t x = 0; x < GRID_MAX_POINTS_X ; x++)
479
+      for (uint16_t y = 0; y < GRID_MAX_POINTS_Y ; y++)
480
+        if (position_is_reachable({ ubl.mesh_index_to_xpos(x), ubl.mesh_index_to_ypos(y) }))
481
+          tft.add_bar(1 + (x * 2 + 1) * (GRID_WIDTH - 4) / GRID_MAX_POINTS_X / 2, GRID_HEIGHT - 3 - ((y * 2 + 1) * (GRID_HEIGHT - 4) / GRID_MAX_POINTS_Y / 2), 2, 2, COLOR_UBL);
482
+
483
+    tft.add_rectangle((x_plot * 2 + 1) * (GRID_WIDTH - 4) / GRID_MAX_POINTS_X / 2 - 1, GRID_HEIGHT - 5 - ((y_plot * 2 + 1) * (GRID_HEIGHT - 4) / GRID_MAX_POINTS_Y / 2), 6, 6, COLOR_UBL);
484
+
485
+    const xy_pos_t pos = { ubl.mesh_index_to_xpos(x_plot), ubl.mesh_index_to_ypos(y_plot) },
486
+                   lpos = pos.asLogical();
487
+
488
+    tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 - MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
489
+    tft.set_background(COLOR_BACKGROUND);
490
+    tft_string.set(X_LBL);
491
+    tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
492
+    tft_string.set(ftostr52(lpos.x));
493
+    tft_string.trim();
494
+    tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
495
+
496
+    tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, 120, MENU_ITEM_HEIGHT);
497
+    tft.set_background(COLOR_BACKGROUND);
498
+    tft_string.set(Y_LBL);
499
+    tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
500
+    tft_string.set(ftostr52(lpos.y));
501
+    tft_string.trim();
502
+    tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
503
+
504
+    tft.canvas(320, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2 + MENU_ITEM_HEIGHT, 120, MENU_ITEM_HEIGHT);
505
+    tft.set_background(COLOR_BACKGROUND);
506
+    tft_string.set(Z_LBL);
507
+    tft.add_text(0, MENU_TEXT_Y_OFFSET, COLOR_MENU_TEXT, tft_string);
508
+    tft_string.set(isnan(ubl.z_values[x_plot][y_plot]) ? "-----" : ftostr43sign(ubl.z_values[x_plot][y_plot]));
509
+    tft_string.trim();
510
+    tft.add_text(120 - tft_string.width(), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
511
+
512
+    constexpr uint8_t w = (TFT_WIDTH) / 10;
513
+    tft.canvas(GRID_OFFSET_X + (GRID_WIDTH - w) / 2, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET - 5, w, MENU_ITEM_HEIGHT);
514
+    tft.set_background(COLOR_BACKGROUND);
515
+    tft_string.set(ui8tostr3rj(x_plot));
516
+    tft_string.trim();
517
+    tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
518
+
519
+    tft.canvas(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET + 16 - 24, GRID_OFFSET_Y + (GRID_HEIGHT - MENU_ITEM_HEIGHT) / 2, w, MENU_ITEM_HEIGHT);
520
+    tft.set_background(COLOR_BACKGROUND);
521
+    tft_string.set(ui8tostr3rj(y_plot));
522
+    tft_string.trim();
523
+    tft.add_text(tft_string.center(w), MENU_TEXT_Y_OFFSET, COLOR_MENU_VALUE, tft_string);
524
+
525
+    #if ENABLED(TOUCH_SCREEN)
526
+      touch.clear();
527
+      draw_menu_navigation = false;
528
+      add_control(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET,      GRID_OFFSET_Y + CONTROL_OFFSET,                    UBL,   ENCODER_STEPS_PER_MENU_ITEM * GRID_MAX_POINTS_X, imgUp);
529
+      add_control(GRID_OFFSET_X + GRID_WIDTH + CONTROL_OFFSET,      GRID_OFFSET_Y + GRID_HEIGHT - CONTROL_OFFSET - 32, UBL, - ENCODER_STEPS_PER_MENU_ITEM * GRID_MAX_POINTS_X, imgDown);
530
+      add_control(GRID_OFFSET_X + CONTROL_OFFSET,                   GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET,      UBL, - ENCODER_STEPS_PER_MENU_ITEM, imgLeft);
531
+      add_control(GRID_OFFSET_X + GRID_WIDTH - CONTROL_OFFSET - 32, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET,      UBL,   ENCODER_STEPS_PER_MENU_ITEM, imgRight);
532
+      add_control(320, GRID_OFFSET_Y + GRID_HEIGHT + CONTROL_OFFSET, CLICK, imgLeveling);
533
+      add_control(224, TFT_HEIGHT - 34, BACK, imgBack);
534
+    #endif
535
+  }
536
+#endif // AUTO_BED_LEVELING_UBL
537
+
538
+#if ENABLED(BABYSTEP_ZPROBE_OFFSET)
539
+  #include "../../feature/babystep.h"
540
+#endif
541
+
542
+#if HAS_BED_PROBE
543
+  #include "../../module/probe.h"
544
+#endif
545
+
546
+#define Z_SELECTION_Z 1
547
+#define Z_SELECTION_Z_PROBE -1
548
+
549
+struct MotionAxisState {
550
+  xy_int_t xValuePos, yValuePos, zValuePos, eValuePos, stepValuePos, zTypePos, eNamePos;
551
+  float currentStepSize = 10.0;
552
+  int z_selection = Z_SELECTION_Z;
553
+  uint8_t e_selection = 0;
554
+  bool homming = false;
555
+  bool blocked = false;
556
+  char message[32];
557
+};
558
+
559
+MotionAxisState motionAxisState;
560
+
561
+#define E_BTN_COLOR COLOR_YELLOW
562
+#define X_BTN_COLOR COLOR_CORAL_RED
563
+#define Y_BTN_COLOR COLOR_VIVID_GREEN
564
+#define Z_BTN_COLOR COLOR_LIGHT_BLUE
565
+
566
+#define BTN_WIDTH 64
567
+#define BTN_HEIGHT 52
568
+#define X_MARGIN 20
569
+#define Y_MARGIN 15
570
+
571
+static void quick_feedback() {
572
+  #if HAS_CHIRP
573
+    ui.chirp(); // Buzz and wait. Is the delay needed for buttons to settle?
574
+    #if BOTH(HAS_LCD_MENU, USE_BEEPER)
575
+      for (int8_t i = 5; i--;) { buzzer.tick(); delay(2); }
576
+    #elif HAS_LCD_MENU
577
+      delay(10);
578
+    #endif
579
+  #endif
580
+}
581
+
582
+#define CUR_STEP_VALUE_WIDTH 104
583
+static void drawCurStepValue() {
584
+  tft_string.set((uint8_t *)ftostr52sp(motionAxisState.currentStepSize));
585
+  tft_string.add("mm");
586
+  tft.canvas(motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT);
587
+  tft.set_background(COLOR_BACKGROUND);
588
+  tft.add_text(tft_string.center(CUR_STEP_VALUE_WIDTH), 0, COLOR_AXIS_HOMED, tft_string);
589
+}
590
+
591
+static void drawCurZSelection() {
592
+  tft_string.set("Z");
593
+  tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y, tft_string.width(), 34);
594
+  tft.set_background(COLOR_BACKGROUND);
595
+  tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
596
+  tft.queue.sync();
597
+  tft_string.set("Offset");
598
+  tft.canvas(motionAxisState.zTypePos.x, motionAxisState.zTypePos.y + 34, tft_string.width(), 34);
599
+  tft.set_background(COLOR_BACKGROUND);
600
+  if (motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
601
+    tft.add_text(0, 0, Z_BTN_COLOR, tft_string);
602
+  }
603
+}
604
+
605
+static void drawCurESelection() {
606
+  tft.canvas(motionAxisState.eNamePos.x, motionAxisState.eNamePos.y, BTN_WIDTH, BTN_HEIGHT);
607
+  tft.set_background(COLOR_BACKGROUND);
608
+  tft_string.set("E");
609
+  tft.add_text(0, 0, E_BTN_COLOR , tft_string);
610
+  tft.add_text(tft_string.width(), 0, E_BTN_COLOR, ui8tostr3rj(motionAxisState.e_selection));
611
+}
612
+
613
+static void drawMessage(const char *msg) {
614
+  tft.canvas(X_MARGIN, TFT_HEIGHT - Y_MARGIN - 34, TFT_HEIGHT / 2, 34);
615
+  tft.set_background(COLOR_BACKGROUND);
616
+  tft.add_text(0, 0, COLOR_YELLOW, msg);
617
+}
618
+
619
+static void drawAxisValue(AxisEnum axis) {
620
+  const float value =
621
+    #if HAS_BED_PROBE
622
+      axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE ?
623
+      probe.offset.z :
624
+    #endif
625
+    NATIVE_TO_LOGICAL(
626
+      ui.manual_move.processing ? destination[axis] : current_position[axis] + TERN0(IS_KINEMATIC, ui.manual_move.offset),
627
+      axis
628
+    );
629
+  xy_int_t pos;
630
+  uint16_t color;
631
+  switch (axis) {
632
+    case X_AXIS: pos = motionAxisState.xValuePos; color = X_BTN_COLOR; break;
633
+    case Y_AXIS: pos = motionAxisState.yValuePos; color = Y_BTN_COLOR; break;
634
+    case Z_AXIS: pos = motionAxisState.zValuePos; color = Z_BTN_COLOR; break;
635
+    case E_AXIS: pos = motionAxisState.eValuePos; color = E_BTN_COLOR; break;
636
+    default: return;
637
+  }
638
+  tft.canvas(pos.x, pos.y, BTN_WIDTH + X_MARGIN, BTN_HEIGHT);
639
+  tft.set_background(COLOR_BACKGROUND);
640
+  tft_string.set(ftostr52sp(value));
641
+  tft.add_text(0, 0, color, tft_string);
642
+}
643
+
644
+static void moveAxis(AxisEnum axis, const int8_t direction) {
645
+  quick_feedback();
646
+
647
+  if (axis == E_AXIS && thermalManager.temp_hotend[motionAxisState.e_selection].celsius < EXTRUDE_MINTEMP) {
648
+    drawMessage("Too cold");
649
+    return;
650
+  }
651
+
652
+  const float diff = motionAxisState.currentStepSize * direction;
653
+
654
+  if (axis == Z_AXIS && motionAxisState.z_selection == Z_SELECTION_Z_PROBE) {
655
+    #if ENABLED(BABYSTEP_ZPROBE_OFFSET)
656
+      const int16_t babystep_increment = direction * BABYSTEP_SIZE_Z;
657
+      const bool do_probe = DISABLED(BABYSTEP_HOTEND_Z_OFFSET) || active_extruder == 0;
658
+      const float bsDiff = planner.steps_to_mm[Z_AXIS] * babystep_increment,
659
+                  new_probe_offset = probe.offset.z + bsDiff,
660
+                  new_offs = TERN(BABYSTEP_HOTEND_Z_OFFSET
661
+                    , do_probe ? new_probe_offset : hotend_offset[active_extruder].z - bsDiff
662
+                    , new_probe_offset
663
+                  );
664
+      if (WITHIN(new_offs, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX)) {
665
+        babystep.add_steps(Z_AXIS, babystep_increment);
666
+        if (do_probe)
667
+          probe.offset.z = new_offs;
668
+        else
669
+          TERN(BABYSTEP_HOTEND_Z_OFFSET, hotend_offset[active_extruder].z = new_offs, NOOP);
670
+        drawMessage(""); // clear the error
671
+        drawAxisValue(axis);
672
+      }
673
+      else {
674
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
675
+      }
676
+    #elif HAS_BED_PROBE
677
+      // only change probe.offset.z
678
+      probe.offset.z += diff;
679
+      if (direction < 0 && current_position[axis] < Z_PROBE_OFFSET_RANGE_MIN) {
680
+        current_position[axis] = Z_PROBE_OFFSET_RANGE_MIN;
681
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
682
+      }
683
+      else if (direction > 0 && current_position[axis] > Z_PROBE_OFFSET_RANGE_MAX) {
684
+        current_position[axis] = Z_PROBE_OFFSET_RANGE_MAX;
685
+        drawMessage(GET_TEXT(MSG_LCD_SOFT_ENDSTOPS));
686
+      }
687
+      else {
688
+        drawMessage(""); // clear the error
689
+      }
690
+      drawAxisValue(axis);
691
+    #endif
692
+    return;
693
+  }
694
+
695
+  if (!ui.manual_move.processing) {
696
+    // Get motion limit from software endstops, if any
697
+    float min, max;
698
+    soft_endstop.get_manual_axis_limits(axis, min, max);
699
+
700
+    // Delta limits XY based on the current offset from center
701
+    // This assumes the center is 0,0
702
+    #if ENABLED(DELTA)
703
+      if (axis != Z_AXIS && axis != E_AXIS) {
704
+        max = SQRT(sq((float)(DELTA_PRINTABLE_RADIUS)) - sq(current_position[Y_AXIS - axis])); // (Y_AXIS - axis) == the other axis
705
+        min = -max;
706
+      }
707
+    #endif
708
+
709
+    // Get the new position
710
+    #if IS_KINEMATIC
711
+      ui.manual_move.offset += diff;
712
+      if (direction < 0)
713
+        NOLESS(ui.manual_move.offset, min - current_position[axis]);
714
+      else
715
+        NOMORE(ui.manual_move.offset, max - current_position[axis]);
716
+    #else
717
+      current_position[axis] += diff;
718
+      const char *msg = NUL_STR; // clear the error
719
+      if (direction < 0 && current_position[axis] < min) {
720
+        current_position[axis] = min;
721
+        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
722
+      }
723
+      else if (direction > 0 && current_position[axis] > max) {
724
+        current_position[axis] = max;
725
+        msg = GET_TEXT(MSG_LCD_SOFT_ENDSTOPS);
726
+      }
727
+      drawMessage(msg);
728
+    #endif
729
+
730
+    ui.manual_move.soon(axis
731
+      #if MULTI_MANUAL
732
+        , motionAxisState.e_selection
733
+      #endif
734
+    );
735
+  }
736
+
737
+  drawAxisValue(axis);
738
+}
739
+
740
+static void e_plus()  { moveAxis(E_AXIS, 1);  }
741
+static void e_minus() { moveAxis(E_AXIS, -1); }
742
+static void x_minus() { moveAxis(X_AXIS, -1); }
743
+static void x_plus()  { moveAxis(X_AXIS, 1);  }
744
+static void y_plus()  { moveAxis(Y_AXIS, 1);  }
745
+static void y_minus() { moveAxis(Y_AXIS, -1); }
746
+static void z_plus()  { moveAxis(Z_AXIS, 1);  }
747
+static void z_minus() { moveAxis(Z_AXIS, -1); }
748
+
749
+#if ENABLED(TOUCH_SCREEN)
750
+  static void e_select() {
751
+    motionAxisState.e_selection++;
752
+    if (motionAxisState.e_selection >= EXTRUDERS) {
753
+      motionAxisState.e_selection = 0;
754
+    }
755
+
756
+    quick_feedback();
757
+    drawCurESelection();
758
+    drawAxisValue(E_AXIS);
759
+  }
760
+
761
+  static void do_home() {
762
+    quick_feedback();
763
+    drawMessage(GET_TEXT(MSG_LEVEL_BED_HOMING));
764
+    queue.inject_P(G28_STR);
765
+    // Disable touch until home is done
766
+    TERN_(HAS_TFT_XPT2046, touch.disable());
767
+    drawAxisValue(E_AXIS);
768
+    drawAxisValue(X_AXIS);
769
+    drawAxisValue(Y_AXIS);
770
+    drawAxisValue(Z_AXIS);
771
+  }
772
+
773
+  static void step_size() {
774
+    motionAxisState.currentStepSize = motionAxisState.currentStepSize / 10.0;
775
+    if (motionAxisState.currentStepSize < 0.0015) motionAxisState.currentStepSize = 10.0;
776
+    quick_feedback();
777
+    drawCurStepValue();
778
+  }
779
+#endif
780
+
781
+#if HAS_BED_PROBE
782
+  static void z_select() {
783
+    motionAxisState.z_selection *= -1;
784
+    quick_feedback();
785
+    drawCurZSelection();
786
+    drawAxisValue(Z_AXIS);
787
+  }
788
+#endif
789
+
790
+static void disable_steppers() {
791
+  quick_feedback();
792
+  queue.inject_P(PSTR("M84"));
793
+}
794
+
795
+static void drawBtn(int x, int y, const char *label, intptr_t data, MarlinImage img, uint16_t bgColor, bool enabled = true) {
796
+  uint16_t width = Images[imgBtn52Rounded].width;
797
+  uint16_t height = Images[imgBtn52Rounded].height;
798
+
799
+  if (!enabled) bgColor = COLOR_CONTROL_DISABLED;
800
+
801
+  tft.canvas(x, y, width, height);
802
+  tft.set_background(COLOR_BACKGROUND);
803
+  tft.add_image(0, 0, imgBtn52Rounded, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
804
+
805
+  // TODO: Make an add_text() taking a font arg
806
+  if (label) {
807
+    tft_string.set(label);
808
+    tft_string.trim();
809
+    tft.add_text(tft_string.center(width), height / 2 - tft_string.font_height() / 2, bgColor, tft_string);
810
+  }
811
+  else {
812
+    tft.add_image(0, 0, img, bgColor, COLOR_BACKGROUND, COLOR_DARKGREY);
813
+  }
814
+
815
+  TERN_(HAS_TFT_XPT2046, if (enabled) touch.add_control(BUTTON, x, y, width, height, data));
816
+}
817
+
818
+void MarlinUI::move_axis_screen() {
819
+  // Reset
820
+  defer_status_screen(true);
821
+  motionAxisState.blocked = false;
822
+  TERN_(HAS_TFT_XPT2046, touch.enable());
823
+
824
+  ui.clear_lcd();
825
+
826
+  TERN_(TOUCH_SCREEN, touch.clear());
827
+
828
+  const bool busy = printingIsActive();
829
+
830
+  // Babysteps during printing? Select babystep for Z probe offset
831
+  if (busy && ENABLED(BABYSTEP_ZPROBE_OFFSET))
832
+    motionAxisState.z_selection = Z_SELECTION_Z_PROBE;
833
+
834
+  // ROW 1 -> E- Y- CurY Z+
835
+  int x = X_MARGIN, y = Y_MARGIN, spacing = 0;
836
+
837
+  drawBtn(x, y, "E+", (intptr_t)e_plus, imgUp, E_BTN_COLOR, !busy);
838
+
839
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
840
+  x += BTN_WIDTH + spacing;
841
+  drawBtn(x, y, "Y+", (intptr_t)y_plus, imgUp, Y_BTN_COLOR, !busy);
842
+
843
+  // Cur Y
844
+  x += BTN_WIDTH;
845
+  motionAxisState.yValuePos.x = x + 2;
846
+  motionAxisState.yValuePos.y = y;
847
+  drawAxisValue(Y_AXIS);
848
+
849
+  x += spacing;
850
+  drawBtn(x, y, "Z+", (intptr_t)z_plus, imgUp, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
851
+
852
+  // ROW 2 -> "Ex"  X-  HOME X+  "Z"
853
+  y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
854
+  x = X_MARGIN;
855
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4;
856
+
857
+  motionAxisState.eNamePos.x = x;
858
+  motionAxisState.eNamePos.y = y;
859
+  drawCurESelection();
860
+  TERN_(HAS_TFT_XPT2046, if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, BTN_HEIGHT, (intptr_t)e_select));
861
+
862
+  x += BTN_WIDTH + spacing;
863
+  drawBtn(x, y, "X-", (intptr_t)x_minus, imgLeft, X_BTN_COLOR, !busy);
864
+
865
+  x += BTN_WIDTH + spacing; //imgHome is 64x64
866
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH / 2 - Images[imgHome].width / 2, y - (Images[imgHome].width - BTN_HEIGHT) / 2, BUTTON, (intptr_t)do_home, imgHome, !busy));
867
+
868
+  x += BTN_WIDTH + spacing;
869
+  uint16_t xplus_x = x;
870
+  drawBtn(x, y, "X+", (intptr_t)x_plus, imgRight, X_BTN_COLOR, !busy);
871
+
872
+  x += BTN_WIDTH + spacing;
873
+  motionAxisState.zTypePos.x = x;
874
+  motionAxisState.zTypePos.y = y;
875
+  drawCurZSelection();
876
+  #if BOTH(HAS_BED_PROBE, TOUCH_SCREEN)
877
+    if (!busy) touch.add_control(BUTTON, x, y, BTN_WIDTH, 34 * 2, (intptr_t)z_select);
878
+  #endif
879
+
880
+  // ROW 3 -> E- CurX Y-  Z-
881
+  y += BTN_HEIGHT + (TFT_HEIGHT - Y_MARGIN * 2 - 4 * BTN_HEIGHT) / 3;
882
+  x = X_MARGIN;
883
+  spacing = (TFT_WIDTH - X_MARGIN * 2 - 3 * BTN_WIDTH) / 2;
884
+
885
+  drawBtn(x, y, "E-", (intptr_t)e_minus, imgDown, E_BTN_COLOR, !busy);
886
+
887
+  // Cur E
888
+  motionAxisState.eValuePos.x = x;
889
+  motionAxisState.eValuePos.y = y + BTN_HEIGHT + 2;
890
+  drawAxisValue(E_AXIS);
891
+
892
+  // Cur X
893
+  motionAxisState.xValuePos.x = BTN_WIDTH + (TFT_WIDTH - X_MARGIN * 2 - 5 * BTN_WIDTH) / 4; //X- pos
894
+  motionAxisState.xValuePos.y = y - 10;
895
+  drawAxisValue(X_AXIS);
896
+
897
+  x += BTN_WIDTH + spacing;
898
+  drawBtn(x, y, "Y-", (intptr_t)y_minus, imgDown, Y_BTN_COLOR, !busy);
899
+
900
+  x += BTN_WIDTH + spacing;
901
+  drawBtn(x, y, "Z-", (intptr_t)z_minus, imgDown, Z_BTN_COLOR, !busy || ENABLED(BABYSTEP_ZPROBE_OFFSET)); //only enabled when not busy or have baby step
902
+
903
+  // Cur Z
904
+  motionAxisState.zValuePos.x = x;
905
+  motionAxisState.zValuePos.y = y + BTN_HEIGHT + 2;
906
+  drawAxisValue(Z_AXIS);
907
+
908
+  // ROW 4 -> step_size  disable steppers back
909
+  y = TFT_HEIGHT - Y_MARGIN - 32; //
910
+  x = TFT_WIDTH / 2 - CUR_STEP_VALUE_WIDTH / 2;
911
+  motionAxisState.stepValuePos.x = x;
912
+  motionAxisState.stepValuePos.y = y;
913
+  if (!busy) {
914
+    drawCurStepValue();
915
+    TERN_(HAS_TFT_XPT2046, touch.add_control(BUTTON, motionAxisState.stepValuePos.x, motionAxisState.stepValuePos.y, CUR_STEP_VALUE_WIDTH, BTN_HEIGHT, (intptr_t)step_size));
916
+  }
917
+
918
+  // aligned with x+
919
+  drawBtn(xplus_x, TFT_HEIGHT - Y_MARGIN - BTN_HEIGHT, "off", (intptr_t)disable_steppers, imgCancel, COLOR_WHITE, !busy);
920
+
921
+  TERN_(HAS_TFT_XPT2046, add_control(TFT_WIDTH - X_MARGIN - BTN_WIDTH, y, BACK, imgBack));
922
+}
923
+
924
+#undef BTN_WIDTH
925
+#undef BTN_HEIGHT
926
+
927
+#endif // HAS_UI_480x320

+ 43
- 0
Marlin/src/lcd/tft/ui_1024x600.h Переглянути файл

@@ -0,0 +1,43 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2020 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#define MARLIN_LOGO_FULL_SIZE MarlinLogo480x320x16
25
+
26
+#include "ui_common.h"
27
+
28
+#define TFT_STATUS_TOP_Y       4
29
+#define TFT_TOP_LINE_Y         4
30
+
31
+#define MENU_TEXT_X_OFFSET    16
32
+#define MENU_TEXT_Y_OFFSET     7
33
+
34
+#define MENU_ITEM_ICON_X       5
35
+#define MENU_ITEM_ICON_Y       5
36
+#define MENU_ITEM_ICON_SPACE  42
37
+
38
+#define MENU_FONT_NAME      Helvetica18
39
+#define SYMBOLS_FONT_NAME   Helvetica18_symbols
40
+#define MENU_ITEM_HEIGHT    43
41
+#define FONT_LINE_HEIGHT    34
42
+
43
+#define MENU_LINE_HEIGHT      (MENU_ITEM_HEIGHT + 2)

+ 4
- 0
Marlin/src/lcd/tft/ui_common.h Переглянути файл

@@ -39,6 +39,10 @@
39 39
   #include "ui_320x240.h"
40 40
 #elif HAS_UI_480x320 || HAS_UI_480x272
41 41
   #include "ui_480x320.h"
42
+#elif HAS_UI_1024x600
43
+  #include "ui_1024x600.h"
44
+#else
45
+  #error "Unsupported display resolution!"
42 46
 #endif
43 47
 
44 48
 void draw_heater_status(uint16_t x, uint16_t y, const int8_t Heater);

+ 14
- 1
Marlin/src/lcd/tft_io/tft_io.cpp Переглянути файл

@@ -22,7 +22,7 @@
22 22
 
23 23
 #include "tft_io.h"
24 24
 
25
-#if HAS_SPI_TFT || HAS_FSMC_TFT
25
+#if HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT
26 26
 
27 27
 #include "st7735.h"
28 28
 #include "st7789v.h"
@@ -90,6 +90,8 @@ if (lcd_id != 0xFFFFFFFF) return;
90 90
     lcd_id = io.GetID() & 0xFFFF;
91 91
 
92 92
     switch (lcd_id) {
93
+      case LTDC_RGB:
94
+        break;
93 95
       case ST7796:    // ST7796S    480x320
94 96
         DEBUG_ECHO_MSG(" ST7796S");
95 97
         write_esc_sequence(st7796s_init);
@@ -144,6 +146,17 @@ void TFT_IO::set_window(uint16_t Xmin, uint16_t Ymin, uint16_t Xmax, uint16_t Ym
144 146
   #endif
145 147
 
146 148
   switch (lcd_id) {
149
+    case LTDC_RGB:
150
+      io.WriteReg(0x01);
151
+      io.WriteData(Xmin);
152
+      io.WriteReg(0x02);
153
+      io.WriteData(Xmax);
154
+      io.WriteReg(0x03);
155
+      io.WriteData(Ymin);
156
+      io.WriteReg(0x04);
157
+      io.WriteData(Ymax);
158
+      io.WriteReg(0x00);
159
+      break;
147 160
     case ST7735:    // ST7735     160x128
148 161
     case ST7789:    // ST7789V    320x240
149 162
     case ST7796:    // ST7796     480x320

+ 5
- 2
Marlin/src/lcd/tft_io/tft_io.h Переглянути файл

@@ -23,14 +23,16 @@
23 23
 
24 24
 #include "../../inc/MarlinConfig.h"
25 25
 
26
-#if HAS_SPI_TFT || HAS_FSMC_TFT
26
+#if HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT
27 27
 
28 28
 #if HAS_SPI_TFT
29 29
   #include HAL_PATH(../../HAL, tft/tft_spi.h)
30 30
 #elif HAS_FSMC_TFT
31 31
   #include HAL_PATH(../../HAL, tft/tft_fsmc.h)
32
+#elif HAS_LTDC_TFT
33
+  #include HAL_PATH(../../HAL, tft/tft_ltdc.h)
32 34
 #else
33
-  #error "TFT IO only supports SPI or FSMC interface"
35
+  #error "TFT IO only supports SPI, FSMC or LTDC interface"
34 36
 #endif
35 37
 
36 38
 #define TFT_EXCHANGE_XY (1UL << 1)
@@ -91,6 +93,7 @@
91 93
   #define TOUCH_ORIENTATION     TOUCH_LANDSCAPE
92 94
 #endif
93 95
 
96
+#define LTDC_RGB        0xABAB
94 97
 #define SSD1963         0x5761
95 98
 #define ST7735          0x89F0
96 99
 #define ST7789          0x8552

+ 2
- 0
Marlin/src/pins/pins.h Переглянути файл

@@ -631,6 +631,8 @@
631 631
   #include "stm32f7/pins_REMRAM_V1.h"           // STM32F7                                env:REMRAM_V1
632 632
 #elif MB(NUCLEO_F767ZI)
633 633
   #include "stm32f7/pins_NUCLEO_F767ZI.h"       // STM32F7                                env:NUCLEO_F767ZI
634
+#elif MB(BTT_SKR_SE_BX)
635
+  #include "stm32h7/pins_BTT_SKR_SE_BX.h"       // STM32H7                                env:BTT_SKR_SE_BX
634 636
 #elif MB(TEENSY41)
635 637
   #include "teensy4/pins_TEENSY41.h"            // Teensy-4.x                             env:teensy41
636 638
 #elif MB(T41U5XBB)

+ 226
- 0
Marlin/src/pins/stm32h7/pins_BTT_SKR_SE_BX.h Переглянути файл

@@ -0,0 +1,226 @@
1
+/**
2
+ * Marlin 3D Printer Firmware
3
+ * Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
4
+ *
5
+ * Based on Sprinter and grbl.
6
+ * Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
7
+ *
8
+ * This program is free software: you can redistribute it and/or modify
9
+ * it under the terms of the GNU General Public License as published by
10
+ * the Free Software Foundation, either version 3 of the License, or
11
+ * (at your option) any later version.
12
+ *
13
+ * This program is distributed in the hope that it will be useful,
14
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
+ * GNU General Public License for more details.
17
+ *
18
+ * You should have received a copy of the GNU General Public License
19
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
20
+ *
21
+ */
22
+#pragma once
23
+
24
+#if NOT_TARGET(STM32H7)
25
+  #error "Oops! Select an STM32H7 board in 'Tools > Board.'"
26
+#endif
27
+
28
+#define BOARD_INFO_NAME      "BTT SKR SE BX"
29
+#define DEFAULT_MACHINE_NAME "BIQU-BX"
30
+
31
+// Onboard I2C EEPROM
32
+#define I2C_EEPROM
33
+#define MARLIN_EEPROM_SIZE                0x1000  // 4KB (24C32 ... 32Kb = 4KB)
34
+
35
+// USB Flash Drive support
36
+#define HAS_OTG_USB_HOST_SUPPORT
37
+
38
+//
39
+// Limit Switches
40
+//
41
+#define X_MIN_PIN                           PB11
42
+#define X_MAX_PIN                           PD13
43
+#define Y_MIN_PIN                           PB12
44
+#define Y_MAX_PIN                           PB13
45
+#define Z_MIN_PIN                           PD12
46
+#define Z_MAX_PIN                           PD11
47
+
48
+#define FIL_RUNOUT_PIN                      PD13
49
+#define FIL_RUNOUT2_PIN                     PB13
50
+
51
+#define LED_PIN                             PA13
52
+#define BEEPER_PIN                          PA14
53
+
54
+#define TFT_BACKLIGHT_PIN                   PB5
55
+
56
+#define POWER_MONITOR_PIN                   PB0
57
+#define RPI_POWER_PIN                       PE5
58
+
59
+#define SAFE_POWER_PIN                      PI11
60
+#define SERVO0_PIN                          PA2
61
+
62
+//
63
+// Z Probe (when not Z_MIN_PIN)
64
+//
65
+#ifndef Z_MIN_PROBE_PIN
66
+  #define Z_MIN_PROBE_PIN                   PH2   // Probe
67
+#endif
68
+
69
+//
70
+// Steppers
71
+//
72
+#define X_STEP_PIN                          PG13
73
+#define X_DIR_PIN                           PG12
74
+#define X_ENABLE_PIN                        PG14
75
+#define X_CS_PIN                            PG10
76
+
77
+#define Y_STEP_PIN                          PB3
78
+#define Y_DIR_PIN                           PD3
79
+#define Y_ENABLE_PIN                        PB4
80
+#define Y_CS_PIN                            PD4
81
+
82
+#define Z_STEP_PIN                          PD7
83
+#define Z_DIR_PIN                           PD6
84
+#define Z_ENABLE_PIN                        PG9
85
+#define Z_CS_PIN                            PD5
86
+
87
+#define E0_STEP_PIN                         PC14
88
+#define E0_DIR_PIN                          PC13
89
+#define E0_ENABLE_PIN                       PC15
90
+#define E0_CS_PIN                           PI8
91
+
92
+#define E1_STEP_PIN                         PA8
93
+#define E1_DIR_PIN                          PC9
94
+#define E1_ENABLE_PIN                       PD2
95
+#define E1_CS_PIN                           PC8
96
+
97
+//
98
+// Software SPI pins for TMC2130 stepper drivers
99
+//
100
+#if ENABLED(TMC_USE_SW_SPI)
101
+  #ifndef TMC_SW_MOSI
102
+    #define TMC_SW_MOSI                     PC6
103
+  #endif
104
+  #ifndef TMC_SW_MISO
105
+    #define TMC_SW_MISO                     PG3
106
+  #endif
107
+  #ifndef TMC_SW_SCK
108
+    #define TMC_SW_SCK                      PC7
109
+  #endif
110
+#endif
111
+
112
+#if HAS_TMC_UART
113
+  /**
114
+   * TMC2208/TMC2209 stepper drivers
115
+   *
116
+   * Hardware serial communication ports.
117
+   * If undefined software serial is used according to the pins below
118
+   */
119
+  //#define X_HARDWARE_SERIAL  Serial
120
+  //#define X2_HARDWARE_SERIAL Serial1
121
+  //#define Y_HARDWARE_SERIAL  Serial1
122
+  //#define Y2_HARDWARE_SERIAL Serial1
123
+  //#define Z_HARDWARE_SERIAL  Serial1
124
+  //#define Z2_HARDWARE_SERIAL Serial1
125
+  //#define E0_HARDWARE_SERIAL Serial1
126
+  //#define E1_HARDWARE_SERIAL Serial1
127
+  //#define E2_HARDWARE_SERIAL Serial1
128
+  //#define E3_HARDWARE_SERIAL Serial1
129
+  //#define E4_HARDWARE_SERIAL Serial1
130
+  //#define E5_HARDWARE_SERIAL Serial1
131
+  //#define E6_HARDWARE_SERIAL Serial1
132
+  //#define E7_HARDWARE_SERIAL Serial1
133
+
134
+  //
135
+  // Software serial
136
+  //
137
+  #define X_SERIAL_TX_PIN                   PG10
138
+  #define X_SERIAL_RX_PIN                   PG10
139
+
140
+  #define Y_SERIAL_TX_PIN                   PD4
141
+  #define Y_SERIAL_RX_PIN                   PD4
142
+
143
+  #define Z_SERIAL_TX_PIN                   PD5
144
+  #define Z_SERIAL_RX_PIN                   PD5
145
+
146
+  #define E0_SERIAL_TX_PIN                  PI8
147
+  #define E0_SERIAL_RX_PIN                  PI8
148
+
149
+  #define E1_SERIAL_TX_PIN                  PC8
150
+  #define E1_SERIAL_RX_PIN                  PC8
151
+
152
+  // Reduce baud rate to improve software serial reliability
153
+  #define TMC_BAUD_RATE                    19200
154
+#endif
155
+
156
+//
157
+// Temperature Sensors
158
+//
159
+#define TEMP_0_PIN                          PH4   // TH0
160
+#define TEMP_1_PIN                          PA3   // TH1
161
+#define TEMP_BED_PIN                        PH5   // TB
162
+
163
+//
164
+// Heaters / Fans
165
+//
166
+#define HEATER_0_PIN                        PC4
167
+#define HEATER_1_PIN                        PC5
168
+#define HEATER_BED_PIN                      PA4
169
+
170
+#define FAN_PIN                             PA5   // "FAN0"
171
+#define FAN1_PIN                            PA6   // "FAN1"
172
+#define FAN2_PIN                            PA7   // "FAN2"
173
+
174
+#define NEOPIXEL_PIN                        PH3
175
+#define NEOPIXEL2_PIN                       PB1
176
+
177
+#if HAS_LTDC_TFT
178
+
179
+  // LTDC_LCD Timing
180
+  #define LTDC_LCD_CLK                        50  // LTDC clock frequency = 50Mhz
181
+  #define LTDC_LCD_HSYNC                      30  // Horizontal synchronization
182
+  #define LTDC_LCD_HBP                       114  // Horizontal back porch
183
+  #define LTDC_LCD_HFP                        16  // Horizontal front porch
184
+  #define LTDC_LCD_VSYNC                       3  // Vertical synchronization
185
+  #define LTDC_LCD_VBP                        32  // Vertical back porch
186
+  #define LTDC_LCD_VFP                        10  // Vertical front porch
187
+
188
+  #define TFT_BACKLIGHT_PIN                 PB5
189
+  #define LCD_DE_PIN                        PF10
190
+  #define LCD_CLK_PIN                       PG7
191
+  #define LCD_VSYNC_PIN                     PI9
192
+  #define LCD_HSYNC_PIN                     PI10
193
+  #define LCD_R7_PIN                        PG6   // R5
194
+  #define LCD_R6_PIN                        PH12
195
+  #define LCD_R5_PIN                        PH11
196
+  #define LCD_R4_PIN                        PH10
197
+  #define LCD_R3_PIN                        PH9
198
+  #define LCD_G7_PIN                        PI2   // G6
199
+  #define LCD_G6_PIN                        PI1
200
+  #define LCD_G5_PIN                        PI0
201
+  #define LCD_G4_PIN                        PH15
202
+  #define LCD_G3_PIN                        PH14
203
+  #define LCD_G2_PIN                        PH13
204
+  #define LCD_B7_PIN                        PI7   // B5
205
+  #define LCD_B6_PIN                        PI6
206
+  #define LCD_B5_PIN                        PI5
207
+  #define LCD_B4_PIN                        PI4
208
+  #define LCD_B3_PIN                        PG11
209
+
210
+#endif
211
+
212
+#define BTN_EN1                             PH6
213
+#define BTN_EN2                             PH7
214
+#define BTN_ENC                             PH8
215
+
216
+#ifndef SDCARD_CONNECTION
217
+  #define SDCARD_CONNECTION              ONBOARD
218
+#endif
219
+
220
+#define SOFTWARE_SPI
221
+#define SDSS                                PA15
222
+#define SS_PIN                              SDSS
223
+#define SD_SCK_PIN                          PC10
224
+#define SD_MISO_PIN                         PC11
225
+#define SD_MOSI_PIN                         PC12
226
+#define SD_DETECT_PIN                       PI3

+ 56
- 0
buildroot/share/PlatformIO/boards/BTT_SKR_SE_BX.json Переглянути файл

@@ -0,0 +1,56 @@
1
+{
2
+  "build": {
3
+    "core": "stm32",
4
+    "cpu": "cortex-m7",
5
+    "extra_flags": "-DSTM32H743xx",
6
+    "f_cpu": "400000000L",
7
+    "mcu": "stm32h743iit6",
8
+    "variant": "BTT_SKR_SE_BX"
9
+  },
10
+  "debug": {
11
+    "jlink_device": "STM32H743II",
12
+    "openocd_target": "stm32h7x",
13
+    "svd_path": "STM32H7x3.svd",
14
+    "tools": {
15
+      "stlink": {
16
+        "server": {
17
+          "arguments": [
18
+            "-f",
19
+            "scripts/interface/stlink.cfg",
20
+            "-c",
21
+            "transport select hla_swd",
22
+            "-f",
23
+            "scripts/target/stm32h7x.cfg",
24
+            "-c",
25
+            "reset_config none"
26
+          ],
27
+          "executable": "bin/openocd",
28
+          "package": "tool-openocd"
29
+        }
30
+      }
31
+    }
32
+  },
33
+  "frameworks": [
34
+    "arduino",
35
+    "stm32cube"
36
+  ],
37
+  "name": "STM32H743II (1024k RAM. 2048k Flash)",
38
+  "upload": {
39
+    "disable_flushing": false,
40
+    "maximum_ram_size": 1048576,
41
+    "maximum_size": 2097152,
42
+    "protocol": "stlink",
43
+    "protocols": [
44
+      "stlink",
45
+      "dfu",
46
+      "jlink",
47
+      "cmsis-dap"
48
+    ],
49
+    "offset_address": "0x8020000",
50
+    "require_upload_port": true,
51
+    "use_1200bps_touch": false,
52
+    "wait_for_upload_port": false
53
+  },
54
+  "url": "https://www.st.com/en/microcontrollers-microprocessors/stm32h743ii.html",
55
+  "vendor": "Generic"
56
+}

+ 491
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PeripheralPins.c Переглянути файл

@@ -0,0 +1,491 @@
1
+/*
2
+ *******************************************************************************
3
+ * Copyright (c) 2019, STMicroelectronics
4
+ * All rights reserved.
5
+ *
6
+ * Redistribution and use in source and binary forms, with or without
7
+ * modification, are permitted provided that the following conditions are met:
8
+ *
9
+ * 1. Redistributions of source code must retain the above copyright notice,
10
+ *    this list of conditions and the following disclaimer.
11
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
12
+ *    this list of conditions and the following disclaimer in the documentation
13
+ *    and/or other materials provided with the distribution.
14
+ * 3. Neither the name of STMicroelectronics nor the names of its contributors
15
+ *    may be used to endorse or promote products derived from this software
16
+ *    without specific prior written permission.
17
+ *
18
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28
+ *******************************************************************************
29
+ * Automatically generated from STM32H743ZITx.xml
30
+ */
31
+#include "Arduino.h"
32
+#include "PeripheralPins.h"
33
+
34
+/* =====
35
+ * Note: Commented lines are alternative possibilities which are not used per default.
36
+ *       If you change them, you will have to know what you do
37
+ * =====
38
+ */
39
+
40
+//*** ADC ***
41
+
42
+#ifdef HAL_ADC_MODULE_ENABLED
43
+WEAK const PinMap PinMap_ADC[] = {
44
+  {PA_3,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC1_INP15
45
+  {PH_4,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 15, 0)}, // ADC3_INP15
46
+  {PH_5,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC3_INP16
47
+  {PA_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 16, 0)}, // ADC1_INP16
48
+  {PA_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 17, 0)}, // ADC1_INP17
49
+  {PA_2,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 14, 0)}, // ADC1_INP14
50
+  {PA_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 18, 0)}, // ADC1_INP18
51
+  {PA_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 19, 0)}, // ADC1_INP19
52
+  {PA_6,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)},  // ADC1_INP3
53
+  {PA_7,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)},  // ADC1_INP7
54
+  {PB_0,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)},  // ADC1_INP9
55
+  {PB_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)},  // ADC1_INP5
56
+  {PC_0,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC3_INP10
57
+  {PC_1,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_INN10
58
+  {PC_2,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 0, 0)},  // ADC3_INN0
59
+  {PC_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)},  // ADC3_INP1
60
+  {PC_4,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)},  // ADC1_INP4
61
+  {PC_5,  ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)},  // ADC1_INP8
62
+  {PF_3,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 5, 0)},  // ADC3_INP5
63
+  {PF_4,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 9, 0)},  // ADC3_INP9
64
+  {PF_5,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)},  // ADC3_INP4
65
+  {PF_6,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)},  // ADC3_INP8
66
+  {PF_7,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)},  // ADC3_INP3
67
+  {PF_8,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 7, 0)},  // ADC3_INP7
68
+  {PF_9,  ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)},  // ADC3_INP2
69
+  {PF_10, ADC3,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)},  // ADC3_INP6
70
+  {PF_11, ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)},  // ADC1_INP2
71
+  {PF_12, ADC1,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)},  // ADC1_INP6
72
+  {PF_13, ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)},  // ADC2_INP2
73
+  {PF_14, ADC2,  STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)},  // ADC2_INP6
74
+  {NC,    NP,    0}
75
+};
76
+#endif
77
+
78
+//*** DAC ***
79
+
80
+#ifdef HAL_DAC_MODULE_ENABLED
81
+WEAK const PinMap PinMap_DAC[] = {
82
+  {PA_4,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 1, 0)}, // DAC1_OUT1
83
+  {PA_5,  DAC1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC1_OUT2
84
+  {NC,    NP,    0}
85
+};
86
+#endif
87
+
88
+//*** I2C ***
89
+
90
+#ifdef HAL_I2C_MODULE_ENABLED
91
+WEAK const PinMap PinMap_I2C_SDA[] = {
92
+  //  {PB_7,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, // LD2 LED_BLUE (ZI)
93
+  {PB_9,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
94
+  {PB_7,  I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, // LD2 LED_BLUE (ZI)
95
+  //  {PB_9,  I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)},
96
+  {PB_11, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
97
+  //  {PC_9,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
98
+  {PD_13, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)},
99
+  {PF_0,  I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
100
+  {PF_15, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)},
101
+  {NC,    NP,    0}
102
+};
103
+#endif
104
+
105
+#ifdef HAL_I2C_MODULE_ENABLED
106
+WEAK const PinMap PinMap_I2C_SCL[] = {
107
+  //  {PA_8,  I2C3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)}, // USB SOF
108
+  //  {PB_6,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)}, // QSPI_CS
109
+  {PB_8,  I2C1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
110
+  {PB_6,  I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)}, // QSPI_CS
111
+  //  {PB_8,  I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF6_I2C4)},
112
+  {PB_10, I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
113
+  {PD_12, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)},
114
+  {PF_1,  I2C2, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C2)},
115
+  {PF_14, I2C4, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C4)},
116
+  {NC,    NP,    0}
117
+};
118
+#endif
119
+
120
+//*** PWM ***
121
+
122
+#ifdef HAL_TIM_MODULE_ENABLED
123
+WEAK const PinMap PinMap_PWM[] = {
124
+  //  {PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
125
+  //  {PA_0,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 1, 0)}, // TIM5_CH1
126
+  //  {PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 - ETH RMII Ref Clk
127
+  //  {PA_1,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 2, 0)}, // TIM5_CH2 - ETH RMII Ref Clk
128
+  //  {PA_1,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N - ETH RMII Ref Clk
129
+  //  {PA_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3 - ETH RMII MDIO
130
+  {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3 - ETH RMII MDIO
131
+  //  {PA_2,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1 - ETH RMII MDIO
132
+  //  {PA_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
133
+  //  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4
134
+  {PA_3,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2
135
+  //  {PA_5,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
136
+  {PA_5,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N
137
+  //  {PA_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
138
+  {PA_6,  TIM13,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1
139
+  //  {PA_7,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N - Used by ETH when JP6(ZI)/SB31(ZI2) ON
140
+  //  {PA_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2 - Used by ETH when JP6(ZI)/SB31(ZI2) ON
141
+  //  {PA_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 1)}, // TIM8_CH1N - Used by ETH when JP6(ZI)/SB31(ZI2) ON
142
+  {PA_7,  TIM14,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1 - Used by ETH when JP6(ZI)/SB31(ZI2) ON
143
+  //  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1 - USB SOF
144
+  //  {PA_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2 - USB VBUS
145
+  //  {PA_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3 - USB ID
146
+  //  {PA_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4 - USB DM
147
+  //  {PA_15, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1
148
+  {PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - LD1 LED_GREEN
149
+  //  {PB_0,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3 - LD1 LED_GREEN
150
+  //  {PB_0,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N - LD1 LED_GREEN
151
+  //  {PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
152
+  {PB_1,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
153
+  //  {PB_1,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
154
+  //  {PB_3,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 - SWO
155
+  {PB_4,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
156
+  {PB_5,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
157
+  //  {PB_6,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
158
+  {PB_6,  TIM16,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N
159
+  //  {PB_7,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2 - LD2 LED_BLUE (ZI)
160
+  {PB_7,  TIM17,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N - LD2 LED_BLUE (ZI)
161
+  {PB_8,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
162
+  //  {PB_8,  TIM16,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1
163
+  //  {PB_9,  TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
164
+  {PB_9,  TIM17,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1
165
+  //  {PB_10, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 3, 0)}, // TIM2_CH3
166
+  //  {PB_11, TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4
167
+  //  {PB_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N - Used by ETH when JP7(ZI)/JP6(ZI2) ON
168
+  {PB_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N - LD3 LED_RED
169
+  //  {PB_14, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 1)}, // TIM8_CH2N - LD3 LED_RED
170
+  //  {PB_14, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 1, 0)}, // TIM12_CH1 - LD3 LED_RED
171
+  //  {PB_15, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
172
+  {PB_15, TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 1)}, // TIM8_CH3N
173
+  //  {PB_15, TIM12,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM12, 2, 0)}, // TIM12_CH2
174
+  //  {PC_6,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 1, 0)}, // TIM3_CH1
175
+  {PC_6,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 1, 0)}, // TIM8_CH1
176
+  {PC_7,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 2, 0)}, // TIM3_CH2
177
+  //  {PC_7,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 2, 0)}, // TIM8_CH2
178
+  //  {PC_8,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 3, 0)}, // TIM3_CH3
179
+  {PC_8,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 3, 0)}, // TIM8_CH3
180
+  {PC_9,  TIM3,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
181
+  //  {PC_9,  TIM8,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM8, 4, 0)}, // TIM8_CH4
182
+  {PD_12, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
183
+  {PD_13, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 2, 0)}, // TIM4_CH2
184
+  {PD_14, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 3, 0)}, // TIM4_CH3
185
+  {PD_15, TIM4,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 4, 0)}, // TIM4_CH4
186
+  {PE_4,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 1)}, // TIM15_CH1N
187
+  {PE_5,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 1, 0)}, // TIM15_CH1
188
+  {PE_6,  TIM15,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_TIM15, 2, 0)}, // TIM15_CH2
189
+  {PE_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 1)}, // TIM1_CH1N
190
+  {PE_9,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1
191
+  {PE_10, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N
192
+  {PE_11, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 0)}, // TIM1_CH2
193
+  {PE_12, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N
194
+  {PE_13, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
195
+  {PE_14, TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 4, 0)}, // TIM1_CH4
196
+  {PF_6,  TIM16,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 0)}, // TIM16_CH1
197
+  {PF_7,  TIM17,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 0)}, // TIM17_CH1
198
+  {PF_8,  TIM13,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM13, 1, 0)}, // TIM13_CH1
199
+  //  {PF_8,  TIM16,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM16, 1, 1)}, // TIM16_CH1N
200
+  {PF_9,  TIM14,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM14, 1, 0)}, // TIM14_CH1
201
+  //  {PF_9,  TIM17,  STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM17, 1, 1)}, // TIM17_CH1N
202
+  {NC,    NP,    0}
203
+};
204
+#endif
205
+
206
+//*** SERIAL ***
207
+
208
+#ifdef HAL_UART_MODULE_ENABLED
209
+WEAK const PinMap PinMap_UART_TX[] = {
210
+  {PA_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
211
+  //  {PA_2,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // ETH RMII MDIO
212
+  //  {PA_9,  LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, // USB VBUS
213
+  {PA_9,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // USB VBUS
214
+  //  {PA_12, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, // USB DP
215
+  //{PA_15, UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)},
216
+  //{PB_4,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)},
217
+  //  {PB_6,  LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)},
218
+  //  {PB_6,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)},
219
+  //{PB_6,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
220
+  //{PB_9,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
221
+  //  {PB_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
222
+  //  {PB_13, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)}, // Used by ETH when JP7(ZI)/JP6(ZI2) ON
223
+  //  {PB_14, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)}, // LD3 LED_RED
224
+  //{PC_6,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
225
+  //{PC_10, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
226
+  //  {PC_10, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
227
+  //{PC_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
228
+  //{PD_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
229
+  //{PD_5,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
230
+  //{PD_8,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, // STLink TX
231
+  //{PE_1,  UART8,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)}, //LD2 LED_YELLOW (ZI2)
232
+  //{PE_8,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
233
+  //{PF_7,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
234
+  //{PG_14, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
235
+  {NC,    NP,    0}
236
+};
237
+#endif
238
+
239
+#ifdef HAL_UART_MODULE_ENABLED
240
+WEAK const PinMap PinMap_UART_RX[] = {
241
+  {PA_1,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, // ETH RMII Ref Clk
242
+  //  {PA_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
243
+  //  {PA_8,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, // USB SOF
244
+  //  {PA_10, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, // USB ID
245
+  {PA_10, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // USB ID
246
+  //  {PA_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_UART4)}, // USB DM
247
+  //{PB_3,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_UART7)}, // SWO
248
+  //{PB_5,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)},
249
+  //  {PB_7,  LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_LPUART)}, // LD2 LED_BLUE (ZI)
250
+  //  {PB_7,  USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // LD2 LED_BLUE (ZI)
251
+  //{PB_8,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
252
+  //  {PB_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
253
+  //{PB_12, UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF14_UART5)},
254
+  //{PB_15, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF4_USART1)},
255
+  //{PC_7,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
256
+  //{PC_11, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
257
+  //  {PC_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
258
+  //{PD_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
259
+  //{PD_2,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
260
+  //{PD_6,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
261
+  //{PD_9,  USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, // STLink RX
262
+  //{PE_0,  UART8,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)},
263
+  //{PE_7,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
264
+  //{PF_6,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
265
+  //{PG_9,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
266
+  {NC,    NP,    0}
267
+};
268
+#endif
269
+
270
+#ifdef HAL_UART_MODULE_ENABLED
271
+WEAK const PinMap PinMap_UART_RTS[] = {
272
+  //  {PA_1,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)}, // ETH RMII Ref Clk
273
+  //  {PA_12, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, // USB DP
274
+  //  {PA_12, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // USB DP
275
+  {PA_15, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
276
+  //  {PB_14, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, // LD3 LED_RED
277
+  //  {PB_14, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, // LD3 LED_RED
278
+  {PC_8,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
279
+  {PD_4,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
280
+  {PD_12, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
281
+  {PD_15, UART8,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)},
282
+  {PE_9,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
283
+  {PF_8,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
284
+  {PG_8,  USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
285
+  {PG_12, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
286
+  {NC,    NP,    0}
287
+};
288
+#endif
289
+
290
+#ifdef HAL_UART_MODULE_ENABLED
291
+WEAK const PinMap PinMap_UART_CTS[] = {
292
+  {PA_0,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
293
+  //  {PA_11, LPUART1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_LPUART)}, // USB DM
294
+  //  {PA_11, USART1,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)}, // USB DM
295
+  //  {PB_0,  UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)}, // LD1 LED_GREEN
296
+  //  {PB_13, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)}, // Used by ETH when JP7(ZI)/JP6(ZI2) ON
297
+  {PB_15, UART4,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART4)},
298
+  {PC_9,  UART5,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART5)},
299
+  {PD_3,  USART2,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
300
+  {PD_11, USART3,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
301
+  {PD_14, UART8,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_UART8)},
302
+  {PE_10, UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
303
+  {PF_9,  UART7,   STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_UART7)},
304
+  //  {PG_13, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
305
+  {PG_15, USART6,  STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART6)},
306
+  {NC,    NP,    0}
307
+};
308
+#endif
309
+
310
+//*** SPI ***
311
+
312
+#ifdef HAL_SPI_MODULE_ENABLED
313
+WEAK const PinMap PinMap_SPI_MOSI[] = {
314
+  {PC_12, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
315
+  //{PA_7,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, // Used by ETH when JP6(ZI)/SB31(ZI2) ON
316
+  //  {PA_7,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, // Used by ETH when JP6(ZI)/SB31(ZI2) ON
317
+  // {PB_2,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)},
318
+  // {PB_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
319
+  // //  {PB_5,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI3)},
320
+  // //  {PB_5,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)},
321
+  // {PB_15, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
322
+  // //  {PC_1,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // ETH RMII MDC
323
+  // {PC_3,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
324
+  // {PD_6,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI3)},
325
+  // {PD_7,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
326
+  // {PE_6,  SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
327
+  // {PE_14, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
328
+  // {PF_9,  SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)},
329
+  // {PF_11, SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)},
330
+  // {PG_14, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)},
331
+  {NC,    NP,    0}
332
+};
333
+#endif
334
+
335
+#ifdef HAL_SPI_MODULE_ENABLED
336
+WEAK const PinMap PinMap_SPI_MISO[] = {
337
+  {PC_11, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
338
+  // {PA_6,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
339
+  // //  {PA_6,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)},
340
+  // {PB_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
341
+  // //  {PB_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
342
+  // //  {PB_4,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)},
343
+  // {PB_14, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // LD3 LED_RED
344
+  // {PC_2,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
345
+  // {PE_5,  SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
346
+  // {PE_13, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
347
+  // {PF_8,  SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)},
348
+  // {PG_9,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
349
+  // {PG_12, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)},
350
+  {NC,    NP,    0}
351
+};
352
+#endif
353
+
354
+#ifdef HAL_SPI_MODULE_ENABLED
355
+WEAK const PinMap PinMap_SPI_SCLK[] = {
356
+  {PC_10, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
357
+  // {PA_5,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
358
+  // //  {PA_5,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)},
359
+  // //  {PA_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // USB VBUS
360
+  // //  {PA_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // USB DP
361
+  // //  {PB_3,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, // SWO
362
+  // //  {PB_3,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)}, // SWO
363
+  // {PB_3,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)}, // SWO
364
+  // {PB_10, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
365
+  // //  {PB_13, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // Used by ETH when JP7(ZI)/JP6(ZI2) ON
366
+  // {PD_3,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
367
+  // {PE_2,  SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
368
+  // {PE_12, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
369
+  // {PF_7,  SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)},
370
+  //  {PG_11, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)}, // ETH RMII TX Enable
371
+  //  {PG_13, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)}, // ETH RXII TXD0
372
+  {NC,    NP,    0}
373
+};
374
+#endif
375
+
376
+#ifdef HAL_SPI_MODULE_ENABLED
377
+WEAK const PinMap PinMap_SPI_SSEL[] = {
378
+  {PA_15, SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
379
+  // {PA_4,  SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
380
+  // //  {PA_4,  SPI3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF6_SPI3)},
381
+  // //  {PA_4,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_SPI6)},
382
+  // //  {PA_11, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)}, // USB DM
383
+  // //  {PA_15, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
384
+  // //  {PA_15, SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI6)},
385
+  // {PB_4,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_SPI2)},
386
+  // {PB_9,  SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
387
+  // {PB_12, SPI2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI2)},
388
+  // {PE_4,  SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
389
+  // {PE_11, SPI4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
390
+  // {PF_6,  SPI5, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI5)},
391
+  // {PG_8,  SPI6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI6)},
392
+  // {PG_10, SPI1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI1)},
393
+  {NC,    NP,    0}
394
+};
395
+#endif
396
+
397
+//*** CAN ***
398
+
399
+#ifdef HAL_CAN_MODULE_ENABLED
400
+WEAK const PinMap PinMap_CAN_RD[] = {
401
+  //  {PA_11, CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, // USB DM
402
+  {PB_5,  CANFD2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)},
403
+  {PB_8,  CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)},
404
+  {PB_12, CANFD2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)},
405
+  {PD_0,  CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)},
406
+  {NC,    NP,    0}
407
+};
408
+#endif
409
+
410
+#ifdef HAL_CAN_MODULE_ENABLED
411
+WEAK const PinMap PinMap_CAN_TD[] = {
412
+  //  {PA_12, CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)}, // USB DP
413
+  {PB_6,  CANFD2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, // QSPI_CS
414
+  {PB_7,  CANFD2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, // LD2 LED_BLUE (ZI)
415
+  {PB_9,  CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)},
416
+  //  {PB_13, CANFD2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN2)}, // Used by ETH when JP7(ZI)/JP6(ZI2) ON
417
+  {PD_1,  CANFD1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF9_FDCAN1)},
418
+  {NC,    NP,    0}
419
+};
420
+#endif
421
+
422
+//*** ETHERNET ***
423
+
424
+#ifdef HAL_ETH_MODULE_ENABLED
425
+WEAK const PinMap PinMap_Ethernet[] = {
426
+  //  {PA_0,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS
427
+  {PA_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_REF_CLK|ETH_RX_CLK
428
+  {PA_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDIO
429
+  //  {PA_3,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_COL
430
+  {PA_7,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_CRS_DV|ETH_RX_DV
431
+  //  {PB_0,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD2
432
+  //  {PB_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD3
433
+  //  {PB_5,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT
434
+  //  {PB_8,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3
435
+  //  {PB_10, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RX_ER
436
+  //  {PB_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN
437
+  //  {PB_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0
438
+  {PB_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1
439
+  {PC_1,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_MDC
440
+  //  {PC_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD2
441
+  //  {PC_3,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_CLK
442
+  {PC_4,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD0
443
+  {PC_5,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_RXD1
444
+  //  {PE_2,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD3
445
+  //  {PG_8,  ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_PPS_OUT
446
+  {PG_11, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TX_EN
447
+  //  {PG_12, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1
448
+  {PG_13, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD0
449
+  //  {PG_14, ETH, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF11_ETH)}, // ETH_TXD1
450
+  {NC,    NP,    0}
451
+};
452
+#endif
453
+
454
+//*** USB ***
455
+
456
+#ifdef HAL_PCD_MODULE_ENABLED
457
+WEAK const PinMap PinMap_USB_OTG_FS[] = {
458
+  // {PA_8,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_SOF
459
+  // {PA_9,  USB_OTG_FS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_FS_VBUS
460
+  // {PA_10, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_ID
461
+  {PA_11, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_DM
462
+  {PA_12, USB_OTG_FS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG1_FS)}, // USB_OTG_FS_DP
463
+  {NC,    NP,    0}
464
+};
465
+#endif
466
+
467
+#ifdef HAL_PCD_MODULE_ENABLED
468
+WEAK const PinMap PinMap_USB_OTG_HS[] = {
469
+#ifdef USE_USB_HS_IN_FS
470
+  // {PA_4,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_SOF
471
+  // {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_ID
472
+  // {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, GPIO_AF_NONE)}, // USB_OTG_HS_VBUS - Used by ETH when JP7(ZI)/JP6(ZI2) ON
473
+  {PB_14, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_DM
474
+  {PB_15, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF12_OTG2_FS)}, // USB_OTG_HS_DP
475
+#else
476
+  {PA_3,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D0
477
+  {PA_5,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_CK
478
+  {PB_0,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D1
479
+  {PB_1,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D2
480
+  {PB_5,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D7
481
+  {PB_10, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D3
482
+  {PB_11, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D4
483
+  {PB_12, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D5
484
+  {PB_13, USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_D6 - Used by ETH when JP7(ZI)/JP6(ZI2) ON
485
+  {PC_0,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_STP
486
+  {PC_2,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_DIR
487
+  {PC_3,  USB_OTG_HS, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF10_OTG2_HS)}, // USB_OTG_HS_ULPI_NXT
488
+#endif /* USE_USB_HS_IN_FS */
489
+  {NC,    NP,    0}
490
+};
491
+#endif

+ 50
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/PinNamesVar.h Переглянути файл

@@ -0,0 +1,50 @@
1
+/* SYS_WKUP */
2
+#ifdef PWR_WAKEUP_PIN1
3
+SYS_WKUP1 = PA_0, /* SYS_WKUP0 */
4
+#endif
5
+#ifdef PWR_WAKEUP_PIN2
6
+SYS_WKUP2 = PA_2, /* SYS_WKUP1 */
7
+#endif
8
+#ifdef PWR_WAKEUP_PIN3
9
+SYS_WKUP3 = PC_13, /* SYS_WKUP2 */
10
+#endif
11
+#ifdef PWR_WAKEUP_PIN4
12
+SYS_WKUP4 = PI_8, /* SYS_WKUP3 - Manually added */
13
+#endif
14
+#ifdef PWR_WAKEUP_PIN5
15
+SYS_WKUP5 = PI_11, /* SYS_WKUP4 - Manually added */
16
+#endif
17
+#ifdef PWR_WAKEUP_PIN6
18
+SYS_WKUP6 = PC_1, /* SYS_WKUP5 */
19
+#endif
20
+#ifdef PWR_WAKEUP_PIN7
21
+SYS_WKUP7 = NC,
22
+#endif
23
+#ifdef PWR_WAKEUP_PIN8
24
+SYS_WKUP8 = NC,
25
+#endif
26
+/* USB */
27
+#ifdef USBCON
28
+USB_OTG_FS_SOF = PA_8,
29
+USB_OTG_FS_VBUS = PA_9,
30
+USB_OTG_FS_ID = PA_10,
31
+USB_OTG_FS_DM = PA_11,
32
+USB_OTG_FS_DP = PA_12,
33
+USB_OTG_HS_ULPI_D0 = PA_3,
34
+USB_OTG_HS_SOF = PA_4,
35
+USB_OTG_HS_ULPI_CK = PA_5,
36
+USB_OTG_HS_ULPI_D1 = PB_0,
37
+USB_OTG_HS_ULPI_D2 = PB_1,
38
+USB_OTG_HS_ULPI_D7 = PB_5,
39
+USB_OTG_HS_ULPI_D3 = PB_10,
40
+USB_OTG_HS_ULPI_D4 = PB_11,
41
+USB_OTG_HS_ID = PB_12,
42
+USB_OTG_HS_ULPI_D5 = PB_12,
43
+USB_OTG_HS_ULPI_D6 = PB_13,
44
+USB_OTG_HS_VBUS = PB_13,
45
+USB_OTG_HS_DM = PB_14,
46
+USB_OTG_HS_DP = PB_15,
47
+USB_OTG_HS_ULPI_STP = PC_0,
48
+USB_OTG_HS_ULPI_DIR = PC_2,
49
+USB_OTG_HS_ULPI_NXT = PC_3,
50
+#endif

+ 479
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/hal_conf_extra.h Переглянути файл

@@ -0,0 +1,479 @@
1
+/**
2
+  ******************************************************************************
3
+  * @file    stm32h7xx_hal_conf_default.h
4
+  * @brief   HAL default configuration file.
5
+  ******************************************************************************
6
+  * @attention
7
+  *
8
+  * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics.
9
+  * All rights reserved.</center></h2>
10
+  *
11
+  * This software component is licensed by ST under BSD 3-Clause license,
12
+  * the "License"; You may not use this file except in compliance with the
13
+  * License. You may obtain a copy of the License at:
14
+  *                        opensource.org/licenses/BSD-3-Clause
15
+  *
16
+  ******************************************************************************
17
+  */
18
+
19
+/* Define to prevent recursive inclusion -------------------------------------*/
20
+#ifndef __STM32H7xx_HAL_CONF_DEFAULT_H
21
+#define __STM32H7xx_HAL_CONF_DEFAULT_H
22
+
23
+#ifdef __cplusplus
24
+extern "C" {
25
+#endif
26
+
27
+/* Exported types ------------------------------------------------------------*/
28
+/* Exported constants --------------------------------------------------------*/
29
+
30
+/* ########################## Module Selection ############################## */
31
+/**
32
+  * @brief Include the default list of modules to be used in the HAL driver
33
+  *        and manage module deactivation
34
+  */
35
+#include "stm32yyxx_hal_conf.h"
36
+#if 0
37
+/**
38
+  * @brief This is the list of modules to be used in the HAL driver
39
+  */
40
+#define HAL_MODULE_ENABLED
41
+#define HAL_ADC_MODULE_ENABLED
42
+#define HAL_CEC_MODULE_ENABLED
43
+#define HAL_COMP_MODULE_ENABLED
44
+#define HAL_CORTEX_MODULE_ENABLED
45
+#define HAL_CRC_MODULE_ENABLED
46
+#define HAL_CRYP_MODULE_ENABLED
47
+#define HAL_DAC_MODULE_ENABLED
48
+#define HAL_DCMI_MODULE_ENABLED
49
+#define HAL_DFSDM_MODULE_ENABLED
50
+#define HAL_DMA_MODULE_ENABLED
51
+#define HAL_DMA2D_MODULE_ENABLED
52
+#define HAL_DSI_MODULE_ENABLED
53
+#define HAL_ETH_MODULE_ENABLED
54
+#define HAL_EXTI_MODULE_ENABLED
55
+#define HAL_FDCAN_MODULE_ENABLED
56
+#define HAL_FLASH_MODULE_ENABLED
57
+#define HAL_GPIO_MODULE_ENABLED
58
+#define HAL_HASH_MODULE_ENABLED
59
+#define HAL_HCD_MODULE_ENABLED
60
+#define HAL_HRTIM_MODULE_ENABLED
61
+#define HAL_HSEM_MODULE_ENABLED
62
+#define HAL_I2C_MODULE_ENABLED
63
+#define HAL_I2S_MODULE_ENABLED
64
+#define HAL_IRDA_MODULE_ENABLED
65
+#define HAL_IWDG_MODULE_ENABLED
66
+#define HAL_JPEG_MODULE_ENABLED
67
+#define HAL_LPTIM_MODULE_ENABLED
68
+#define HAL_LTDC_MODULE_ENABLED
69
+#define HAL_MDIOS_MODULE_ENABLED
70
+#define HAL_MDMA_MODULE_ENABLED
71
+#define HAL_MMC_MODULE_ENABLED
72
+#define HAL_NAND_MODULE_ENABLED
73
+#define HAL_NOR_MODULE_ENABLED
74
+#define HAL_OPAMP_MODULE_ENABLED
75
+#define HAL_PCD_MODULE_ENABLED
76
+#define HAL_PWR_MODULE_ENABLED
77
+#define HAL_QSPI_MODULE_ENABLED
78
+#define HAL_RAMECC_MODULE_ENABLED
79
+#define HAL_RCC_MODULE_ENABLED
80
+#define HAL_RNG_MODULE_ENABLED
81
+#define HAL_RTC_MODULE_ENABLED
82
+#define HAL_SAI_MODULE_ENABLED
83
+#define HAL_SD_MODULE_ENABLED
84
+#define HAL_SDRAM_MODULE_ENABLED
85
+#define HAL_SMARTCARD_MODULE_ENABLED
86
+#define HAL_SMBUS_MODULE_ENABLED
87
+#define HAL_SPDIFRX_MODULE_ENABLED
88
+#define HAL_SPI_MODULE_ENABLED
89
+#define HAL_SRAM_MODULE_ENABLED
90
+#define HAL_SWPMI_MODULE_ENABLED
91
+#define HAL_TIM_MODULE_ENABLED
92
+#define HAL_UART_MODULE_ENABLED
93
+#define HAL_USART_MODULE_ENABLED
94
+#define HAL_WWDG_MODULE_ENABLED
95
+#endif
96
+
97
+/* ########################## Oscillator Values adaptation ####################*/
98
+/**
99
+  * @brief Adjust the value of External High Speed oscillator (HSE) used in your application.
100
+  *        This value is used by the RCC HAL module to compute the system frequency
101
+  *        (when HSE is used as system clock source, directly or through the PLL).
102
+  */
103
+#if !defined  (HSE_VALUE)
104
+#define HSE_VALUE    ((uint32_t)25000000) /*!< Value of the External oscillator in Hz */
105
+#endif /* HSE_VALUE */
106
+
107
+#if !defined  (HSE_STARTUP_TIMEOUT)
108
+#define HSE_STARTUP_TIMEOUT    ((uint32_t)5000)   /*!< Time out for HSE start up, in ms */
109
+#endif /* HSE_STARTUP_TIMEOUT */
110
+
111
+/**
112
+  * @brief Internal  oscillator (CSI) default value.
113
+  *        This value is the default CSI value after Reset.
114
+  */
115
+#if !defined  (CSI_VALUE)
116
+#define CSI_VALUE    ((uint32_t)4000000) /*!< Value of the Internal oscillator in Hz*/
117
+#endif /* CSI_VALUE */
118
+
119
+/**
120
+  * @brief Internal High Speed oscillator (HSI) value.
121
+  *        This value is used by the RCC HAL module to compute the system frequency
122
+  *        (when HSI is used as system clock source, directly or through the PLL).
123
+  */
124
+#if !defined  (HSI_VALUE)
125
+#define HSI_VALUE    ((uint32_t)64000000) /*!< Value of the Internal oscillator in Hz*/
126
+#endif /* HSI_VALUE */
127
+
128
+/**
129
+  * @brief External Low Speed oscillator (LSE) value.
130
+  *        This value is used by the UART, RTC HAL module to compute the system frequency
131
+  */
132
+#if !defined  (LSE_VALUE)
133
+#define LSE_VALUE    ((uint32_t)32768) /*!< Value of the External oscillator in Hz*/
134
+#endif /* LSE_VALUE */
135
+
136
+
137
+#if !defined  (LSE_STARTUP_TIMEOUT)
138
+#define LSE_STARTUP_TIMEOUT    ((uint32_t)5000)   /*!< Time out for LSE start up, in ms */
139
+#endif /* LSE_STARTUP_TIMEOUT */
140
+
141
+#if !defined  (LSI_VALUE)
142
+#define LSI_VALUE  ((uint32_t)32000)      /*!< LSI Typical Value in Hz*/
143
+#endif /* LSI_VALUE */                      /*!< Value of the Internal Low Speed oscillator in Hz
144
+The real value may vary depending on the variations
145
+in voltage and temperature.*/
146
+/**
147
+  * @brief External clock source for I2S peripheral
148
+  *        This value is used by the I2S HAL module to compute the I2S clock source
149
+  *        frequency, this source is inserted directly through I2S_CKIN pad.
150
+  */
151
+#if !defined  (EXTERNAL_CLOCK_VALUE)
152
+#define EXTERNAL_CLOCK_VALUE    12288000U /*!< Value of the External clock in Hz*/
153
+#endif /* EXTERNAL_CLOCK_VALUE */
154
+
155
+/* Tip: To avoid modifying this file each time you need to use different HSE,
156
+   ===  you can define the HSE value in your toolchain compiler preprocessor. */
157
+
158
+/* ########################### System Configuration ######################### */
159
+/**
160
+  * @brief This is the HAL system configuration section
161
+  */
162
+#if !defined (VDD_VALUE)
163
+#define  VDD_VALUE                    ((uint32_t)3300) /*!< Value of VDD in mv */
164
+#endif
165
+#if !defined (TICK_INT_PRIORITY)
166
+#define  TICK_INT_PRIORITY            ((uint32_t)0x00) /*!< tick interrupt priority */
167
+#endif
168
+#if !defined (USE_RTOS)
169
+#define  USE_RTOS                     0
170
+#endif
171
+#if !defined (USE_SD_TRANSCEIVER)
172
+#define  USE_SD_TRANSCEIVER           1U               /*!< use uSD Transceiver */
173
+#endif
174
+#if !defined (USE_SPI_CRC)
175
+#define  USE_SPI_CRC                  0U               /*!< use CRC in SPI */
176
+#endif
177
+
178
+#define  USE_HAL_ADC_REGISTER_CALLBACKS     0U /* ADC register callback disabled     */
179
+#define  USE_HAL_CEC_REGISTER_CALLBACKS     0U /* CEC register callback disabled     */
180
+#define  USE_HAL_COMP_REGISTER_CALLBACKS    0U /* COMP register callback disabled    */
181
+#define  USE_HAL_CRYP_REGISTER_CALLBACKS    0U /* CRYP register callback disabled    */
182
+#define  USE_HAL_DAC_REGISTER_CALLBACKS     0U /* DAC register callback disabled     */
183
+#define  USE_HAL_DCMI_REGISTER_CALLBACKS    0U /* DCMI register callback disabled    */
184
+#define  USE_HAL_DFSDM_REGISTER_CALLBACKS   0U /* DFSDM register callback disabled   */
185
+#define  USE_HAL_DMA2D_REGISTER_CALLBACKS   0U /* DMA2D register callback disabled   */
186
+#define  USE_HAL_DSI_REGISTER_CALLBACKS     0U /* DSI register callback disabled     */
187
+#define  USE_HAL_ETH_REGISTER_CALLBACKS     0U /* ETH register callback disabled     */
188
+#define  USE_HAL_FDCAN_REGISTER_CALLBACKS   0U /* FDCAN register callback disabled   */
189
+#define  USE_HAL_NAND_REGISTER_CALLBACKS    0U /* NAND register callback disabled    */
190
+#define  USE_HAL_NOR_REGISTER_CALLBACKS     0U /* NOR register callback disabled     */
191
+#define  USE_HAL_SDRAM_REGISTER_CALLBACKS   0U /* SDRAM register callback disabled   */
192
+#define  USE_HAL_SRAM_REGISTER_CALLBACKS    0U /* SRAM register callback disabled    */
193
+#define  USE_HAL_HASH_REGISTER_CALLBACKS    0U /* HASH register callback disabled    */
194
+#define  USE_HAL_HCD_REGISTER_CALLBACKS     1U /* HCD register callback disabled     */
195
+#define  USE_HAL_HRTIM_REGISTER_CALLBACKS   0U /* HRTIM register callback disabled   */
196
+#define  USE_HAL_I2C_REGISTER_CALLBACKS     0U /* I2C register callback disabled     */
197
+#define  USE_HAL_I2S_REGISTER_CALLBACKS     0U /* I2S register callback disabled     */
198
+#define  USE_HAL_JPEG_REGISTER_CALLBACKS    0U /* JPEG register callback disabled    */
199
+#define  USE_HAL_LPTIM_REGISTER_CALLBACKS   0U /* LPTIM register callback disabled   */
200
+#define  USE_HAL_LTDC_REGISTER_CALLBACKS    0U /* LTDC register callback disabled    */
201
+#define  USE_HAL_MDIOS_REGISTER_CALLBACKS   0U /* MDIO register callback disabled    */
202
+#define  USE_HAL_OPAMP_REGISTER_CALLBACKS   0U /* MDIO register callback disabled    */
203
+#define  USE_HAL_PCD_REGISTER_CALLBACKS     0U /* PCD register callback disabled     */
204
+#define  USE_HAL_QSPI_REGISTER_CALLBACKS    0U /* QSPI register callback disabled    */
205
+#define  USE_HAL_RNG_REGISTER_CALLBACKS     0U /* RNG register callback disabled     */
206
+#define  USE_HAL_RTC_REGISTER_CALLBACKS     0U /* RTC register callback disabled     */
207
+#define  USE_HAL_SAI_REGISTER_CALLBACKS     0U /* SAI register callback disabled     */
208
+#define  USE_HAL_SPDIFRX_REGISTER_CALLBACKS 0U /* SPDIFRX register callback disabled */
209
+#define  USE_HAL_SMBUS_REGISTER_CALLBACKS   0U /* SMBUS register callback disabled   */
210
+#define  USE_HAL_SPI_REGISTER_CALLBACKS     0U /* SPI register callback disabled     */
211
+#define  USE_HAL_SWPMI_REGISTER_CALLBACKS   0U /* SWPMI register callback disabled   */
212
+#define  USE_HAL_TIM_REGISTER_CALLBACKS     0U /* TIM register callback disabled     */
213
+#define  USE_HAL_WWDG_REGISTER_CALLBACKS    0U /* WWDG register callback disabled    */
214
+
215
+/* ########################### Ethernet Configuration ######################### */
216
+#define ETH_TX_DESC_CNT         4  /* number of Ethernet Tx DMA descriptors */
217
+#define ETH_RX_DESC_CNT         4  /* number of Ethernet Rx DMA descriptors */
218
+
219
+#define ETH_MAC_ADDR0    ((uint8_t)0x02)
220
+#define ETH_MAC_ADDR1    ((uint8_t)0x00)
221
+#define ETH_MAC_ADDR2    ((uint8_t)0x00)
222
+#define ETH_MAC_ADDR3    ((uint8_t)0x00)
223
+#define ETH_MAC_ADDR4    ((uint8_t)0x00)
224
+#define ETH_MAC_ADDR5    ((uint8_t)0x00)
225
+
226
+
227
+/* ########################## Assert Selection ############################## */
228
+/**
229
+  * @brief Uncomment the line below to expanse the "assert_param" macro in the
230
+  *        HAL drivers code
231
+  */
232
+/* #define USE_FULL_ASSERT    1 */
233
+
234
+/* Includes ------------------------------------------------------------------*/
235
+/**
236
+  * @brief Include module's header file
237
+  */
238
+
239
+#ifdef HAL_RCC_MODULE_ENABLED
240
+#include "stm32h7xx_hal_rcc.h"
241
+#endif /* HAL_RCC_MODULE_ENABLED */
242
+
243
+#ifdef HAL_GPIO_MODULE_ENABLED
244
+#include "stm32h7xx_hal_gpio.h"
245
+#endif /* HAL_GPIO_MODULE_ENABLED */
246
+
247
+#ifdef HAL_DMA_MODULE_ENABLED
248
+#include "stm32h7xx_hal_dma.h"
249
+#endif /* HAL_DMA_MODULE_ENABLED */
250
+
251
+#ifdef HAL_MDMA_MODULE_ENABLED
252
+#include "stm32h7xx_hal_mdma.h"
253
+#endif /* HAL_MDMA_MODULE_ENABLED */
254
+
255
+#ifdef HAL_HASH_MODULE_ENABLED
256
+#include "stm32h7xx_hal_hash.h"
257
+#endif /* HAL_HASH_MODULE_ENABLED */
258
+
259
+#ifdef HAL_DCMI_MODULE_ENABLED
260
+#include "stm32h7xx_hal_dcmi.h"
261
+#endif /* HAL_DCMI_MODULE_ENABLED */
262
+
263
+#ifdef HAL_DMA2D_MODULE_ENABLED
264
+#include "stm32h7xx_hal_dma2d.h"
265
+#endif /* HAL_DMA2D_MODULE_ENABLED */
266
+
267
+#ifdef HAL_DSI_MODULE_ENABLED
268
+#include "stm32h7xx_hal_dsi.h"
269
+#endif /* HAL_DSI_MODULE_ENABLED */
270
+
271
+#ifdef HAL_DFSDM_MODULE_ENABLED
272
+#include "stm32h7xx_hal_dfsdm.h"
273
+#endif /* HAL_DFSDM_MODULE_ENABLED */
274
+
275
+#ifdef HAL_ETH_MODULE_ENABLED
276
+#include "stm32h7xx_hal_eth.h"
277
+#endif /* HAL_ETH_MODULE_ENABLED */
278
+
279
+#ifdef HAL_EXTI_MODULE_ENABLED
280
+#include "stm32h7xx_hal_exti.h"
281
+#endif /* HAL_EXTI_MODULE_ENABLED */
282
+
283
+#ifdef HAL_CORTEX_MODULE_ENABLED
284
+#include "stm32h7xx_hal_cortex.h"
285
+#endif /* HAL_CORTEX_MODULE_ENABLED */
286
+
287
+#ifdef HAL_ADC_MODULE_ENABLED
288
+#include "stm32h7xx_hal_adc.h"
289
+#endif /* HAL_ADC_MODULE_ENABLED */
290
+
291
+#ifdef HAL_FDCAN_MODULE_ENABLED
292
+#include "stm32h7xx_hal_fdcan.h"
293
+#endif /* HAL_FDCAN_MODULE_ENABLED */
294
+
295
+#ifdef HAL_CEC_MODULE_ENABLED
296
+#include "stm32h7xx_hal_cec.h"
297
+#endif /* HAL_CEC_MODULE_ENABLED */
298
+
299
+#ifdef HAL_COMP_MODULE_ENABLED
300
+#include "stm32h7xx_hal_comp.h"
301
+#endif /* HAL_COMP_MODULE_ENABLED */
302
+
303
+#ifdef HAL_CRC_MODULE_ENABLED
304
+#include "stm32h7xx_hal_crc.h"
305
+#endif /* HAL_CRC_MODULE_ENABLED */
306
+
307
+#ifdef HAL_CRYP_MODULE_ENABLED
308
+#include "stm32h7xx_hal_cryp.h"
309
+#endif /* HAL_CRYP_MODULE_ENABLED */
310
+
311
+#ifdef HAL_DAC_MODULE_ENABLED
312
+#include "stm32h7xx_hal_dac.h"
313
+#endif /* HAL_DAC_MODULE_ENABLED */
314
+
315
+#ifdef HAL_FLASH_MODULE_ENABLED
316
+#include "stm32h7xx_hal_flash.h"
317
+#endif /* HAL_FLASH_MODULE_ENABLED */
318
+
319
+#ifdef HAL_HRTIM_MODULE_ENABLED
320
+#include "stm32h7xx_hal_hrtim.h"
321
+#endif /* HAL_HRTIM_MODULE_ENABLED */
322
+
323
+#ifdef HAL_HSEM_MODULE_ENABLED
324
+#include "stm32h7xx_hal_hsem.h"
325
+#endif /* HAL_HSEM_MODULE_ENABLED */
326
+
327
+#ifdef HAL_SRAM_MODULE_ENABLED
328
+#include "stm32h7xx_hal_sram.h"
329
+#endif /* HAL_SRAM_MODULE_ENABLED */
330
+
331
+#ifdef HAL_NOR_MODULE_ENABLED
332
+#include "stm32h7xx_hal_nor.h"
333
+#endif /* HAL_NOR_MODULE_ENABLED */
334
+
335
+#ifdef HAL_NAND_MODULE_ENABLED
336
+#include "stm32h7xx_hal_nand.h"
337
+#endif /* HAL_NAND_MODULE_ENABLED */
338
+
339
+#ifdef HAL_I2C_MODULE_ENABLED
340
+#include "stm32h7xx_hal_i2c.h"
341
+#endif /* HAL_I2C_MODULE_ENABLED */
342
+
343
+#ifdef HAL_I2S_MODULE_ENABLED
344
+#include "stm32h7xx_hal_i2s.h"
345
+#endif /* HAL_I2S_MODULE_ENABLED */
346
+
347
+#ifdef HAL_IWDG_MODULE_ENABLED
348
+#include "stm32h7xx_hal_iwdg.h"
349
+#endif /* HAL_IWDG_MODULE_ENABLED */
350
+
351
+#ifdef HAL_JPEG_MODULE_ENABLED
352
+#include "stm32h7xx_hal_jpeg.h"
353
+#endif /* HAL_JPEG_MODULE_ENABLED */
354
+
355
+#ifdef HAL_MDIOS_MODULE_ENABLED
356
+#include "stm32h7xx_hal_mdios.h"
357
+#endif /* HAL_MDIOS_MODULE_ENABLED */
358
+
359
+#ifdef HAL_MMC_MODULE_ENABLED
360
+#include "stm32h7xx_hal_mmc.h"
361
+#endif /* HAL_MMC_MODULE_ENABLED */
362
+
363
+#ifdef HAL_LPTIM_MODULE_ENABLED
364
+#include "stm32h7xx_hal_lptim.h"
365
+#endif /* HAL_LPTIM_MODULE_ENABLED */
366
+
367
+#ifdef HAL_LTDC_MODULE_ENABLED
368
+#include "stm32h7xx_hal_ltdc.h"
369
+#endif /* HAL_LTDC_MODULE_ENABLED */
370
+
371
+#ifdef HAL_OPAMP_MODULE_ENABLED
372
+#include "stm32h7xx_hal_opamp.h"
373
+#endif /* HAL_OPAMP_MODULE_ENABLED */
374
+
375
+#ifdef HAL_PWR_MODULE_ENABLED
376
+#include "stm32h7xx_hal_pwr.h"
377
+#endif /* HAL_PWR_MODULE_ENABLED */
378
+
379
+#ifdef HAL_QSPI_MODULE_ENABLED
380
+#include "stm32h7xx_hal_qspi.h"
381
+#endif /* HAL_QSPI_MODULE_ENABLED */
382
+
383
+#ifdef HAL_RAMECC_MODULE_ENABLED
384
+#include "stm32h7xx_hal_ramecc.h"
385
+#endif /* HAL_HCD_MODULE_ENABLED */
386
+
387
+#ifdef HAL_RNG_MODULE_ENABLED
388
+#include "stm32h7xx_hal_rng.h"
389
+#endif /* HAL_RNG_MODULE_ENABLED */
390
+
391
+#ifdef HAL_RTC_MODULE_ENABLED
392
+#include "stm32h7xx_hal_rtc.h"
393
+#endif /* HAL_RTC_MODULE_ENABLED */
394
+
395
+#ifdef HAL_SAI_MODULE_ENABLED
396
+#include "stm32h7xx_hal_sai.h"
397
+#endif /* HAL_SAI_MODULE_ENABLED */
398
+
399
+#ifdef HAL_SD_MODULE_ENABLED
400
+#include "stm32h7xx_hal_sd.h"
401
+#endif /* HAL_SD_MODULE_ENABLED */
402
+
403
+#ifdef HAL_SDRAM_MODULE_ENABLED
404
+#include "stm32h7xx_hal_sdram.h"
405
+#endif /* HAL_SDRAM_MODULE_ENABLED */
406
+
407
+#ifdef HAL_SPI_MODULE_ENABLED
408
+#include "stm32h7xx_hal_spi.h"
409
+#endif /* HAL_SPI_MODULE_ENABLED */
410
+
411
+#ifdef HAL_SPDIFRX_MODULE_ENABLED
412
+#include "stm32h7xx_hal_spdifrx.h"
413
+#endif /* HAL_SPDIFRX_MODULE_ENABLED */
414
+
415
+#ifdef HAL_SWPMI_MODULE_ENABLED
416
+#include "stm32h7xx_hal_swpmi.h"
417
+#endif /* HAL_SWPMI_MODULE_ENABLED */
418
+
419
+#ifdef HAL_TIM_MODULE_ENABLED
420
+#include "stm32h7xx_hal_tim.h"
421
+#endif /* HAL_TIM_MODULE_ENABLED */
422
+
423
+#ifdef HAL_UART_MODULE_ENABLED
424
+#include "stm32h7xx_hal_uart.h"
425
+#endif /* HAL_UART_MODULE_ENABLED */
426
+
427
+#ifdef HAL_USART_MODULE_ENABLED
428
+#include "stm32h7xx_hal_usart.h"
429
+#endif /* HAL_USART_MODULE_ENABLED */
430
+
431
+#ifdef HAL_IRDA_MODULE_ENABLED
432
+#include "stm32h7xx_hal_irda.h"
433
+#endif /* HAL_IRDA_MODULE_ENABLED */
434
+
435
+#ifdef HAL_SMARTCARD_MODULE_ENABLED
436
+#include "stm32h7xx_hal_smartcard.h"
437
+#endif /* HAL_SMARTCARD_MODULE_ENABLED */
438
+
439
+#ifdef HAL_SMBUS_MODULE_ENABLED
440
+#include "stm32h7xx_hal_smbus.h"
441
+#endif /* HAL_SMBUS_MODULE_ENABLED */
442
+
443
+#ifdef HAL_WWDG_MODULE_ENABLED
444
+#include "stm32h7xx_hal_wwdg.h"
445
+#endif /* HAL_WWDG_MODULE_ENABLED */
446
+
447
+#ifdef HAL_PCD_MODULE_ENABLED
448
+#include "stm32h7xx_hal_pcd.h"
449
+#endif /* HAL_PCD_MODULE_ENABLED */
450
+
451
+#ifdef HAL_HCD_MODULE_ENABLED
452
+#include "stm32h7xx_hal_hcd.h"
453
+#endif /* HAL_HCD_MODULE_ENABLED */
454
+
455
+/* Exported macro ------------------------------------------------------------*/
456
+#ifdef  USE_FULL_ASSERT
457
+/**
458
+  * @brief  The assert_param macro is used for function's parameters check.
459
+  * @param  expr: If expr is false, it calls assert_failed function
460
+  *         which reports the name of the source file and the source
461
+  *         line number of the call that failed.
462
+  *         If expr is true, it returns no value.
463
+  * @retval None
464
+  */
465
+#define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__))
466
+/* Exported functions ------------------------------------------------------- */
467
+void assert_failed(uint8_t *file, uint32_t line);
468
+#else
469
+#define assert_param(expr) ((void)0U)
470
+#endif /* USE_FULL_ASSERT */
471
+
472
+#ifdef __cplusplus
473
+}
474
+#endif
475
+
476
+#endif /* __STM32H7xx_HAL_CONF_DEFAULT_H */
477
+
478
+
479
+/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/

+ 208
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/ldscript.ld Переглянути файл

@@ -0,0 +1,208 @@
1
+/*
2
+******************************************************************************
3
+**
4
+**  File        : LinkerScript.ld
5
+**
6
+**  Author		: Auto-generated by STM32CubeIDE
7
+**
8
+**  Abstract    : Linker script for NUCLEO-H743II(2) Board embedding STM32H743IITx Device from STM32H7 series
9
+**                      2048Kbytes FLASH
10
+**                      128Kbytes DTCMRAM
11
+**                      64Kbytes ITCMRAM
12
+**                      512Kbytes RAM_D1
13
+**                      288Kbytes RAM_D2
14
+**                      64Kbytes RAM_D3
15
+**
16
+**                Set heap size, stack size and stack location according
17
+**                to application requirements.
18
+**
19
+**                Set memory bank area and size if external memory is used.
20
+**
21
+**  Target      : STMicroelectronics STM32
22
+**
23
+**  Distribution: The file is distributed as is without any warranty
24
+**                of any kind.
25
+**
26
+*****************************************************************************
27
+** @attention
28
+**
29
+** <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
30
+**
31
+** Redistribution and use in source and binary forms, with or without modification,
32
+** are permitted provided that the following conditions are met:
33
+**   1. Redistributions of source code must retain the above copyright notice,
34
+**      this list of conditions and the following disclaimer.
35
+**   2. Redistributions in binary form must reproduce the above copyright notice,
36
+**      this list of conditions and the following disclaimer in the documentation
37
+**      and/or other materials provided with the distribution.
38
+**   3. Neither the name of STMicroelectronics nor the names of its contributors
39
+**      may be used to endorse or promote products derived from this software
40
+**      without specific prior written permission.
41
+**
42
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
43
+** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
44
+** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
45
+** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
46
+** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
47
+** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
48
+** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
49
+** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
50
+** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
51
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
52
+**
53
+*****************************************************************************
54
+*/
55
+
56
+/* Entry Point */
57
+ENTRY(Reset_Handler)
58
+
59
+/* Highest address of the user mode stack */
60
+_estack = 0x24080000;	/* end of "RAM_D1" Ram type memory */
61
+
62
+_Min_Heap_Size = 0x200;	/* required amount of heap  */
63
+_Min_Stack_Size = 0x400;	/* required amount of stack */
64
+
65
+/* Memories definition */
66
+MEMORY
67
+{
68
+    DTCMRAM	(xrw)	: ORIGIN = 0x20000000,	LENGTH = 128K
69
+    ITCMRAM	(xrw)	: ORIGIN = 0x00000000,	LENGTH = 64K
70
+    RAM_D1	(xrw)	: ORIGIN = 0x24000000,	LENGTH = 512K
71
+    RAM_D2	(xrw)	: ORIGIN = 0x30000000,	LENGTH = 288K
72
+    RAM_D3	(xrw)	: ORIGIN = 0x38000000,	LENGTH = 64K
73
+    FLASH	(rx)	: ORIGIN = 0x8020000,	LENGTH = 2048K - 128K
74
+}
75
+
76
+/* Sections */
77
+SECTIONS
78
+{
79
+  /* The startup code into "FLASH" Rom type memory */
80
+  .isr_vector :
81
+  {
82
+    . = ALIGN(4);
83
+    KEEP(*(.isr_vector)) /* Startup code */
84
+    . = ALIGN(4);
85
+  } >FLASH
86
+
87
+  /* The program code and other data into "FLASH" Rom type memory */
88
+  .text :
89
+  {
90
+    . = ALIGN(4);
91
+    *(.text)           /* .text sections (code) */
92
+    *(.text*)          /* .text* sections (code) */
93
+    *(.glue_7)         /* glue arm to thumb code */
94
+    *(.glue_7t)        /* glue thumb to arm code */
95
+    *(.eh_frame)
96
+
97
+    KEEP (*(.init))
98
+    KEEP (*(.fini))
99
+
100
+    . = ALIGN(4);
101
+    _etext = .;        /* define a global symbols at end of code */
102
+  } >FLASH
103
+
104
+  /* Constant data into "FLASH" Rom type memory */
105
+  .rodata :
106
+  {
107
+    . = ALIGN(4);
108
+    *(.rodata)         /* .rodata sections (constants, strings, etc.) */
109
+    *(.rodata*)        /* .rodata* sections (constants, strings, etc.) */
110
+    . = ALIGN(4);
111
+  } >FLASH
112
+
113
+  .ARM.extab   : {
114
+  	. = ALIGN(4);
115
+  	*(.ARM.extab* .gnu.linkonce.armextab.*)
116
+  	. = ALIGN(4);
117
+  } >FLASH
118
+
119
+  .ARM : {
120
+    . = ALIGN(4);
121
+    __exidx_start = .;
122
+    *(.ARM.exidx*)
123
+    __exidx_end = .;
124
+    . = ALIGN(4);
125
+  } >FLASH
126
+
127
+  .preinit_array     :
128
+  {
129
+    . = ALIGN(4);
130
+    PROVIDE_HIDDEN (__preinit_array_start = .);
131
+    KEEP (*(.preinit_array*))
132
+    PROVIDE_HIDDEN (__preinit_array_end = .);
133
+    . = ALIGN(4);
134
+  } >FLASH
135
+
136
+  .init_array :
137
+  {
138
+    . = ALIGN(4);
139
+    PROVIDE_HIDDEN (__init_array_start = .);
140
+    KEEP (*(SORT(.init_array.*)))
141
+    KEEP (*(.init_array*))
142
+    PROVIDE_HIDDEN (__init_array_end = .);
143
+    . = ALIGN(4);
144
+  } >FLASH
145
+
146
+  .fini_array :
147
+  {
148
+    . = ALIGN(4);
149
+    PROVIDE_HIDDEN (__fini_array_start = .);
150
+    KEEP (*(SORT(.fini_array.*)))
151
+    KEEP (*(.fini_array*))
152
+    PROVIDE_HIDDEN (__fini_array_end = .);
153
+    . = ALIGN(4);
154
+  } >FLASH
155
+
156
+  /* Used by the startup to initialize data */
157
+  _sidata = LOADADDR(.data);
158
+
159
+  /* Initialized data sections into "RAM_D1" Ram type memory */
160
+  .data :
161
+  {
162
+    . = ALIGN(4);
163
+    _sdata = .;        /* create a global symbol at data start */
164
+    *(.data)           /* .data sections */
165
+    *(.data*)          /* .data* sections */
166
+
167
+    . = ALIGN(4);
168
+    _edata = .;        /* define a global symbol at data end */
169
+
170
+  } >RAM_D1 AT> FLASH
171
+
172
+  /* Uninitialized data section into "RAM_D1" Ram type memory */
173
+  . = ALIGN(4);
174
+  .bss :
175
+  {
176
+    /* This is used by the startup in order to initialize the .bss secion */
177
+    _sbss = .;         /* define a global symbol at bss start */
178
+    __bss_start__ = _sbss;
179
+    *(.bss)
180
+    *(.bss*)
181
+    *(COMMON)
182
+
183
+    . = ALIGN(4);
184
+    _ebss = .;         /* define a global symbol at bss end */
185
+    __bss_end__ = _ebss;
186
+  } >RAM_D1
187
+
188
+  /* User_heap_stack section, used to check that there is enough "RAM_D1" Ram  type memory left */
189
+  ._user_heap_stack :
190
+  {
191
+    . = ALIGN(8);
192
+    PROVIDE ( end = . );
193
+    PROVIDE ( _end = . );
194
+    . = . + _Min_Heap_Size;
195
+    . = . + _Min_Stack_Size;
196
+    . = ALIGN(8);
197
+  } >RAM_D1
198
+
199
+  /* Remove information from the compiler libraries */
200
+  /DISCARD/ :
201
+  {
202
+    libc.a ( * )
203
+    libm.a ( * )
204
+    libgcc.a ( * )
205
+  }
206
+
207
+  .ARM.attributes 0 : { *(.ARM.attributes) }
208
+}

+ 332
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.cpp Переглянути файл

@@ -0,0 +1,332 @@
1
+#include "pins_arduino.h"
2
+
3
+#ifdef __cplusplus
4
+extern "C" {
5
+#endif
6
+
7
+// Pin number
8
+const PinName digitalPin[] = {
9
+  PE_2,  // D0
10
+  PE_3,  // D1
11
+  PE_4,  // D2
12
+  PE_5,  // D3
13
+  PE_6,  // D4
14
+  PI_8,  // D5
15
+  PC_13, // D6
16
+  PC_14, // D7
17
+  PC_15, // D8
18
+  PI_9,  // D9
19
+  PI_10, // D10
20
+  PI_11, // D11
21
+  PF_0,  // D12
22
+  PF_1,  // D13
23
+  PF_2,  // D14
24
+  PH_0,  // D15
25
+  PH_1,  // D16
26
+  PB_2,  // D17
27
+  PF_15, // D18
28
+  PG_0,  // D19
29
+  PG_1,  // D20
30
+  PE_7,  // D21
31
+  PE_8,  // D22
32
+  PE_9,  // D23
33
+  PE_10, // D24
34
+  PE_11, // D25
35
+  PE_12, // D26
36
+  PE_13, // D27
37
+  PE_14, // D28
38
+  PE_15, // D29
39
+  PB_10, // D30
40
+  PB_11, // D31
41
+  PH_6,  // D32
42
+  PH_7,  // D33
43
+  PH_8,  // D34
44
+  PH_9,  // D35
45
+  PH_10, // D36
46
+  PH_11, // D37
47
+  PH_12, // D38
48
+  PB_12, // D39
49
+  PB_13, // D40
50
+  PB_14, // D41
51
+  PB_15, // D42
52
+  PD_8,  // D43
53
+  PD_9,  // D44
54
+  PD_10, // D45
55
+  PD_11, // D46
56
+  PD_12, // D47
57
+  PD_13, // D48
58
+  PD_14, // D49
59
+  PD_15, // D50
60
+  PG_2,  // D51
61
+  PG_3,  // D52
62
+  PG_4,  // D53
63
+  PG_5,  // D54
64
+  PG_6,  // D55
65
+  PG_7,  // D56
66
+  PG_8,  // D57
67
+  PC_6,  // D58
68
+  PC_7,  // D59
69
+  PC_8,  // D60
70
+  PC_9,  // D61
71
+  PA_8,  // D62
72
+  PA_9,  // D63
73
+  PA_10, // D64
74
+  PA_11, // D65
75
+  PA_12, // D66
76
+  PA_13, // D67
77
+  PH_13, // D68
78
+  PH_14, // D69
79
+  PH_15, // D70
80
+  PI_0,  // D71
81
+  PI_1,  // D72
82
+  PI_2,  // D73
83
+  PI_3,  // D74
84
+  PA_14, // D75
85
+  PA_15, // D76
86
+  PC_10, // D77
87
+  PC_11, // D78
88
+  PC_12, // D79
89
+  PD_0,  // D80
90
+  PD_1,  // D81
91
+  PD_2,  // D82
92
+  PD_3,  // D83
93
+  PD_4,  // D84
94
+  PD_5,  // D85
95
+  PD_6,  // D86
96
+  PD_7,  // D87
97
+  PG_9,  // D88
98
+  PG_10, // D89
99
+  PG_11, // D90
100
+  PG_12, // D91
101
+  PG_13, // D92
102
+  PG_14, // D93
103
+  PG_15, // D94
104
+  PB_3,  // D95
105
+  PB_4,  // D96
106
+  PB_5,  // D97
107
+  PB_6,  // D98
108
+  PB_7,  // D99
109
+  PB_8,  // D100
110
+  PB_9,  // D101
111
+  PE_0,  // D102
112
+  PE_1,  // D103
113
+  PI_4,  // D104
114
+  PI_5,  // D105
115
+  PI_6,  // D106
116
+  PI_7,  // D107
117
+  PA_0,  // D108 / A0
118
+  PA_1,  // D109 / A1
119
+  PA_2,  // D110 / A2
120
+  PA_3,  // D111 / A3
121
+  PA_4,  // D112 / A4
122
+  PA_5,  // D113 / A5
123
+  PA_6,  // D114 / A6
124
+  PA_7,  // D115 / A7
125
+  PB_0,  // D116 / A8
126
+  PB_1,  // D117 / A9
127
+  PH_2,  // D118 / A10
128
+  PH_3,  // D119 / A11
129
+  PH_4,  // D120 / A12
130
+  PH_5,  // D121 / A13
131
+  PC_0,  // D122 / A14
132
+  PC_1,  // D123 / A15
133
+  PC_2,  // D124 / A16
134
+  PC_3,  // D125 / A17
135
+  PC_4,  // D126 / A18
136
+  PC_5,  // D127 / A19
137
+  PF_3,  // D128 / A20
138
+  PF_4,  // D129 / A21
139
+  PF_5,  // D130 / A22
140
+  PF_6,  // D131 / A23
141
+  PF_7,  // D132 / A24
142
+  PF_8,  // D133 / A25
143
+  PF_9,  // D134 / A26
144
+  PF_10, // D135 / A27
145
+  PF_11, // D136 / A28
146
+  PF_12, // D137 / A29
147
+  PF_13, // D138 / A30
148
+  PF_14, // D139 / A31
149
+};
150
+
151
+#ifdef __cplusplus
152
+}
153
+#endif
154
+
155
+// ----------------------------------------------------------------------------
156
+
157
+#ifdef __cplusplus
158
+extern "C" {
159
+#endif
160
+
161
+void SystemClockStartupInit() {
162
+  // Confirm is called only once time to avoid hang up caused by repeated calls in USB wakeup interrupt
163
+  static bool first_call = true;
164
+  if (!first_call) return;
165
+  first_call = false;
166
+
167
+  // Clear all clock setting register
168
+  RCC->CR = 0x00000001;
169
+  RCC->CFGR = 0x00000000;
170
+  RCC->D1CFGR = 0x00000000;
171
+  RCC->D2CFGR = 0x00000000;
172
+  RCC->D3CFGR = 0x00000000;
173
+  RCC->PLLCKSELR = 0x00000000;
174
+  RCC->PLLCFGR = 0x00000000;
175
+  RCC->CIER = 0x00000000;
176
+
177
+  // AXI_TARG7_FN_MOD for SRAM
178
+  *((volatile uint32_t*)0x51008108)=0x00000001;
179
+
180
+  // Enable L1-Cache
181
+  SCB_EnableICache();
182
+  SCB_EnableDCache();
183
+  SCB->CACR |= 1<<2;
184
+
185
+  PWR->CR3 &= ~(1 << 2);  // SCUEN=0
186
+  PWR->D3CR |= 3 << 14;   // VOS=3,Scale1,1.15~1.26V core voltage
187
+  while((PWR->D3CR & (1 << 13)) == 0);	// Wait for the voltage to stabilize
188
+  RCC->CR |= 1<<16;       // Enable HSE
189
+
190
+  uint16_t timeout = 0;
191
+  while(((RCC->CR & (1 << 17)) == 0) && (timeout < 0X7FFF)) {
192
+    timeout++;            // Wait for HSE RDY
193
+  }
194
+
195
+    if(timeout == 0X7FFF) {
196
+    Error_Handler();
197
+  } else {
198
+    RCC->PLLCKSELR |= 2 << 0;         // PLLSRC[1:0] = 2, HSE for PLL clock source
199
+    RCC->PLLCKSELR |= 5 << 4;         // DIVM1[5:0] = pllm,     Prescaler for PLL1
200
+    RCC->PLL1DIVR |= (160 - 1) << 0;  // DIVN1[8:0] = plln - 1, Multiplication factor for PLL1 VCO
201
+    RCC->PLL1DIVR |= (2 - 1) << 9;	  // DIVP1[6:0] = pllp - 1, PLL1 DIVP division factor
202
+    RCC->PLL1DIVR |= (4 - 1) << 16;   // DIVQ1[6:0] = pllq - 1, PLL1 DIVQ division factor
203
+    RCC->PLL1DIVR |= 1 << 24;		      // DIVR1[6:0] = pllr - 1, PLL1 DIVR division factor
204
+    RCC->PLLCFGR |= 2 << 2;           // PLL1 input (ref1_ck) clock range frequency is between 4 and 8 MHz
205
+    RCC->PLLCFGR |= 0 << 1;           // PLL1 VCO selection, 0: 192 to 836 MHz, 1 : 150 to 420 MHz
206
+    RCC->PLLCFGR |= 3 << 16;          // pll1_q_ck and pll1_p_ck output is enabled
207
+    RCC->CR |= 1 << 24;               // PLL1 enable
208
+    while((RCC->CR & (1 << 25)) == 0); // PLL1 clock ready flag
209
+
210
+    // PLL2 DIVR clock frequency = 220MHz, so that SDRAM clock can be set to 110MHz
211
+    RCC->PLLCKSELR |= 25 << 12;       // DIVM2[5:0] = 25, Prescaler for PLL2
212
+    RCC->PLL2DIVR |= (440 - 1) << 0;	// DIVN2[8:0] = 440 - 1, Multiplication factor for PLL2 VCO
213
+    RCC->PLL2DIVR |= (2 - 1) << 9;    // DIVP2[6:0] = 2-1, PLL2 DIVP division factor
214
+    RCC->PLL2DIVR |= (2 - 1) << 24;   // DIVR2[6:0] = 2-1, PLL2 DIVR division factor
215
+    RCC->PLLCFGR |= 0 << 6;           // PLL2RGE[1:0]=0, PLL2 input (ref2_ck) clock range frequency is between 1 and 2 MHz
216
+    RCC->PLLCFGR |= 0 << 5;           // PLL2 VCO selection, 0: 192 to 836 MHz, 1: 150 to 420 MHz
217
+    RCC->PLLCFGR |= 1 << 19;          // pll2_p_ck output is enabled
218
+    RCC->PLLCFGR |= 1 << 21;          // pll2_r_ck output is enabled
219
+    RCC->D1CCIPR &= ~(3 << 0);        // clear FMC kernel clock source selection
220
+    RCC->D1CCIPR |= 2 << 0;           // pll2_r_ck clock selected as kernel peripheral clock
221
+    RCC->CR |= 1 << 26;               // PLL2 enable
222
+    while((RCC->CR&(1<<27)) == 0);    // PLL2 clock ready flag
223
+
224
+    RCC->D1CFGR |= 8 << 0;  // rcc_hclk3 = sys_d1cpre_ck / 2 = 400 / 2 = 200MHz.  AHB1/2/3/4
225
+    RCC->D1CFGR |= 0 << 8;  // sys_ck not divided, sys_d1cpre_ck = sys_clk / 1 = 400 / 1 = 400MHz, System Clock = 400MHz
226
+    RCC->CFGR |= 3 << 0;    // PLL1 selected as system clock (pll1_p_ck). 400MHz
227
+    while(1) {
228
+      timeout = (RCC->CFGR & (7 << 3)) >> 3; // System clock switch status
229
+      if(timeout == 3) break; // Wait for SW[2:0] = 3 (011: PLL1 selected as system clock (pll1_p_ck))
230
+    }
231
+
232
+    FLASH->ACR |= 2 << 0;   // LATENCY[2:0] = 2 (@VOS1 Level,maxclock=210MHz)
233
+    FLASH->ACR |= 2 << 4;   // WRHIGHFREQ[1:0] = 2, flash access frequency < 285MHz
234
+
235
+    RCC->D1CFGR |= 4 << 4;  // D1PPRE[2:0] = 4, rcc_pclk3 = rcc_hclk3 / 2 = 100MHz, APB3.
236
+    RCC->D2CFGR |= 4 << 4;  // D2PPRE1[2:0] = 4, rcc_pclk1 = rcc_hclk1 / 2 = 100MHz, APB1.
237
+    RCC->D2CFGR |= 4 << 8;  // D2PPRE2[2:0] = 4, rcc_pclk2 = rcc_hclk1 / 2 = 100MHz, APB2.
238
+    RCC->D3CFGR |= 4 << 4;  // D3PPRE[2:0] = 4, rcc_pclk4 = rcc_hclk4 / 2 = 100MHz, APB4.
239
+
240
+    RCC->CR |= 1 << 7;      // CSI clock enable
241
+    RCC->APB4ENR |= 1 << 1; // SYSCFG peripheral clock enable
242
+    SYSCFG->CCCSR |= 1 << 0;
243
+  }
244
+
245
+  // USB clock, (use HSI48 clock)
246
+  RCC->CR |= 1 << 12;   // HSI48 clock enabl
247
+  while((RCC->CR & (1 << 13)) == 0);// 1: HSI48 clock is ready
248
+  RCC->APB1HENR |= 1 << 1;      // CRS peripheral clock enabled
249
+  RCC->APB1HRSTR |= 1 << 1;     // Resets CRS
250
+  RCC->APB1HRSTR &= ~(1 << 1);  // Does not reset CRS
251
+  CRS->CFGR &= ~(3 << 28);      // USB2 SOF selected as SYNC signal source
252
+  CRS->CR |= 3 << 5;            // Automatic trimming and Frequency error counter enabled
253
+  RCC->D2CCIP2R &= ~(3 << 20);  // Clear USBOTG 1 and 2 kernel clock source selection
254
+  RCC->D2CCIP2R |= 3 << 20;     // HSI48_ck clock is selected as kernel clock
255
+}
256
+
257
+uint8_t MPU_Convert_Bytes_To_POT(uint32_t nbytes)
258
+{
259
+  uint8_t count = 0;
260
+  while(nbytes != 1)
261
+  {
262
+    nbytes >>= 1;
263
+    count++;
264
+  }
265
+  return count;
266
+}
267
+
268
+uint8_t MPU_Set_Protection(uint32_t baseaddr, uint32_t size, uint32_t rnum, uint8_t ap, uint8_t sen, uint8_t cen, uint8_t ben)
269
+{
270
+  uint32_t tempreg = 0;
271
+  uint8_t rnr = 0;
272
+  if ((size % 32) || size == 0) return 1;
273
+  rnr = MPU_Convert_Bytes_To_POT(size) - 1;
274
+  SCB->SHCSR &= ~(1 << 16);	        //disable MemManage
275
+  MPU->CTRL &= ~(1 << 0);		        //disable MPU
276
+  MPU->RNR = rnum;
277
+  MPU->RBAR = baseaddr;
278
+  tempreg |= 0 << 28;
279
+  tempreg |= ((uint32_t)ap) << 24;
280
+  tempreg |= 0 << 19;
281
+  tempreg |= ((uint32_t)sen) << 18;
282
+  tempreg |= ((uint32_t)cen) << 17;
283
+  tempreg |= ((uint32_t)ben) << 16;
284
+  tempreg |= 0 << 8;
285
+  tempreg |= rnr << 1;
286
+  tempreg |= 1 << 0;
287
+  MPU->RASR = tempreg;
288
+  MPU->CTRL = (1 << 2) | (1 << 0);  //enable PRIVDEFENA
289
+  SCB->SHCSR |= 1 << 16;		        //enable MemManage
290
+  return 0;
291
+}
292
+
293
+void MPU_Memory_Protection(void)
294
+{
295
+	MPU_Set_Protection(0x20000000, 128 * 1024, 1, MPU_REGION_FULL_ACCESS, 0, 1, 1);       // protect DTCM 128k,  Sharing is prohibited, cache is allowed, and buffering is allowed
296
+
297
+	MPU_Set_Protection(0x24000000, 512 * 1024, 2, MPU_REGION_FULL_ACCESS, 0, 1, 1);       // protect AXI SRAM,  Sharing is prohibited, cache is allowed, and buffering is allowed
298
+	MPU_Set_Protection(0x30000000, 512 * 1024, 3, MPU_REGION_FULL_ACCESS, 0, 1, 1);       // protect SRAM1~SRAM3, Sharing is prohibited, cache is allowed, and buffering is allowed
299
+	MPU_Set_Protection(0x38000000, 64 * 1024, 4, MPU_REGION_FULL_ACCESS, 0, 1, 1);        // protect SRAM4, Sharing is prohibited, cache is allowed, and buffering is allowed
300
+
301
+	MPU_Set_Protection(0x60000000, 64 * 1024 * 1024, 5, MPU_REGION_FULL_ACCESS, 0, 0, 0);   // protect LCD FMC  64M, No sharing, no cache, no buffering
302
+	MPU_Set_Protection(0XC0000000, 32 * 1024 * 1024, 6, MPU_REGION_FULL_ACCESS, 0, 1, 1);   // protect SDRAM  32M, Sharing is prohibited, cache is allowed, and buffering is allowed
303
+	MPU_Set_Protection(0X80000000, 256 * 1024 * 1024, 7, MPU_REGION_FULL_ACCESS, 0, 0, 0);  // protect NAND FLASH 256M, No sharing, no cache, no buffering
304
+}
305
+
306
+/**
307
+  * @brief  System Clock Configuration
308
+  * @param  None
309
+  * @retval None
310
+  */
311
+WEAK void SystemClock_Config(void)
312
+{
313
+  SystemClockStartupInit();
314
+
315
+  MPU_Memory_Protection();
316
+
317
+  /* Update current SystemCoreClock value */
318
+  SystemCoreClockUpdate();
319
+
320
+  /* Configure the Systick interrupt time */
321
+  HAL_SYSTICK_Config(SystemCoreClock/1000);
322
+
323
+  /* Configure the Systick */
324
+  HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
325
+
326
+  /* SysTick_IRQn interrupt configuration */
327
+  HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
328
+}
329
+
330
+#ifdef __cplusplus
331
+}
332
+#endif

+ 222
- 0
buildroot/share/PlatformIO/variants/BTT_SKR_SE_BX/variant.h Переглянути файл

@@ -0,0 +1,222 @@
1
+#ifndef _VARIANT_ARDUINO_STM32_
2
+#define _VARIANT_ARDUINO_STM32_
3
+#ifdef __cplusplus
4
+
5
+extern "C" {
6
+#endif // __cplusplus
7
+/*----------------------------------------------------------------------------
8
+ *        Pins
9
+ *----------------------------------------------------------------------------*/
10
+#define PE2  0
11
+#define PE3  1
12
+#define PE4  2
13
+#define PE5  3
14
+#define PE6  4
15
+#define PI8  5
16
+#define PC13 6
17
+#define PC14 7
18
+#define PC15 8
19
+#define PI9  9
20
+#define PI10 10
21
+#define PI11 11
22
+#define PF0  12
23
+#define PF1  13
24
+#define PF2  14
25
+#define PH0  15
26
+#define PH1  16
27
+#define PB2  17
28
+#define PF15 18
29
+#define PG0  19
30
+#define PG1  20
31
+#define PE7  21
32
+#define PE8  22
33
+#define PE9  23
34
+#define PE10 24
35
+#define PE11 25
36
+#define PE12 26
37
+#define PE13 27
38
+#define PE14 28
39
+#define PE15 29
40
+#define PB10 30
41
+#define PB11 31
42
+#define PH6  32
43
+#define PH7  33
44
+#define PH8  34
45
+#define PH9  35
46
+#define PH10 36
47
+#define PH11 37
48
+#define PH12 38
49
+#define PB12 39
50
+#define PB13 40
51
+#define PB14 41
52
+#define PB15 42
53
+#define PD8  43
54
+#define PD9  44
55
+#define PD10 45
56
+#define PD11 46
57
+#define PD12 47
58
+#define PD13 48
59
+#define PD14 49
60
+#define PD15 50
61
+#define PG2  51
62
+#define PG3  52
63
+#define PG4  53
64
+#define PG5  54
65
+#define PG6  55
66
+#define PG7  56
67
+#define PG8  57
68
+#define PC6  58
69
+#define PC7  59
70
+#define PC8  60
71
+#define PC9  61
72
+#define PA8  62
73
+#define PA9  63
74
+#define PA10 64
75
+#define PA11 65
76
+#define PA12 66
77
+#define PA13 67
78
+#define PH13 68
79
+#define PH14 69
80
+#define PH15 70
81
+#define PI0  71
82
+#define PI1  72
83
+#define PI2  73
84
+#define PI3  74
85
+#define PA14 75
86
+#define PA15 76
87
+#define PC10 77
88
+#define PC11 78
89
+#define PC12 79
90
+#define PD0  80
91
+#define PD1  81
92
+#define PD2  82
93
+#define PD3  83
94
+#define PD4  84
95
+#define PD5  85
96
+#define PD6  86
97
+#define PD7  87
98
+#define PG9  88
99
+#define PG10 89
100
+#define PG11 90
101
+#define PG12 91
102
+#define PG13 92
103
+#define PG14 93
104
+#define PG15 94
105
+#define PB3  95
106
+#define PB4  96
107
+#define PB5  97
108
+#define PB6  98
109
+#define PB7  99
110
+#define PB8  100
111
+#define PB9  101
112
+#define PE0  102
113
+#define PE1  103
114
+#define PI4  104
115
+#define PI5  105
116
+#define PI6  106
117
+#define PI7  107
118
+#define PA0  108
119
+#define PA1  109
120
+#define PA2  110
121
+#define PA3  111
122
+#define PA4  112
123
+#define PA5  113
124
+#define PA6  114
125
+#define PA7  115
126
+#define PB0  116
127
+#define PB1  117
128
+#define PH2  118
129
+#define PH3  119
130
+#define PH4  120
131
+#define PH5  121
132
+#define PC0  122
133
+#define PC1  123
134
+#define PC2  124
135
+#define PC3  125
136
+#define PC4  126
137
+#define PC5  127
138
+#define PF3  128
139
+#define PF4  129
140
+#define PF5  130
141
+#define PF6  131
142
+#define PF7  132
143
+#define PF8  133
144
+#define PF9  134
145
+#define PF10 135
146
+#define PF11 136
147
+#define PF12 137
148
+#define PF13 138
149
+#define PF14 139
150
+
151
+// This must be a literal with the same value as PEND
152
+#define NUM_DIGITAL_PINS        140
153
+
154
+// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
155
+#define NUM_ANALOG_INPUTS       24
156
+#define NUM_ANALOG_FIRST        108
157
+
158
+// Timer Definitions
159
+//Do not use timer used by PWM pins when possible. See PinMap_PWM in PeripheralPins.c
160
+#define TIMER_TONE              TIM2
161
+#define TIMER_SERVO             TIM5
162
+#define TIMER_SERIAL            TIM7
163
+
164
+// UART1 for TFT port
165
+#define ENABLE_HWSERIAL1
166
+#define PIN_SERIAL1_RX          PA10
167
+#define PIN_SERIAL1_TX          PA9
168
+
169
+// UART4 for ESP-01 port
170
+#define ENABLE_HWSERIAL4
171
+#define PIN_SERIAL4_RX          PA1
172
+#define PIN_SERIAL4_TX          PA0
173
+
174
+// IIC1 for onboard 24C32 EEPROM
175
+#define PIN_WIRE_SDA            PB9
176
+#define PIN_WIRE_SCL            PB8
177
+
178
+// SPI3 for onboard SD card
179
+// #define PIN_SPI_MOSI            PC12
180
+// #define PIN_SPI_MISO            PC11
181
+// #define PIN_SPI_SCK             PC10
182
+
183
+// HSE default value is 25MHz in HAL
184
+// HSE_BYPASS is 25MHz
185
+#ifndef HSE_BYPASS_NOT_USED
186
+  #define HSE_VALUE 25000000
187
+#endif
188
+
189
+// #define USE_USB_FS
190
+/* Extra HAL modules */
191
+//#define HAL_HCD_MODULE_ENABLED
192
+//#define HAL_DAC_MODULE_ENABLED
193
+//#define HAL_ETH_MODULE_ENABLED
194
+
195
+#ifdef __cplusplus
196
+} // extern "C"
197
+#endif
198
+/*----------------------------------------------------------------------------
199
+ *        Arduino objects - C++ only
200
+ *----------------------------------------------------------------------------*/
201
+
202
+#ifdef __cplusplus
203
+// These serial port names are intended to allow libraries and architecture-neutral
204
+// sketches to automatically default to the correct port name for a particular type
205
+// of use.  For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
206
+// the first hardware serial port whose RX/TX pins are not dedicated to another use.
207
+//
208
+// SERIAL_PORT_MONITOR        Port which normally prints to the Arduino Serial Monitor
209
+//
210
+// SERIAL_PORT_USBVIRTUAL     Port which is USB virtual serial
211
+//
212
+// SERIAL_PORT_LINUXBRIDGE    Port which connects to a Linux system via Bridge library
213
+//
214
+// SERIAL_PORT_HARDWARE       Hardware serial port, physical RX & TX pins.
215
+//
216
+// SERIAL_PORT_HARDWARE_OPEN  Hardware serial ports which are open for use.  Their RX & TX
217
+//                            pins are NOT connected to anything by default.
218
+#define SERIAL_PORT_MONITOR     Serial
219
+#define SERIAL_PORT_HARDWARE    Serial
220
+#endif
221
+
222
+#endif /* _VARIANT_ARDUINO_STM32_ */

+ 18
- 0
buildroot/tests/BTT_SKR_SE_BX Переглянути файл

@@ -0,0 +1,18 @@
1
+#!/usr/bin/env bash
2
+#
3
+# Build tests for BTT_SKR_SE_BX
4
+#
5
+
6
+# exit on first failure
7
+set -e
8
+
9
+#
10
+# Build with the default configurations
11
+#
12
+restore_configs
13
+opt_set MOTHERBOARD BOARD_BTT_SKR_SE_BX
14
+opt_set SERIAL_PORT 1
15
+exec_test $1 $2 "Default Configuration" "$3"
16
+
17
+# clean up
18
+restore_configs

+ 1
- 1
ini/features.ini Переглянути файл

@@ -37,7 +37,7 @@ HAS_WIRED_LCD           = src_filter=+<src/lcd/lcdprint.cpp>
37 37
 HAS_MARLINUI_HD44780    = src_filter=+<src/lcd/HD44780>
38 38
 HAS_MARLINUI_U8GLIB     = U8glib-HAL@~0.4.1
39 39
                           src_filter=+<src/lcd/dogm>
40
-HAS_(FSMC|SPI)_TFT      = src_filter=+<src/HAL/STM32/tft> +<src/HAL/STM32F1/tft> +<src/lcd/tft_io>
40
+HAS_(FSMC|SPI|LTDC)_TFT = src_filter=+<src/HAL/STM32/tft> +<src/HAL/STM32F1/tft> +<src/lcd/tft_io>
41 41
 HAS_FSMC_TFT            = src_filter=+<src/HAL/STM32/tft/tft_fsmc.cpp> +<src/HAL/STM32F1/tft/tft_fsmc.cpp>
42 42
 HAS_SPI_TFT             = src_filter=+<src/HAL/STM32/tft/tft_spi.cpp> +<src/HAL/STM32F1/tft/tft_spi.cpp>
43 43
 I2C_EEPROM              = src_filter=+<src/HAL/shared/eeprom_if_i2c.cpp>

+ 25
- 0
ini/stm32f7.ini Переглянути файл

@@ -28,3 +28,28 @@ platform      = ${common_stm32.platform}
28 28
 extends       = common_stm32
29 29
 board         = remram_v1
30 30
 build_flags   = ${common_stm32.build_flags}
31
+
32
+#
33
+# BigTreeTech SKR SE BX (STM32H743IIT6 ARM Cortex-M7)
34
+#
35
+[env:BTT_SKR_SE_BX]
36
+platform          = ${common_stm32.platform}
37
+platform_packages = ${stm_flash_drive.platform_packages}
38
+extends           = common_stm32
39
+board             = BTT_SKR_SE_BX
40
+extra_scripts     = ${common.extra_scripts}
41
+  pre:buildroot/share/PlatformIO/scripts/generic_create_variant.py
42
+build_flags       = ${common_stm32.build_flags}
43
+  ${stm_flash_drive.build_flags}
44
+  -DUSE_USBHOST_HS
45
+  -DUSE_USB_HS_IN_FS
46
+  #-DUSBD_USE_CDC_MSC
47
+  -DVECT_TAB_OFFSET=0x20000
48
+  -DHAL_DMA2D_MODULE_ENABLED
49
+  -DHAL_LTDC_MODULE_ENABLED
50
+  -DHAL_SDRAM_MODULE_ENABLED
51
+  -DHAL_QSPI_MODULE_ENABLED
52
+  -DHAL_MDMA_MODULE_ENABLED
53
+  -DHAL_SD_MODULE_ENABLED
54
+upload_protocol   = cmsis-dap
55
+debug_tool        = cmsis-dap

Завантаження…
Відмінити
Зберегти