mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-23 20:57:20 +08:00
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 <unicorn_wang@outlook.com>
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user