Explorar el Código

🎨 Misc. variant cleanup, translation

Followup to #24787
Scott Lahteine hace 1 año
padre
commit
9be1554faf

+ 1
- 1
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h Ver fichero

411
 #endif /* HAL_SPI_MODULE_ENABLED */
411
 #endif /* HAL_SPI_MODULE_ENABLED */
412
 
412
 
413
 #ifdef HAL_TIM_MODULE_ENABLED
413
 #ifdef HAL_TIM_MODULE_ENABLED
414
-#include "stm32f4xx_hal_tim.h" 
414
+#include "stm32f4xx_hal_tim.h"
415
 #endif /* HAL_TIM_MODULE_ENABLED */
415
 #endif /* HAL_TIM_MODULE_ENABLED */
416
 
416
 
417
 #ifdef HAL_UART_MODULE_ENABLED
417
 #ifdef HAL_UART_MODULE_ENABLED

+ 50
- 52
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp Ver fichero

170
 #endif
170
 #endif
171
 
171
 
172
 uint32_t myvar[] = {1,2,3,4,5,6,7,8};
172
 uint32_t myvar[] = {1,2,3,4,5,6,7,8};
173
-void myshow(int fre,int times)//YSZ-WORK
173
+void myshow(int fre, int times) // YSZ-WORK
174
 {
174
 {
175
   uint32_t index = 10;
175
   uint32_t index = 10;
176
-  RCC->AHB1ENR |= 1 << 6;//端口G时钟
177
-  GPIOG->MODER &= ~(3UL << 2 * index);//清除旧模式
178
-  GPIOG->MODER |= 1 << 2 * index;//模式为输出
179
-  GPIOG->OSPEEDR &= ~(3UL << 2 * index); //清除旧输出速度
180
-  GPIOG->OSPEEDR |= 2 << 2 * index;//设置输出速度
181
-  GPIOG->OTYPER &= ~(1UL << index);//清除旧输出方式
182
-  GPIOG->OTYPER |= 0 << index;//设置输出方式为推挽
183
-  GPIOG->PUPDR &= ~(3 << 2 * index);//先清除原来的设置
184
-  GPIOG->PUPDR |= 1 << 2 * index;//设置新的上下拉
185
-  while(times != 0) {
176
+  RCC->AHB1ENR |= 1 << 6; // port G clock
177
+  GPIOG->MODER &= ~(3UL << 2 * index); // clear old mode
178
+  GPIOG->MODER |= 1 << 2 * index; // mode is output
179
+  GPIOG->OSPEEDR &= ~(3UL << 2 * index) // Clear old output speed
180
+                    GPIOG->OSPEEDR |= 2 << 2 * index; // Set output speed
181
+  GPIOG->OTYPER &= ~(1UL << index) // clear old output
182
+                   GPIOG->OTYPER |= 0 << index; // Set the output mode to push-pull
183
+  GPIOG->PUPDR &= ~(3 << 2 * index) // Clear the original settings first
184
+                  GPIOG->PUPDR |= 1 << 2 * index; // Set new up and down
185
+  while (times != 0) {
186
     GPIOG->BSRR = 1UL << index;
186
     GPIOG->BSRR = 1UL << index;
187
-    for(int i = 0;i < fre; i++)
188
-    for(int j = 0; j < 1000000; j++)__NOP();
187
+    for (int i = 0; i < fre; i++)
188
+      for (int j = 0; j < 1000000; j++) __NOP();
189
     GPIOG->BSRR = 1UL << (index + 16);
189
     GPIOG->BSRR = 1UL << (index + 16);
190
-    for(int i = 0;i < fre; i++)
191
-    for(int j = 0; j < 1000000; j++)__NOP();
192
-    if(times > 0)times--;
190
+    for (int i = 0; i < fre; i++)
191
+      for (int j = 0; j < 1000000; j++) __NOP();
192
+    if (times > 0) times--;
193
   }
193
   }
194
 }
194
 }
195
 
195
 
196
 HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA)
196
 HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA)
197
 {
197
 {
198
   HAL_SD_CardStateTypeDef CardState;
198
   HAL_SD_CardStateTypeDef CardState;
199
-  volatile uint32_t respR1 = 0, status = 0; 
200
-  SDIO_CmdInitTypeDef  sdmmc_cmdinit;
199
+  volatile uint32_t respR1 = 0, status = 0;
200
+  SDIO_CmdInitTypeDef sdmmc_cmdinit;
201
   do {
201
   do {
202
     sdmmc_cmdinit.Argument         = RCA << 16;
202
     sdmmc_cmdinit.Argument         = RCA << 16;
203
     sdmmc_cmdinit.CmdIndex         = SDMMC_CMD_SEND_STATUS;
203
     sdmmc_cmdinit.CmdIndex         = SDMMC_CMD_SEND_STATUS;
204
     sdmmc_cmdinit.Response         = SDIO_RESPONSE_SHORT;
204
     sdmmc_cmdinit.Response         = SDIO_RESPONSE_SHORT;
205
     sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO;
205
     sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO;
206
     sdmmc_cmdinit.CPSM             = SDIO_CPSM_ENABLE;
206
     sdmmc_cmdinit.CPSM             = SDIO_CPSM_ENABLE;
207
-    SDIO_SendCommand(SDIOx,&sdmmc_cmdinit);//发送CMD13  
207
+    SDIO_SendCommand(SDIOx,&sdmmc_cmdinit); // send CMD13
208
     do status = SDIOx->STA;
208
     do status = SDIOx->STA;
209
-    while(!(status & ((1 << 0) | (1 << 6) | (1 << 2))));//等待操作完成
210
-    if(status & (1 << 0)) //CRC检测失败
211
-    {
212
-      SDIOx->ICR |= 1 << 0;		//清除错误标记
209
+    while (!(status & ((1 << 0) | (1 << 6) | (1 << 2)))); // wait for the operation to complete
210
+    if (status & (1 << 0)) { // CRC check failed
211
+      SDIOx->ICR |= 1 << 0; // clear error flag
213
       return HAL_ERROR;
212
       return HAL_ERROR;
214
     }
213
     }
215
-    if(status & (1 << 2)) //命令超时 
216
-    {
217
-      SDIOx->ICR |= 1 << 2; //清除错误标记
214
+    if (status & (1 << 2)) { // command timed out
215
+      SDIOx->ICR |= 1 << 2; // clear error flag
218
       return HAL_ERROR;
216
       return HAL_ERROR;
219
     }
217
     }
220
-    if(SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS)return HAL_ERROR;
221
-    SDIOx->ICR = 0X5FF;	 		//清除所有标记
218
+    if (SDIOx->RESPCMD != SDMMC_CMD_SEND_STATUS) return HAL_ERROR;
219
+    SDIOx->ICR = 0X5FF;     // clear all tags
222
     respR1 = SDIOx->RESP1;
220
     respR1 = SDIOx->RESP1;
223
     CardState = (respR1 >> 9) & 0x0000000F;
221
     CardState = (respR1 >> 9) & 0x0000000F;
224
-  }while((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING));
222
+  } while ((CardState == HAL_SD_CARD_RECEIVING) || (CardState == HAL_SD_CARD_SENDING) || (CardState == HAL_SD_CARD_PROGRAMMING));
225
   return HAL_OK;
223
   return HAL_OK;
226
 }
224
 }
227
-void debugStr(const char*str) {
228
-	while(*str) {
229
-		while((USART1->SR & 0x40) == 0); 
230
-		USART1->DR = *str++;
231
-	}
225
+
226
+void debugStr(const char *str) {
227
+  while (*str) {
228
+    while ((USART1->SR & 0x40) == 0);
229
+    USART1->DR = *str++;
230
+  }
232
 }
231
 }
232
+
233
 /**
233
 /**
234
   * @brief  System Clock Configuration
234
   * @brief  System Clock Configuration
235
-  *         The system Clock is configured as follow :
235
+  *         The system Clock is configured as follows:
236
   *            System Clock source            = PLL (HSE)
236
   *            System Clock source            = PLL (HSE)
237
   *            SYSCLK(Hz)                     = 168000000/120000000/180000000
237
   *            SYSCLK(Hz)                     = 168000000/120000000/180000000
238
   *            HCLK(Hz)                       = 168000000/120000000/180000000
238
   *            HCLK(Hz)                       = 168000000/120000000/180000000
265
   /* Enable Power Control clock */
265
   /* Enable Power Control clock */
266
   __HAL_RCC_PWR_CLK_ENABLE();
266
   __HAL_RCC_PWR_CLK_ENABLE();
267
 
267
 
268
-  /* The voltage scaling allows optimizing the power consumption when the device is 
269
-     clocked below the maximum system frequency, to update the voltage scaling value 
268
+  /* The voltage scaling allows optimizing the power consumption when the device is
269
+     clocked below the maximum system frequency, to update the voltage scaling value
270
      regarding system frequency refer to product datasheet.  */
270
      regarding system frequency refer to product datasheet.  */
271
   __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
271
   __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
272
 
272
 
281
   RCC_OscInitStruct.PLL.PLLQ = 7;
281
   RCC_OscInitStruct.PLL.PLLQ = 7;
282
   RCC_OscInitStruct.PLL.PLLR = 2;
282
   RCC_OscInitStruct.PLL.PLLR = 2;
283
   ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
283
   ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
284
-  
285
-  if(ret != HAL_OK)myshow(10,-1);
284
+
285
+  if (ret != HAL_OK) myshow(10,-1);
286
   HAL_PWREx_EnableOverDrive();
286
   HAL_PWREx_EnableOverDrive();
287
- 
287
+
288
   /* Select PLLSAI output as USB clock source */
288
   /* Select PLLSAI output as USB clock source */
289
   PeriphClkInitStruct.PLLSAI.PLLSAIM = 8;
289
   PeriphClkInitStruct.PLLSAI.PLLSAIM = 8;
290
   PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
290
   PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
291
   PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
291
   PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
292
   PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO;
292
   PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO;
293
   PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP;
293
   PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP;
294
-  PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;//SDIO Clock Mux
294
+  PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48; // SDIO Clock Mux
295
   HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
295
   HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
296
 
296
 
297
-  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 
298
-     clocks dividers */
297
+  /* Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 clocks dividers */
299
   RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
298
   RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
300
   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
299
   RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
301
   RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
300
   RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
302
-  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;  
303
-  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;  
301
+  RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
302
+  RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
304
   ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
303
   ret = HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
305
-  if(ret != HAL_OK)myshow(10,-1);
304
+  if (ret != HAL_OK) myshow(10,-1);
306
 
305
 
307
-  SystemCoreClockUpdate();//更新系统时钟SystemCoreClock
308
-  /**Configure the Systick interrupt time
309
-  */
306
+  SystemCoreClockUpdate();
307
+  /* Configure the Systick interrupt time */
310
   HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
308
   HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
311
 
309
 
312
-  /**Configure the Systick
313
-  */
310
+  /* Configure the Systick */
314
   HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
311
   HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
315
 
312
 
316
   /* SysTick_IRQn interrupt configuration */
313
   /* SysTick_IRQn interrupt configuration */
317
   HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
314
   HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
318
-  __enable_irq();//打开中断,因为在bootloader中关闭了,所以这里要打开
315
+  __enable_irq(); // Turn on the interrupt here because it is turned off in the bootloader
319
 }
316
 }
317
+
320
 #ifdef __cplusplus
318
 #ifdef __cplusplus
321
 }
319
 }
322
 #endif
320
 #endif

+ 3
- 2
buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h Ver fichero

24
 #endif // __cplusplus
24
 #endif // __cplusplus
25
 
25
 
26
 extern unsigned long myvar[];
26
 extern unsigned long myvar[];
27
-void myshow(int fre,int times);
28
-void debugStr(const char*str);
27
+void myshow(int fre, int times);
28
+void debugStr(const char *str);
29
+
29
 /*----------------------------------------------------------------------------
30
 /*----------------------------------------------------------------------------
30
  *        Pins
31
  *        Pins
31
  *----------------------------------------------------------------------------*/
32
  *----------------------------------------------------------------------------*/

+ 2
- 2
buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c Ver fichero

76
   {PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1        Fan2
76
   {PA_0,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1        Fan2
77
   {PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2        Fan1
77
   {PA_1,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2        Fan1
78
   {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3        Fan0
78
   {PA_2,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 3, 0)}, // TIM5_CH3        Fan0
79
-  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4        HE2 
80
-  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1        Servo 
79
+  {PA_3,  TIM5,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM5, 4, 0)}, // TIM5_CH4        HE2
80
+  {PA_8,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1        Servo
81
   {PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N       HE1
81
   {PB_0,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N       HE1
82
   {PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N       HE0
82
   {PB_1,  TIM1,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N       HE0
83
   {PB_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4        BEEPER
83
   {PB_2,  TIM2,   STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4        BEEPER

+ 1
- 1
buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h Ver fichero

32
 #ifdef __cplusplus
32
 #ifdef __cplusplus
33
 extern "C" {
33
 extern "C" {
34
 #endif // __cplusplus
34
 #endif // __cplusplus
35
-// 
35
+//
36
 /*----------------------------------------------------------------------------
36
 /*----------------------------------------------------------------------------
37
  *        Pins
37
  *        Pins
38
  *----------------------------------------------------------------------------*/
38
  *----------------------------------------------------------------------------*/

Loading…
Cancelar
Guardar