Skip to content

Commit 9be1554

Browse files
committed
🎨 Misc. variant cleanup, translation
Followup to MarlinFirmware#24787
1 parent b244785 commit 9be1554

File tree

5 files changed

+57
-58
lines changed

5 files changed

+57
-58
lines changed

buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/hal_conf_custom.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ in voltage and temperature. */
411411
#endif /* HAL_SPI_MODULE_ENABLED */
412412

413413
#ifdef HAL_TIM_MODULE_ENABLED
414-
#include "stm32f4xx_hal_tim.h"
414+
#include "stm32f4xx_hal_tim.h"
415415
#endif /* HAL_TIM_MODULE_ENABLED */
416416

417417
#ifdef HAL_UART_MODULE_ENABLED

buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.cpp

+50-52
Original file line numberDiff line numberDiff line change
@@ -170,69 +170,69 @@ extern "C" {
170170
#endif
171171

172172
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
174174
{
175175
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) {
186186
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();
189189
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--;
193193
}
194194
}
195195

196196
HAL_StatusTypeDef SDMMC_IsProgramming(SDIO_TypeDef *SDIOx,uint32_t RCA)
197197
{
198198
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;
201201
do {
202202
sdmmc_cmdinit.Argument = RCA << 16;
203203
sdmmc_cmdinit.CmdIndex = SDMMC_CMD_SEND_STATUS;
204204
sdmmc_cmdinit.Response = SDIO_RESPONSE_SHORT;
205205
sdmmc_cmdinit.WaitForInterrupt = SDIO_WAIT_NO;
206206
sdmmc_cmdinit.CPSM = SDIO_CPSM_ENABLE;
207-
SDIO_SendCommand(SDIOx,&sdmmc_cmdinit);//发送CMD13
207+
SDIO_SendCommand(SDIOx,&sdmmc_cmdinit); // send CMD13
208208
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
213212
return HAL_ERROR;
214213
}
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
218216
return HAL_ERROR;
219217
}
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
222220
respR1 = SDIOx->RESP1;
223221
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));
225223
return HAL_OK;
226224
}
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+
}
232231
}
232+
233233
/**
234234
* @brief System Clock Configuration
235-
* The system Clock is configured as follow :
235+
* The system Clock is configured as follows:
236236
* System Clock source = PLL (HSE)
237237
* SYSCLK(Hz) = 168000000/120000000/180000000
238238
* HCLK(Hz) = 168000000/120000000/180000000
@@ -265,8 +265,8 @@ WEAK void SystemClock_Config(void)
265265
/* Enable Power Control clock */
266266
__HAL_RCC_PWR_CLK_ENABLE();
267267

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
270270
regarding system frequency refer to product datasheet. */
271271
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
272272

@@ -281,42 +281,40 @@ WEAK void SystemClock_Config(void)
281281
RCC_OscInitStruct.PLL.PLLQ = 7;
282282
RCC_OscInitStruct.PLL.PLLR = 2;
283283
ret = HAL_RCC_OscConfig(&RCC_OscInitStruct);
284-
285-
if(ret != HAL_OK)myshow(10,-1);
284+
285+
if (ret != HAL_OK) myshow(10,-1);
286286
HAL_PWREx_EnableOverDrive();
287-
287+
288288
/* Select PLLSAI output as USB clock source */
289289
PeriphClkInitStruct.PLLSAI.PLLSAIM = 8;
290290
PeriphClkInitStruct.PLLSAI.PLLSAIN = 192;
291291
PeriphClkInitStruct.PLLSAI.PLLSAIP = RCC_PLLSAIP_DIV4;
292292
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_CLK48 | RCC_PERIPHCLK_SDIO;
293293
PeriphClkInitStruct.Clk48ClockSelection = RCC_CK48CLKSOURCE_PLLSAIP;
294-
PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48;//SDIO Clock Mux
294+
PeriphClkInitStruct.SdioClockSelection = RCC_SDIOCLKSOURCE_CLK48; // SDIO Clock Mux
295295
HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct);
296296

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 */
299298
RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2);
300299
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
301300
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;
304303
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);
306305

307-
SystemCoreClockUpdate();//更新系统时钟SystemCoreClock
308-
/**Configure the Systick interrupt time
309-
*/
306+
SystemCoreClockUpdate();
307+
/* Configure the Systick interrupt time */
310308
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq() / 1000);
311309

312-
/**Configure the Systick
313-
*/
310+
/* Configure the Systick */
314311
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
315312

316313
/* SysTick_IRQn interrupt configuration */
317314
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
319316
}
317+
320318
#ifdef __cplusplus
321319
}
322320
#endif

buildroot/share/PlatformIO/variants/MARLIN_F446Zx_TRONXY/variant.h

+3-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ extern "C" {
2424
#endif // __cplusplus
2525

2626
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+
2930
/*----------------------------------------------------------------------------
3031
* Pins
3132
*----------------------------------------------------------------------------*/

buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/PeripheralPins.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,8 @@ WEAK const PinMap PinMap_PWM[] = {
7676
{PA_0, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 1, 0)}, // TIM2_CH1 Fan2
7777
{PA_1, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 2, 0)}, // TIM2_CH2 Fan1
7878
{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
8181
{PB_0, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 2, 1)}, // TIM1_CH2N HE1
8282
{PB_1, TIM1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 1)}, // TIM1_CH3N HE0
8383
{PB_2, TIM2, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM2, 4, 0)}, // TIM2_CH4 BEEPER

buildroot/share/PlatformIO/variants/MARLIN_MKS_SKIPR_V1/variant.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#ifdef __cplusplus
3333
extern "C" {
3434
#endif // __cplusplus
35-
//
35+
//
3636
/*----------------------------------------------------------------------------
3737
* Pins
3838
*----------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)