~toykeeper/flashlight-firmware/trunk

« back to all changes in this revision

Viewing changes to ToyKeeper/spaghetti-monster/fsm-adc.c

  • Committer: Selene Scriven
  • Date: 2020-03-06 00:51:27 UTC
  • mto: (188.18.5 k1-12v)
  • mto: This revision was merged to the branch mainline in revision 238.
  • Revision ID: bzr@toykeeper.net-20200306005127-abyx28mwvfwlhye4
initial support for Noctigon KR4
  (not complete, but far enough that it installs and runs)
New hardware support features:
  - allow using PCINT other than 0 (PCINT1, PCINT2, etc)
  - option to ignore voltage ADC while the button is pressed
    (because my prototype shorts the voltage divider to 0 while the button is down)

Show diffs side-by-side

added added

removed removed

Lines of Context:
206
206
    #define LVP_TIMER_START (VOLTAGE_WARNING_SECONDS*ADC_CYCLES_PER_SECOND)  // N seconds between LVP warnings
207
207
    #define LVP_LOWPASS_STRENGTH ADC_CYCLES_PER_SECOND  // lowpass for one second
208
208
 
 
209
    #ifdef NO_LVP_WHILE_BUTTON_PRESSED
 
210
    // don't run if button is currently being held
 
211
    // (because the button causes a reading of zero volts)
 
212
    if (button_last_state) return;
 
213
    #endif
 
214
 
209
215
    uint16_t measurement = adc_values[0];  // latest 10-bit ADC reading
210
216
 
211
217
    #ifdef USE_VOLTAGE_LOWPASS