summaryrefslogtreecommitdiff
path: root/components/drivers/misc
diff options
context:
space:
mode:
authorChen Wang <[email protected]>2025-06-09 10:38:31 +0800
committerRbb666 <[email protected]>2025-06-10 14:21:46 +0800
commitae86c6e8bbd026890456330898b59cc54d5354a6 (patch)
tree60c68c289dc270e4da30f88d6e34fa457d6f06b4 /components/drivers/misc
parent719cc90b02b9dae40043f7c3f77fd3d3f66fa3a5 (diff)
componnets: drivers: adc: remove build warnings
gcc build warnings: cast from pointer to integer of different size [-Wpointer-to-int-cast] For rt_adc_ops.enabled, the type of second param is rt_int8_t, original _adc_control also called with wrong type casting. Convert first to rt_base_t, then cast to rt_int8_t to remove the build warnings. Signed-off-by: Chen Wang <[email protected]>
Diffstat (limited to 'components/drivers/misc')
-rw-r--r--components/drivers/misc/adc.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/components/drivers/misc/adc.c b/components/drivers/misc/adc.c
index f5d7d52c04..3a00127752 100644
--- a/components/drivers/misc/adc.c
+++ b/components/drivers/misc/adc.c
@@ -45,14 +45,13 @@ static rt_err_t _adc_control(rt_device_t dev, int cmd, void *args)
rt_adc_device_t adc = (struct rt_adc_device *)dev;
rt_err_t result;
-
if (cmd == RT_ADC_CMD_ENABLE && adc->ops->enabled)
{
- result = adc->ops->enabled(adc, (rt_uint32_t)args, RT_TRUE);
+ result = adc->ops->enabled(adc, (rt_int8_t)(rt_base_t)args, RT_TRUE);
}
else if (cmd == RT_ADC_CMD_DISABLE && adc->ops->enabled)
{
- result = adc->ops->enabled(adc, (rt_uint32_t)args, RT_FALSE);
+ result = adc->ops->enabled(adc, (rt_int8_t)(rt_base_t)args, RT_FALSE);
}
else if (cmd == RT_ADC_CMD_GET_RESOLUTION && adc->ops->get_resolution && args)
{