diff options
| author | Selene ToyKeeper | 2019-11-14 19:47:49 -0700 |
|---|---|---|
| committer | Selene ToyKeeper | 2019-11-14 19:47:49 -0700 |
| commit | 5362c032fdca4b20af49db0409a03524a396b815 (patch) | |
| tree | 1d437085b5b3472279167aee905385e39a4a1fe1 /spaghetti-monster/fsm-adc.h | |
| parent | merged from fsm branch to get safety ramp-down and version check functions, a... (diff) | |
| parent | merged irq-refactor branch, which fixes some small but long-standing issues: (diff) | |
| download | anduril-5362c032fdca4b20af49db0409a03524a396b815.tar.gz anduril-5362c032fdca4b20af49db0409a03524a396b815.tar.bz2 anduril-5362c032fdca4b20af49db0409a03524a396b815.zip | |
merged fsm updates / irq-refactor branch, to get more stable voltage readings
(and otherwise get recent bugfixes)
Diffstat (limited to 'spaghetti-monster/fsm-adc.h')
| -rw-r--r-- | spaghetti-monster/fsm-adc.h | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/spaghetti-monster/fsm-adc.h b/spaghetti-monster/fsm-adc.h index 274fb4d..6e39750 100644 --- a/spaghetti-monster/fsm-adc.h +++ b/spaghetti-monster/fsm-adc.h @@ -38,9 +38,18 @@ #define VOLTAGE_FUDGE_FACTOR 5 #endif #endif + +volatile uint8_t irq_adc = 0; // ADC interrupt happened? +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 + +static inline void ADC_voltage_handler(); volatile uint8_t voltage = 0; -volatile uint8_t adcint_enable; // kludge, because adc auto-retrigger won't turn off void low_voltage(); + #ifdef USE_BATTCHECK void battcheck(); #ifdef BATTCHECK_VpT @@ -50,7 +59,7 @@ void battcheck(); #define USE_BLINK_DIGIT #endif #endif -#endif +#endif // ifdef USE_LVP #ifdef USE_THERMAL_REGULATION @@ -79,7 +88,8 @@ int8_t therm_cal_offset = 0; //void low_temperature(); //void high_temperature(); volatile uint8_t reset_thermal_history = 1; -#endif +static inline void ADC_temperature_handler(); +#endif // ifdef USE_THERMAL_REGULATION inline void ADC_on(); |
