mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 19:07:45 +08:00
onmibus-f4sd: add ADC support
This commit is contained in:
@@ -280,6 +280,8 @@ then
|
|||||||
hmc5883 -X start
|
hmc5883 -X start
|
||||||
|
|
||||||
bmp280 start
|
bmp280 start
|
||||||
|
|
||||||
|
adc start
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ver hwcmp PX4FMU_V4PRO
|
if ver hwcmp PX4FMU_V4PRO
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ set(config_module_list
|
|||||||
drivers/px4fmu
|
drivers/px4fmu
|
||||||
drivers/rgbled
|
drivers/rgbled
|
||||||
drivers/stm32
|
drivers/stm32
|
||||||
#drivers/stm32/adc
|
drivers/stm32/adc
|
||||||
#drivers/stm32/tone_alarm
|
#drivers/stm32/tone_alarm
|
||||||
modules/sensors
|
modules/sensors
|
||||||
|
|
||||||
|
|||||||
@@ -371,7 +371,7 @@ CONFIG_STM32_HAVE_TIM14=y
|
|||||||
CONFIG_STM32_HAVE_ADC2=y
|
CONFIG_STM32_HAVE_ADC2=y
|
||||||
CONFIG_STM32_HAVE_ADC3=y
|
CONFIG_STM32_HAVE_ADC3=y
|
||||||
# CONFIG_STM32_HAVE_ADC4 is not set
|
# CONFIG_STM32_HAVE_ADC4 is not set
|
||||||
# CONFIG_STM32_HAVE_ADC1_DMA is not set
|
CONFIG_STM32_HAVE_ADC1_DMA=y
|
||||||
# CONFIG_STM32_HAVE_ADC2_DMA is not set
|
# CONFIG_STM32_HAVE_ADC2_DMA is not set
|
||||||
# CONFIG_STM32_HAVE_ADC3_DMA is not set
|
# CONFIG_STM32_HAVE_ADC3_DMA is not set
|
||||||
# CONFIG_STM32_HAVE_ADC4_DMA is not set
|
# CONFIG_STM32_HAVE_ADC4_DMA is not set
|
||||||
@@ -408,7 +408,7 @@ CONFIG_STM32_HAVE_I2S3=y
|
|||||||
# CONFIG_STM32_HAVE_OPAMP2 is not set
|
# CONFIG_STM32_HAVE_OPAMP2 is not set
|
||||||
# CONFIG_STM32_HAVE_OPAMP3 is not set
|
# CONFIG_STM32_HAVE_OPAMP3 is not set
|
||||||
# CONFIG_STM32_HAVE_OPAMP4 is not set
|
# CONFIG_STM32_HAVE_OPAMP4 is not set
|
||||||
# CONFIG_STM32_ADC1 is not set
|
CONFIG_STM32_ADC1=y
|
||||||
# CONFIG_STM32_ADC2 is not set
|
# CONFIG_STM32_ADC2 is not set
|
||||||
# CONFIG_STM32_ADC3 is not set
|
# CONFIG_STM32_ADC3 is not set
|
||||||
CONFIG_STM32_BKPSRAM=y
|
CONFIG_STM32_BKPSRAM=y
|
||||||
@@ -460,6 +460,7 @@ CONFIG_STM32_UART4=y
|
|||||||
CONFIG_STM32_USART6=y
|
CONFIG_STM32_USART6=y
|
||||||
# CONFIG_STM32_IWDG is not set
|
# CONFIG_STM32_IWDG is not set
|
||||||
CONFIG_STM32_WWDG=y
|
CONFIG_STM32_WWDG=y
|
||||||
|
CONFIG_STM32_ADC=y
|
||||||
CONFIG_STM32_SPI=y
|
CONFIG_STM32_SPI=y
|
||||||
CONFIG_STM32_I2C=y
|
CONFIG_STM32_I2C=y
|
||||||
# CONFIG_STM32_NOEXT_VECTORS is not set
|
# CONFIG_STM32_NOEXT_VECTORS is not set
|
||||||
@@ -488,6 +489,9 @@ CONFIG_STM32_DMACAPABLE=y
|
|||||||
# CONFIG_STM32_TIM1_PWM is not set
|
# CONFIG_STM32_TIM1_PWM is not set
|
||||||
# CONFIG_STM32_TIM3_PWM is not set
|
# CONFIG_STM32_TIM3_PWM is not set
|
||||||
# CONFIG_STM32_TIM5_PWM is not set
|
# CONFIG_STM32_TIM5_PWM is not set
|
||||||
|
# CONFIG_STM32_TIM1_ADC is not set
|
||||||
|
# CONFIG_STM32_TIM3_ADC is not set
|
||||||
|
# CONFIG_STM32_TIM5_ADC is not set
|
||||||
# CONFIG_STM32_TIM1_CAP is not set
|
# CONFIG_STM32_TIM1_CAP is not set
|
||||||
# CONFIG_STM32_TIM3_CAP is not set
|
# CONFIG_STM32_TIM3_CAP is not set
|
||||||
# CONFIG_STM32_TIM4_CAP is not set
|
# CONFIG_STM32_TIM4_CAP is not set
|
||||||
@@ -499,6 +503,12 @@ CONFIG_STM32_DMACAPABLE=y
|
|||||||
# CONFIG_STM32_TIM12_CAP is not set
|
# CONFIG_STM32_TIM12_CAP is not set
|
||||||
# CONFIG_STM32_TIM13_CAP is not set
|
# CONFIG_STM32_TIM13_CAP is not set
|
||||||
# CONFIG_STM32_TIM14_CAP is not set
|
# CONFIG_STM32_TIM14_CAP is not set
|
||||||
|
|
||||||
|
#
|
||||||
|
# ADC Configuration
|
||||||
|
#
|
||||||
|
# CONFIG_STM32_ADC_NO_STARTUP_CONV is not set
|
||||||
|
# CONFIG_STM32_ADC1_DMA is not set
|
||||||
CONFIG_STM32_USART=y
|
CONFIG_STM32_USART=y
|
||||||
CONFIG_STM32_SERIALDRIVER=y
|
CONFIG_STM32_SERIALDRIVER=y
|
||||||
|
|
||||||
|
|||||||
@@ -69,26 +69,16 @@
|
|||||||
*
|
*
|
||||||
* These are the channel numbers of the ADCs of the microcontroller that can be used by the Px4 Firmware in the adc driver
|
* These are the channel numbers of the ADCs of the microcontroller that can be used by the Px4 Firmware in the adc driver
|
||||||
*/
|
*/
|
||||||
// TODO: ADCs, eg. pixracer
|
#define ADC_CHANNELS (1 << 0) | (1 << 11) | (1 << 12)
|
||||||
//#define ADC_CHANNELS (1 << 2) | (1 << 3) | (1 << 4) | (1 << 10) | (1 << 11) | (1 << 12) | (1 << 13) | (1 << 14)
|
|
||||||
|
|
||||||
// Placeholder
|
#define ADC_BATTERY_VOLTAGE_CHANNEL 12
|
||||||
#define ADC_BATTERY_VOLTAGE_CHANNEL ((uint8_t)(-1))
|
#define ADC_BATTERY_CURRENT_CHANNEL 11
|
||||||
#define ADC_BATTERY_CURRENT_CHANNEL ((uint8_t)(-1))
|
#define ADC_RC_RSSI_CHANNEL 0
|
||||||
#define ADC_AIRSPEED_VOLTAGE_CHANNEL ((uint8_t)(-1))
|
|
||||||
|
|
||||||
// TODO: ADCs
|
|
||||||
//#define ADC_BATTERY_VOLTAGE_CHANNEL 2
|
|
||||||
//#define ADC_BATTERY_CURRENT_CHANNEL 3
|
|
||||||
//#define ADC_5V_RAIL_SENSE 4
|
|
||||||
//#define ADC_RC_RSSI_CHANNEL 11
|
|
||||||
|
|
||||||
/* Define Battery 1 Voltage Divider and A per V
|
/* Define Battery 1 Voltage Divider and A per V
|
||||||
*/
|
*/
|
||||||
|
#define BOARD_BATTERY1_V_DIV (11.12f)
|
||||||
// TODO:
|
#define BOARD_BATTERY1_A_PER_V (31.f)
|
||||||
//#define BOARD_BATTERY1_V_DIV (13.653333333f)
|
|
||||||
//#define BOARD_BATTERY1_A_PER_V (36.367515152f)
|
|
||||||
|
|
||||||
/* User GPIOs
|
/* User GPIOs
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -185,12 +185,10 @@ stm32_boardinitialize(void)
|
|||||||
board_autoled_initialize();
|
board_autoled_initialize();
|
||||||
|
|
||||||
|
|
||||||
//TODO: ADCs
|
/* configure ADC pins */
|
||||||
///* configure ADC pins */
|
stm32_configgpio(GPIO_ADC1_IN12); /* BATT_VOLTAGE_SENS */
|
||||||
//stm32_configgpio(GPIO_ADC1_IN2); /* BATT_VOLTAGE_SENS */
|
stm32_configgpio(GPIO_ADC1_IN11); /* BATT_CURRENT_SENS */
|
||||||
//stm32_configgpio(GPIO_ADC1_IN3); /* BATT_CURRENT_SENS */
|
stm32_configgpio(GPIO_ADC1_IN0); /* RSSI analog in */
|
||||||
//stm32_configgpio(GPIO_ADC1_IN4); /* VDD_5V_SENS */
|
|
||||||
//stm32_configgpio(GPIO_ADC1_IN11); /* RSSI analog in */
|
|
||||||
|
|
||||||
// TODO: power peripherals
|
// TODO: power peripherals
|
||||||
///* configure power supply control/sense pins */
|
///* configure power supply control/sense pins */
|
||||||
|
|||||||
Reference in New Issue
Block a user