+/* Resistor values needed for various voltage test ratios:
+ *
+ * Net names involved:
+ *
+ * V_BATT Battery power, after the initial power switch
+ * V_PYRO Pyro power, after the pyro power switch (and initial power switch)
+ * PYRO_SENSE ADC input to sense V_PYRO voltage
+ * BATT_SENSE ADC input to sense V_BATT voltage
+ * IGNITER FET output to pad (the other pad lead hooks to V_PYRO)
+ * IGNITER_SENSE ADC input to sense igniter voltage
+ *
+ * AO_PAD_R_V_BATT_BATT_SENSE Resistor from battery rail to battery sense input
+ * AO_PAD_R_BATT_SENSE_GND Resistor from battery sense input to ground
+ *
+ * AO_PAD_R_V_BATT_V_PYRO Resistor from battery rail to pyro rail
+ * AO_PAD_R_V_PYRO_PYRO_SENSE Resistor from pyro rail to pyro sense input
+ * AO_PAD_R_PYRO_SENSE_GND Resistor from pyro sense input to ground
+ *
+ * AO_PAD_R_V_PYRO_IGNITER Optional resistors from pyro rail to FET igniter output
+ * AO_PAD_R_IGNITER_IGNITER_SENSE Resistors from FET igniter output to igniter sense ADC inputs
+ * AO_PAD_R_IGNITER_SENSE_GND Resistors from igniter sense ADC inputs to ground
+ */
+
+static int16_t
+ao_pad_decivolt(int16_t adc, int16_t r_plus, int16_t r_minus)
+{
+ int32_t mul = (int32_t) AO_ADC_REFERENCE_DV * (r_plus + r_minus);
+ int32_t div = (int32_t) AO_ADC_MAX * r_minus;
+ return ((int32_t) adc * mul + mul/2) / div;
+}
+