From: Michal Sojka Date: Mon, 25 Apr 2016 15:19:27 +0000 (+0200) Subject: adc: Use board-dependent function for LSB-to-Volts conversion X-Git-Url: http://rtime.felk.cvut.cz/gitweb/rpp-test-sw.git/commitdiff_plain/fa2cfd449604fc7bad66afce79b5e9c2ca31725b adc: Use board-dependent function for LSB-to-Volts conversion Fixes #1605 --- diff --git a/rpp-test-sw/commands/cmd_adc.c b/rpp-test-sw/commands/cmd_adc.c index 9cdd168..1f56f47 100644 --- a/rpp-test-sw/commands/cmd_adc.c +++ b/rpp-test-sw/commands/cmd_adc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012-2015 Czech Technical University in Prague + * Copyright (C) 2012-2016 Czech Technical University in Prague * * Created on: 28.2.2013 * @@ -26,12 +26,6 @@ #include #include "drv/port.h" -static double lsb2volts(unsigned lsb) -{ - return ((double)lsb + 0.0)*2.5/4095*2; -} - - /** * @brief Read values from ADC port * @@ -58,7 +52,7 @@ int cmd_do_read_adc1_values(cmd_io_t *cmd_io, const struct cmd_des *des, char *p } for (i = min; i <= max; i++) { unsigned d = rpp_adc_get(i+1); - double v = lsb2volts(d); + double v = port_adc_lsb2volts(d); rpp_sci_printf("ADC%-2d %4d lsb ~ %5.2f V\n", i, d, v); } return 0; @@ -90,7 +84,7 @@ int cmd_do_adc_watch(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[]) rpp_sci_printf("%5d ", rpp_adc_get(i+1)); rpp_sci_printf("lsb\n"); for (i = 0; i < PORT_ADC_CHANNELS; i++) - rpp_sci_printf("%5.2f ", lsb2volts(rpp_adc_get(i+1))); + rpp_sci_printf("%5.2f ", port_adc_lsb2volts(rpp_adc_get(i+1))); rpp_sci_printf("V\r\033[A"); /* Cursor up */