mirror of https://github.com/RT-Thread/rt-thread
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:
parent
719cc90b02
commit
ae86c6e8bb
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue