提交 c56fc49a 编写于 作者: F Fabrice Gasnier 提交者: Tom Rini

cmd: adc: print single conversion also in uV

Use newly introduced adc_raw_to_uV() API to print conversion result
both as raw value and micro-volts by default.
Signed-off-by: NFabrice Gasnier <fabrice.gasnier@st.com>
Reviewed-by: NSimon Glass <sjg@chromium.org>
上级 1c84d904
......@@ -71,8 +71,9 @@ static int do_adc_info(cmd_tbl_t *cmdtp, int flag, int argc,
static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
char *const argv[])
{
struct udevice *dev;
unsigned int data;
int ret;
int ret, uV;
if (argc < 3)
return CMD_RET_USAGE;
......@@ -85,7 +86,11 @@ static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
return CMD_RET_FAILURE;
}
printf("%u\n", data);
ret = uclass_get_device_by_name(UCLASS_ADC, argv[1], &dev);
if (!ret && !adc_raw_to_uV(dev, data, &uV))
printf("%u, %d uV\n", data, uV);
else
printf("%u\n", data);
return CMD_RET_SUCCESS;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册