From 52529249d2f618fdf2b13ed05f53669eead266a6 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sun, 18 Sep 2016 19:11:18 +0200 Subject: Move v_ref to toplevel of analog_input --- src/glutt-o-logique/analog_input.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/glutt-o-logique/analog_input.c b/src/glutt-o-logique/analog_input.c index dba6673..baf8f9f 100644 --- a/src/glutt-o-logique/analog_input.c +++ b/src/glutt-o-logique/analog_input.c @@ -27,6 +27,8 @@ #include #include "GPIO/usart.h" +// Measured on the board itself +const float v_ref = 2.965f; void analog_init(void) { @@ -88,7 +90,6 @@ float analog_measure_12v(void) const uint16_t raw_value = analog_read_channel(ADC_CHANNEL_SUPPLY); const float adc_max_value = (1 << 12); - const float v_ref = 2.965f; // Convert ADC measurement to voltage float voltage = ((float)raw_value*v_ref/adc_max_value); @@ -104,7 +105,6 @@ int analog_measure_swr(int *forward_mv, int* reflected_mv) const uint16_t raw_swr_refl_value = analog_read_channel(ADC_CHANNEL_SWR_REFL); const float adc_max_value = (1 << 12); - const float v_ref = 2.965f; // Convert ADC measurement to mV (includes times 100 amplifier) const int swr_fwd = ((float)raw_swr_fwd_value*10.0f*v_ref/adc_max_value); -- cgit v1.2.3