aboutsummaryrefslogtreecommitdiffstats
path: root/src/glutt-o-logique
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2016-09-18 19:11:18 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2016-09-18 19:11:18 +0200
commit52529249d2f618fdf2b13ed05f53669eead266a6 (patch)
treebbf11527520c2247e1904c32c15d457d45378606 /src/glutt-o-logique
parent7bdd512ff73b43ba51b182dde2a999a11bd70828 (diff)
downloadglutte-o-matic-52529249d2f618fdf2b13ed05f53669eead266a6.tar.gz
glutte-o-matic-52529249d2f618fdf2b13ed05f53669eead266a6.tar.bz2
glutte-o-matic-52529249d2f618fdf2b13ed05f53669eead266a6.zip
Move v_ref to toplevel of analog_input
Diffstat (limited to 'src/glutt-o-logique')
-rw-r--r--src/glutt-o-logique/analog_input.c4
1 files changed, 2 insertions, 2 deletions
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 <math.h>
#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);