Skip to content

Commit 5507cb9

Browse files
committed
[Driver][MISC][ADC] Fixup ADC
1. Fixup error no. 2. Fixup type of control for args. 3. Fixup value no init. Signed-off-by: GuEe-GUI <[email protected]>
1 parent a774ea7 commit 5507cb9

File tree

1 file changed

+2
-2
lines changed
  • components/drivers/misc

1 file changed

+2
-2
lines changed

components/drivers/misc/adc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ static rt_ssize_t _adc_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_size
4343
static rt_err_t _adc_control(rt_device_t dev, int cmd, void *args)
4444
{
4545
rt_adc_device_t adc = (struct rt_adc_device *)dev;
46-
rt_err_t result = RT_ERROR;
46+
rt_err_t result = -RT_ERROR;
4747

4848
if (cmd == RT_ADC_CMD_ENABLE && adc->ops->enabled)
4949
{
@@ -167,7 +167,7 @@ rt_int16_t rt_adc_voltage(rt_adc_device_t dev, rt_int8_t channel)
167167
RT_ASSERT(dev);
168168

169169
rt_uint32_t value;
170-
rt_int16_t vref, voltage;
170+
rt_int16_t vref, voltage = 0;
171171
rt_uint8_t resolution;
172172
rt_err_t result;
173173

0 commit comments

Comments
 (0)