Skip to content

Commit 9b05fc5

Browse files
authored
[bsp/stm32]fix compile warning (#10108)
* [bsp/stm32]fix compile warning
1 parent fbe6563 commit 9b05fc5

File tree

5 files changed

+40
-36
lines changed

5 files changed

+40
-36
lines changed

bsp/stm32/libraries/HAL_Drivers/drivers/drv_adc.c

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2023, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -199,19 +199,19 @@ static rt_err_t stm32_adc_enabled(struct rt_adc_device *device, rt_int8_t channe
199199
HAL_PWREx_EnableVddA();
200200
#endif /* defined(SOC_SERIES_STM32U5) */
201201

202-
if(HAL_ADC_ConfigChannel(stm32_adc_handler, &ADC_ChanConf) != HAL_OK)
203-
{
204-
LOG_E("Failed to configure ADC channel %d", channel);
205-
return -RT_ERROR;
206-
}
202+
if(HAL_ADC_ConfigChannel(stm32_adc_handler, &ADC_ChanConf) != HAL_OK)
203+
{
204+
LOG_E("Failed to configure ADC channel %d", channel);
205+
return -RT_ERROR;
206+
}
207207

208208
/* perform an automatic ADC calibration to improve the conversion accuracy */
209209
#if defined(SOC_SERIES_STM32L4) || defined (SOC_SERIES_STM32WB)
210-
if (HAL_ADCEx_Calibration_Start(stm32_adc_handler, ADC_ChanConf.SingleDiff) != HAL_OK)
211-
{
212-
LOG_E("ADC calibration error!\n");
213-
return -RT_ERROR;
214-
}
210+
if (HAL_ADCEx_Calibration_Start(stm32_adc_handler, ADC_ChanConf.SingleDiff) != HAL_OK)
211+
{
212+
LOG_E("ADC calibration error!\n");
213+
return -RT_ERROR;
214+
}
215215
#elif defined(SOC_SERIES_STM32MP1) || defined(SOC_SERIES_STM32H7) || defined(SOC_SERIES_STM32U5)
216216
/* Run the ADC linear calibration in single-ended mode */
217217
if (HAL_ADCEx_Calibration_Start(stm32_adc_handler, ADC_CALIB_OFFSET_LINEARITY, ADC_ChanConf.SingleDiff) != HAL_OK)
@@ -225,10 +225,10 @@ static rt_err_t stm32_adc_enabled(struct rt_adc_device *device, rt_int8_t channe
225225
else
226226
{
227227
if (HAL_ADC_Stop(stm32_adc_handler) != HAL_OK)
228-
{
229-
LOG_E("Stop ADC conversion failed!\n");
230-
return -RT_ERROR;
231-
}
228+
{
229+
LOG_E("Stop ADC conversion failed!\n");
230+
return -RT_ERROR;
231+
}
232232
}
233233

234234
return RT_EOK;
@@ -277,19 +277,19 @@ static rt_err_t stm32_adc_get_value(struct rt_adc_device *device, rt_int8_t chan
277277
RT_ASSERT(value != RT_NULL);
278278

279279
stm32_adc_handler = device->parent.user_data;
280-
281-
if (HAL_ADC_Start(stm32_adc_handler) != HAL_OK)
282-
{
283-
LOG_E("Start ADC conversion error!\n");
284-
return -RT_ERROR;
285-
}
280+
281+
if (HAL_ADC_Start(stm32_adc_handler) != HAL_OK)
282+
{
283+
LOG_E("Start ADC conversion error!\n");
284+
return -RT_ERROR;
285+
}
286286

287287
/* Wait for the ADC to convert */
288288
if (HAL_ADC_PollForConversion(stm32_adc_handler, 100) != RT_EOK)
289-
{
290-
LOG_E("ADC conversion error!\n");
291-
return -RT_ERROR;
292-
}
289+
{
290+
LOG_E("ADC conversion error!\n");
291+
return -RT_ERROR;
292+
}
293293

294294
/* get ADC value */
295295
*value = (rt_uint32_t)HAL_ADC_GetValue(stm32_adc_handler);
@@ -306,15 +306,15 @@ static rt_int16_t stm32_adc_get_vref (struct rt_adc_device *device)
306306

307307
ADC_HandleTypeDef *stm32_adc_handler = device->parent.user_data;
308308

309-
ret = stm32_adc_enabled(device, RT_ADC_INTERN_CH_VREF, RT_TRUE);
310-
if (ret != RT_EOK)
311-
return 0;
309+
ret = stm32_adc_enabled(device, RT_ADC_INTERN_CH_VREF, RT_TRUE);
310+
if (ret != RT_EOK)
311+
return 0;
312312
ret = stm32_adc_get_value(device, RT_ADC_INTERN_CH_VREF, &vref_value);
313-
if (ret != RT_EOK)
314-
return 0;
313+
if (ret != RT_EOK)
314+
return 0;
315315
ret = stm32_adc_enabled(device, RT_ADC_INTERN_CH_VREF, RT_FALSE);
316-
if (ret != RT_EOK)
317-
return 0;
316+
if (ret != RT_EOK)
317+
return 0;
318318

319319
#ifdef SOC_SERIES_STM32U5
320320
vref_mv = __LL_ADC_CALC_VREFANALOG_VOLTAGE(stm32_adc_handler->Instance, vref_value, stm32_adc_handler->Init.Resolution);
@@ -341,7 +341,7 @@ static int stm32_adc_init(void)
341341
int result = RT_EOK;
342342
/* save adc name */
343343
char name_buf[5] = {'a', 'd', 'c', '0', 0};
344-
int i = 0;
344+
rt_uint32_t i = 0;
345345

346346
for (i = 0; i < sizeof(adc_config) / sizeof(adc_config[0]); i++)
347347
{

bsp/stm32/libraries/HAL_Drivers/drivers/drv_flash/drv_flash_f4.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ const struct fal_flash_dev stm32_onchip_flash_16k =
388388
fal_flash_erase_16k,
389389
},
390390
8,
391+
{},
391392
};
392393
const struct fal_flash_dev stm32_onchip_flash_64k =
393394
{
@@ -402,6 +403,7 @@ const struct fal_flash_dev stm32_onchip_flash_64k =
402403
fal_flash_erase_64k,
403404
},
404405
8,
406+
{},
405407
};
406408
const struct fal_flash_dev stm32_onchip_flash_128k =
407409
{
@@ -416,6 +418,7 @@ const struct fal_flash_dev stm32_onchip_flash_128k =
416418
fal_flash_erase_128k,
417419
},
418420
8,
421+
{},
419422
};
420423

421424
static int fal_flash_read_16k(long offset, rt_uint8_t *buf, size_t size)

bsp/stm32/libraries/HAL_Drivers/drivers/drv_gpio.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2006-2023, RT-Thread Development Team
2+
* Copyright (c) 2006-2025, RT-Thread Development Team
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*
@@ -524,6 +524,7 @@ static const struct rt_pin_ops _stm32_pin_ops =
524524
stm32_pin_dettach_irq,
525525
stm32_pin_irq_enable,
526526
stm32_pin_get,
527+
RT_NULL,
527528
};
528529

529530
rt_inline void pin_irq_hdr(int irqno)

bsp/stm32/libraries/HAL_Drivers/drivers/drv_tim.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim)
858858

859859
static int stm32_hwtimer_init(void)
860860
{
861-
int i = 0;
861+
rt_uint32_t i = 0;
862862
int result = RT_EOK;
863863

864864
for (i = 0; i < sizeof(stm32_hwtimer_obj) / sizeof(stm32_hwtimer_obj[0]); i++)

bsp/stm32/libraries/HAL_Drivers/drivers/drv_usart_v2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,7 @@ int rt_hw_usart_init(void)
13151315
rt_size_t obj_num = sizeof(uart_obj) / sizeof(struct stm32_uart);
13161316

13171317
stm32_uart_get_config();
1318-
for (int i = 0; i < obj_num; i++)
1318+
for (rt_uint32_t i = 0; i < obj_num; i++)
13191319
{
13201320
/* init UART object */
13211321
uart_obj[i].config = &uart_config[i];

0 commit comments

Comments
 (0)