mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-16 03:23:57 -03:00
AP_HAL_ChibiOS: create and use AP_PERIPH_BATTERY_ENABLED
... and AP_PERIPH_BATTERY_BALANCE_ENABLED while we're here
This commit is contained in:
parent
8e4179cc9d
commit
a8717fe6a2
@ -50,7 +50,7 @@ PA0 CELL5 ADC1 SCALE(10) ANALOG(5)
|
||||
PA1 CELL6 ADC1 SCALE(10) ANALOG(6)
|
||||
|
||||
# setup as a battery balance plug monitor
|
||||
define HAL_PERIPH_ENABLE_BATTERY_BALANCE
|
||||
define AP_PERIPH_BATTERY_BALANCE_ENABLED 1
|
||||
define AP_PERIPH_BATTERY_BALANCE_NUMCELLS_DEFAULT 6
|
||||
define AP_PERIPH_BATTERY_BALANCE_RATE_DEFAULT 2
|
||||
define AP_PERIPH_BATTERY_BALANCE_CELL1_PIN_DEFAULT 1
|
||||
|
@ -16,7 +16,7 @@ PB6 USART1_TX USART1 SPEED_HIGH
|
||||
PB7 USART1_RX USART1 SPEED_HIGH
|
||||
|
||||
# BATTERY
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
|
||||
define HAL_USE_ADC TRUE
|
||||
define STM32_ADC_USE_ADC1 TRUE
|
||||
|
@ -39,7 +39,7 @@ define HAL_USE_RTC FALSE
|
||||
|
||||
define HAL_BARO_ALLOW_INIT_NO_BARO
|
||||
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
|
||||
|
||||
define AP_SCRIPTING_ENABLED 0
|
||||
|
@ -16,7 +16,7 @@ env AP_PERIPH_HEAVY 1
|
||||
|
||||
|
||||
define AP_CAN_SLCAN_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define AP_PERIPH_GPS_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_MAG
|
||||
define HAL_PERIPH_ENABLE_BARO
|
||||
|
@ -16,7 +16,7 @@ env AP_PERIPH 1
|
||||
|
||||
|
||||
define AP_CAN_SLCAN_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define AP_PERIPH_GPS_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_MAG
|
||||
define HAL_PERIPH_ENABLE_BARO
|
||||
|
@ -84,7 +84,7 @@ PB8 I2C1_SCL I2C1
|
||||
PB9 I2C1_SDA I2C1
|
||||
|
||||
# ------------------ BATTERY Monitor -----------------------
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_DEVICE_TEMPERATURE
|
||||
define HAL_USE_ADC TRUE
|
||||
define STM32_ADC_USE_ADC1 TRUE
|
||||
|
@ -35,7 +35,7 @@ define HAL_BARO_ALLOW_INIT_NO_BARO
|
||||
|
||||
# ----------- I2C BATT_MONITOR INA2xx
|
||||
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define AP_BATTERY_INA2XX_ENABLED 1
|
||||
define HAL_BATT_MONITOR_DEFAULT 21
|
||||
|
||||
|
@ -23,7 +23,7 @@ define HAL_PERIPH_ENABLE_AIRSPEED
|
||||
define HAL_PERIPH_ENABLE_ADSB
|
||||
define HAL_PERIPH_ENABLE_RANGEFINDER
|
||||
define HAL_PERIPH_ENABLE_RC_OUT
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
|
||||
|
||||
# single GPS, compass and RF for peripherals
|
||||
|
@ -1,7 +1,7 @@
|
||||
include ../MatekL431/hwdef.inc
|
||||
|
||||
# enable battery monitor
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define AP_BATTERY_INA239_ENABLED 1
|
||||
define AP_BATTERY_INA239_SPI_DEVICE "INA23X"
|
||||
define HAL_BATT_MONITOR_DEFAULT 26
|
||||
|
@ -59,7 +59,7 @@ define HAL_MSP_ENABLED 1
|
||||
define AP_PERIPH_MSP_PORT_DEFAULT 1
|
||||
|
||||
# ------------------ BATTERY Monitor -----------------------
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
|
||||
define HAL_USE_ADC TRUE
|
||||
define STM32_ADC_USE_ADC1 TRUE
|
||||
|
@ -70,7 +70,7 @@ define HAL_PERIPH_GPS_PORT_DEFAULT 3
|
||||
define HAL_PERIPH_ENABLE_MAG
|
||||
define HAL_PERIPH_ENABLE_BARO
|
||||
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define HAL_PERIPH_ENABLE_RC_OUT
|
||||
|
||||
define HAL_PERIPH_ENABLE_RANGEFINDER
|
||||
|
@ -18,7 +18,7 @@ PB1 TIM3_CH4 TIM3 PWM(2) GPIO(3)
|
||||
define HAL_PERIPH_ENABLE_RC_OUT
|
||||
|
||||
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
PA1 BATT_VOLTAGE_SENS ADC1 SCALE(1)
|
||||
|
||||
define HAL_WITH_ESC_TELEM 1
|
||||
|
@ -181,7 +181,7 @@ define HAL_PERIPH_ENABLE_RANGEFINDER
|
||||
define AP_PERIPH_RANGEFINDER_PORT_DEFAULT -1
|
||||
|
||||
# ------------------ BATTERY Monitor -----------------------
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
|
||||
define HAL_USE_ADC TRUE
|
||||
define STM32_ADC_USE_ADC1 TRUE
|
||||
|
@ -156,14 +156,38 @@
|
||||
#define AP_RELAY_ENABLED 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* sanity checks that hwdefs are up-to-date in terms of how they are
|
||||
* trying to configure the peripheral:
|
||||
*/
|
||||
#ifdef HAL_PERIPH_ENABLE_GPS
|
||||
#error "Change 'define HAL_PERIPH_ENABLE_GPS' to 'define AP_PERIPH_GPS_ENABLED 1'"
|
||||
#endif
|
||||
#ifdef HAL_PERIPH_ENABLE_BATTERY
|
||||
#error "Change 'define HAL_PERIPH_ENABLE_BATTERY' to 'define AP_PERIPH_BATTERY_ENABLED 1'"
|
||||
#endif
|
||||
#ifdef HAL_PERIPH_ENABLE_BATTERY_BALANCE
|
||||
#error "Change 'define HAL_PERIPH_ENABLE_BATTERY_BALANCE' to 'define AP_PERIPH_BATTERY_BALANCE_ENABLED 1'"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* defaults for various AP_Periph features:
|
||||
*/
|
||||
#ifndef AP_PERIPH_BATTERY_ENABLED
|
||||
#define AP_PERIPH_BATTERY_ENABLED 0
|
||||
#endif
|
||||
#ifndef AP_PERIPH_BATTERY_BALANCE_ENABLED
|
||||
#define AP_PERIPH_BATTERY_BALANCE_ENABLED 0
|
||||
#endif
|
||||
#ifndef AP_PERIPH_GPS_ENABLED
|
||||
#define AP_PERIPH_GPS_ENABLED 0
|
||||
#endif
|
||||
|
||||
/*
|
||||
* turning on of ArduPilot features based on which AP_Periph features
|
||||
* are enabled:
|
||||
*/
|
||||
#define AP_BATTERY_ENABLED AP_PERIPH_BATTERY_ENABLED
|
||||
#define AP_GPS_ENABLED AP_PERIPH_GPS_ENABLED
|
||||
|
||||
/*
|
||||
@ -350,7 +374,6 @@
|
||||
#define AP_BATTERY_ESC_TELEM_OUTBOUND_ENABLED 0
|
||||
#endif
|
||||
|
||||
#define AP_BATTERY_ENABLED defined(HAL_PERIPH_ENABLE_BATTERY)
|
||||
#define AP_AHRS_ENABLED defined(HAL_PERIPH_ENABLE_AHRS)
|
||||
#define AP_COMPASS_ENABLED defined(HAL_PERIPH_ENABLE_MAG)
|
||||
#define AP_BARO_ENABLED defined(HAL_PERIPH_ENABLE_BARO)
|
||||
|
@ -83,7 +83,7 @@ define RELAY2_PIN_DEFAULT 5
|
||||
|
||||
|
||||
# battery
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define HAL_PERIPH_BATTERY_SKIP_NAME
|
||||
define HAL_USE_ADC TRUE
|
||||
define STM32_ADC_USE_ADC1 TRUE
|
||||
|
@ -107,7 +107,7 @@ COMPASS RM3100 I2C:1:0x22 false ROTATION_NONE
|
||||
COMPASS RM3100 I2C:1:0x23 false ROTATION_NONE
|
||||
|
||||
# battery
|
||||
define HAL_PERIPH_ENABLE_BATTERY
|
||||
define AP_PERIPH_BATTERY_ENABLED 1
|
||||
define HAL_PERIPH_BATTERY_SKIP_NAME # don't waste bandwidth on static names
|
||||
|
||||
define HAL_USE_ADC TRUE
|
||||
|
Loading…
Reference in New Issue
Block a user