]> rtime.felk.cvut.cz Git - pes-rpp/rpp-test-sw.git/blobdiff - rpp-test-sw/commands/cmd_adc.c
Fix HDK ADC voltage conversion
[pes-rpp/rpp-test-sw.git] / rpp-test-sw / commands / cmd_adc.c
index e6a621d69b93ccebf7735a337c3aac40a21605ab..4a389eabd95094c0572cb9e74be8ab6f0fefa1b2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2013 Czech Technical University in Prague
+ * Copyright (C) 2012-2015 Czech Technical University in Prague
  *
  * Created on: 28.2.2013
  *
@@ -28,7 +28,7 @@
 
 static double lsb2volts(unsigned lsb)
 {
-       return ((double)lsb + 0.0)*2.5/4095*10;
+       return ((double)lsb + 0.0)*2.5/4095*2;
 }
 
 
@@ -69,21 +69,19 @@ int cmd_do_adc_watch(cmd_io_t *cmd_io, const struct cmd_des *des, char *param[])
        int i;
 
        rpp_sci_printf("ADC Inputs Test [0-15]:\r\n");
-       rpp_sci_printf("=======================================================================\r\n");
+       rpp_sci_printf("===============================================================================================\r\n");
 
        for (i = 0; i < 16; i++)
                rpp_sci_printf("%5d ", i);
        rpp_sci_printf("\n");
 
-       for (i = 1; i < 13; i++)
-               rpp_sci_printf("%5d ", i);
-       rpp_sci_printf("\n");
-
        // Calculate wait time in OS ticks
        static const portTickType freq_ticks = 100 /* ms */ / portTICK_RATE_MS;
        portTickType last_wake_time = xTaskGetTickCount();
 
        while (cmd_io->getc(cmd_io) < 0) {
+        // Update inputs
+        rpp_adc_update();
 
                for (i = 0; i < 16; i++)
                        rpp_sci_printf("%5d ", rpp_adc_get(i+1));