aboutsummaryrefslogtreecommitdiff
path: root/apps/px4io/px4io.h
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2012-12-31 21:06:26 -0800
committerpx4dev <px4@purgatory.org>2012-12-31 21:06:26 -0800
commitd93fda20fd55746923d607e717f254bc92741eab (patch)
tree6582460c7145785e55507430fea523cd2c0157e6 /apps/px4io/px4io.h
parent9be1f999357edd37658c301d9dd5aaa1d8db26a7 (diff)
downloadpx4-firmware-d93fda20fd55746923d607e717f254bc92741eab.tar.gz
px4-firmware-d93fda20fd55746923d607e717f254bc92741eab.tar.bz2
px4-firmware-d93fda20fd55746923d607e717f254bc92741eab.zip
Add ADC measurements and reporting to PX4IO, including calibration for the battery input.
Diffstat (limited to 'apps/px4io/px4io.h')
-rw-r--r--apps/px4io/px4io.h28
1 files changed, 20 insertions, 8 deletions
diff --git a/apps/px4io/px4io.h b/apps/px4io/px4io.h
index 6221b08f2..af06c6ec1 100644
--- a/apps/px4io/px4io.h
+++ b/apps/px4io/px4io.h
@@ -105,17 +105,25 @@ struct sys_state_s
bool fmu_data_received;
/*
- * Current serial interface mode, per the serial_rx_mode parameter
- * in the config packet.
+ * Measured battery voltage in mV
*/
- uint8_t serial_rx_mode;
+ uint16_t battery_mv;
+
+ /*
+ * ADC IN5 measurement
+ */
+ uint16_t adc_in5;
+
+ /*
+ * Power supply overcurrent status bits.
+ */
+ uint8_t overcurrent;
+
};
extern struct sys_state_s system_state;
-extern int frame_rx;
-extern int frame_bad;
-
+#if 0
/*
* Software countdown timers.
*
@@ -127,6 +135,7 @@ extern int frame_bad;
#define TIMER_SANITY 7
#define TIMER_NUM_TIMERS 8
extern volatile int timers[TIMER_NUM_TIMERS];
+#endif
/*
* GPIO handling.
@@ -141,10 +150,13 @@ extern volatile int timers[TIMER_NUM_TIMERS];
#define POWER_RELAY1(_s) stm32_gpiowrite(GPIO_RELAY1_EN, (_s))
#define POWER_RELAY2(_s) stm32_gpiowrite(GPIO_RELAY2_EN, (_s))
-#define OVERCURRENT_ACC stm32_gpioread(GPIO_ACC_OC_DETECT)
-#define OVERCURRENT_SERVO stm32_gpioread(GPIO_SERVO_OC_DETECT
+#define OVERCURRENT_ACC (!stm32_gpioread(GPIO_ACC_OC_DETECT))
+#define OVERCURRENT_SERVO (!stm32_gpioread(GPIO_SERVO_OC_DETECT))
#define BUTTON_SAFETY stm32_gpioread(GPIO_BTN_SAFETY)
+#define ADC_VBATT 4
+#define ADC_IN5 5
+
/*
* Mixer
*/