Skip to content

Commit 9fcb975

Browse files
committed
[bsp][Infineon]修复psoc6-evaluationkit-062S2调用rt_adc_disable()时报错的问题
1 parent 8f83543 commit 9fcb975

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bsp/Infineon/libraries/HAL_Drivers/drv_adc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static rt_err_t ifx_adc_enabled(struct rt_adc_device *device, rt_uint32_t channe
5353
if (enabled)
5454
{
5555
/* Initialize ADC. The ADC block which can connect to pin 10[0] is selected */
56-
result = cyhal_adc_init(&adc_obj, VPLUS_CHANNEL_0, NULL);
56+
result = cyhal_adc_init(&adc_obj, channel, NULL);
5757

5858
if (result != RT_EOK)
5959
{
@@ -62,7 +62,7 @@ static rt_err_t ifx_adc_enabled(struct rt_adc_device *device, rt_uint32_t channe
6262
}
6363

6464
/* Initialize a channel 0 and configure it to scan P10_0 in single ended mode. */
65-
result = cyhal_adc_channel_init_diff(adc_ch, &adc_obj, VPLUS_CHANNEL_0,
65+
result = cyhal_adc_channel_init_diff(adc_ch, &adc_obj, channel,
6666
CYHAL_ADC_VNEG, &channel_config);
6767

6868
if (result != RT_EOK)
@@ -82,8 +82,8 @@ static rt_err_t ifx_adc_enabled(struct rt_adc_device *device, rt_uint32_t channe
8282
}
8383
else
8484
{
85-
cyhal_adc_free(&adc_obj);
8685
cyhal_adc_channel_free(adc_ch);
86+
cyhal_adc_free(&adc_obj);
8787
}
8888

8989
return RT_EOK;

0 commit comments

Comments
 (0)