aboutsummaryrefslogtreecommitdiff
path: root/spaghetti-monster/fsm-adc.h
diff options
context:
space:
mode:
authorSelene ToyKeeper2019-11-14 18:00:54 -0700
committerSelene ToyKeeper2019-11-14 18:00:54 -0700
commitae082e6331d75c2cbe339290fbce4e79c2aa2ede (patch)
treebec03d8c14d8036cb88bc61f4fb1beae9bff880e /spaghetti-monster/fsm-adc.h
parentstarted refactoring ADC code to split voltage and temperature into their own ... (diff)
downloadanduril-ae082e6331d75c2cbe339290fbce4e79c2aa2ede.tar.gz
anduril-ae082e6331d75c2cbe339290fbce4e79c2aa2ede.tar.bz2
anduril-ae082e6331d75c2cbe339290fbce4e79c2aa2ede.zip
fixed ADC code; measures and behaves correctly now, and is easier to read...
... but factory reset's auto-calibrate still doesn't get the right values for some reason (manual calibration works, but not auto)
Diffstat (limited to 'spaghetti-monster/fsm-adc.h')
-rw-r--r--spaghetti-monster/fsm-adc.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h
index 5f4d0c8..6e39750 100644
--- a/spaghetti-monster/fsm-adc.h
+++ b/spaghetti-monster/fsm-adc.h
@@ -40,7 +40,9 @@
#endif
volatile uint8_t irq_adc = 0; // ADC interrupt happened?
-uint16_t adc_value; // last ADC measurement
+volatile uint8_t irq_adc_stable = 0; // have we passed the 1st junk value yet?
+uint8_t adc_channel = 0; // 0=voltage, 1=temperature
+uint16_t adc_values[2]; // last ADC measurements (0=voltage, 1=temperature)
uint8_t adcint_enable = 0; // is the current ADC result needed?
void ADC_inner(); // do the actual ADC-related calculations