From d93fda20fd55746923d607e717f254bc92741eab Mon Sep 17 00:00:00 2001 From: px4dev Date: Mon, 31 Dec 2012 21:06:26 -0800 Subject: Add ADC measurements and reporting to PX4IO, including calibration for the battery input. --- apps/px4io/px4io.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'apps/px4io/px4io.h') 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 */ -- cgit v1.2.3