Moved ADC channel defines for battery voltage, battery current, and airspeed voltage to board_config.h. This allows better portabilit of code from one board to another, since it removes the hardcoded #ifdef sections from the Px4 sensors code.

This commit is contained in:
ksschwabe
2015-07-17 14:09:52 +02:00
parent a17310bf33
commit e1572d3942
4 changed files with 20 additions and 18 deletions
@@ -119,6 +119,11 @@ __BEGIN_DECLS
*/
#define ADC_CHANNELS (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13)
// ADC defines to be used in sensors.cpp to read from a particular channel
#define ADC_BATTERY_VOLTAGE_CHANNEL 10
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
#define ADC_AIRSPEED_VOLTAGE_CHANNEL ((uint8_t)(-1))
/* PWM
*
* Eight PWM outputs are configured.
@@ -127,6 +127,11 @@ __BEGIN_DECLS
*/
#define ADC_CHANNELS (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13)
// ADC defines to be used in sensors.cpp to read from a particular channel
#define ADC_BATTERY_VOLTAGE_CHANNEL 10
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
#define ADC_AIRSPEED_VOLTAGE_CHANNEL 11
/* User GPIOs
*
* GPIO0-1 are the buffered high-power GPIOs.
@@ -153,6 +153,12 @@ __BEGIN_DECLS
*/
#define ADC_CHANNELS (1 << 2) | (1 << 3) | (1 << 4) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14) | (1 << 15)
// ADC defines to be used in sensors.cpp to read from a particular channel
#define ADC_BATTERY_VOLTAGE_CHANNEL 2
#define ADC_BATTERY_CURRENT_CHANNEL 3
#define ADC_5V_RAIL_SENSE 4
#define ADC_AIRSPEED_VOLTAGE_CHANNEL 15
/* User GPIOs
*
* GPIO0-5 are the PWM servo outputs.