#define HAS_PAD_REPORT 1
/* Beeper is on pio0_1 ct32b0_mat2 */
-#define BEEPER_PORT 0
-#define BEEPER_PIN 1
-#define BEEPER_TIMER 0
-#define BEEPER_OUTPUT 2
+#define AO_LPC_BEEP_PORT 0
+#define AO_LPC_BEEP_PIN 1
+#define AO_LPC_BEEP_TIMER 0
+#define AO_LPC_BEEP_CHANNEL 2
#define HAS_RADIO 0
#define HAS_TELEMETRY 0
#define AO_DATA_RING 32
-struct ao_adc {
- int16_t v_batt;
- int16_t motor_pressure;
-};
#define AO_ADC_DUMP(p) \
printf("tick: %5lu batt: %5d motor_pressure: %5d\n", \
#define HAS_IMU 1
#define USE_ADXL375_IMU 1
+#define HAS_KALMAN 0
+
/* Motor pressure */
#define HAS_MOTOR_PRESSURE 1
#define ao_data_motor_pressure(packet) ((packet)->adc.motor_pressure)
typedef int16_t motor_pressure_t;
+/* want about 50psi, or 344kPa */
+
+#define AO_FULL_SCALE_PRESSURE 11031612 /* 1600psi */
+#define AO_BOOST_DETECT_PRESSURE 344000 /* 50psi */
+#define AO_QUIET_DETECT_PRESSURE 207000 /* 30psi */
+
+static inline int16_t ao_delta_pressure_to_adc(uint32_t pressure)
+{
+ static const double volts_base = 0.5;
+ static const double volts_max = 4.5;
+
+ /* Compute change in voltage from the sensor */
+ double volts = (double) pressure / AO_FULL_SCALE_PRESSURE * (volts_max - volts_base);
+
+ /* voltage divider in front of the ADC input to decivolts */
+ double adc_dv = volts * 10 * 10.0/15.6;
+
+ /* convert to ADC output value */
+ double adc = adc_dv * AO_ADC_MAX / AO_ADC_REFERENCE_DV;
+
+ if (adc > AO_ADC_MAX)
+ adc = AO_ADC_MAX;
+ if (adc < 0)
+ adc = 0;
+
+ return (int16_t) adc;
+}
+
+#define AO_BOOST_DETECT ao_delta_pressure_to_adc(AO_BOOST_DETECT_PRESSURE)
+#define AO_QUIET_DETECT ao_delta_pressure_to_adc(AO_QUIET_DETECT_PRESSURE)
+
+struct ao_adc {
+ int16_t v_batt;
+ int16_t motor_pressure;
+};
+
#endif /* _AO_PINS_H_ */