mirror of
https://xff.cz/git/u-boot/
synced 2025-09-05 10:42:10 +02:00
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: Fabrice Gasnier <fabrice.gasnier@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
committed by
Tom Rini
parent
1c84d904a5
commit
c56fc49a60
@@ -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,
|
static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
|
||||||
char *const argv[])
|
char *const argv[])
|
||||||
{
|
{
|
||||||
|
struct udevice *dev;
|
||||||
unsigned int data;
|
unsigned int data;
|
||||||
int ret;
|
int ret, uV;
|
||||||
|
|
||||||
if (argc < 3)
|
if (argc < 3)
|
||||||
return CMD_RET_USAGE;
|
return CMD_RET_USAGE;
|
||||||
@@ -85,6 +86,10 @@ static int do_adc_single(cmd_tbl_t *cmdtp, int flag, int argc,
|
|||||||
return CMD_RET_FAILURE;
|
return CMD_RET_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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);
|
printf("%u\n", data);
|
||||||
|
|
||||||
return CMD_RET_SUCCESS;
|
return CMD_RET_SUCCESS;
|
||||||
|
Reference in New Issue
Block a user