# hw definition file for processing by chibios_pins.py
# for iFlight Beast H7 v2 hardware, based on Beast H7 v1
# thanks to betaflight for pin information

include ../BeastH7/hwdef.dat
undef APJ_BOARD_ID
undef HAL_SERIAL3_PROTOCOL
undef IMU
undef BARO
undef PD15
undef PE9 PE11 PB8 PB9 PB11 PB10 PA10 PA9 PA3 PA2
undef HAL_DEFAULT_INS_FAST_SAMPLE DMA_PRIORITY DMA_NOSHARE
undef STM32_PWM_USE_ADVANCED
undef I2C1

# board ID for firmware load
APJ_BOARD_ID 1056

# V2 has different motor mapping
PB4 TIM3_CH1 TIM3 PWM(2) GPIO(51) BIDIR   # 2
PB5 TIM3_CH2 TIM3 PWM(3) GPIO(52)         # 3

I2C_ORDER I2C1 I2C2
define HAL_I2C_INTERNAL_MASK 0

# order of UARTs (and USB)
SERIAL_ORDER OTG1 USART1 USART2 USART3 UART4 EMPTY EMPTY UART7

# Buzzer - DMA timer channel use by LEDs
PD2 BUZZER OUTPUT GPIO(80) LOW

# USART1 (DJI)
PA10 USART1_RX USART1
PA9  USART1_TX USART1 NODMA

# USART2 (DJI RCIN)
PA3 USART2_RX USART2
PA2 USART2_TX USART2 NODMA
define HAL_SERIAL2_PROTOCOL SerialProtocol_RCIN

# USART3 (RCIN)
PB11 USART3_RX USART3
PB10 USART3_TX USART3

# I2C1 for baro
PB8 I2C1_SCL I2C1 PULLUP
PB9 I2C1_SDA I2C1 PULLUP

# I2C2 for compass. These pins can also be used as USART3
PB10 I2C2_SCL I2C2 ALT(1)
PB11 I2C2_SDA I2C2 ALT(1)

# spi devices
SPIDEV bmi270    SPI1 DEVID1 MPU6000_CS  MODE3 10*MHZ 10*MHZ

# no built-in compass and no external I2C so no compass
define HAL_PROBE_EXTERNAL_I2C_COMPASSES

# one IMU
IMU BMI270 SPI:bmi270 ROTATION_ROLL_180_YAW_225

# Some boards have no baro, some have a DPS310 Baro on I2C1
define HAL_BARO_ALLOW_INIT_NO_BARO 1
BARO DPS310 I2C:0:0x76
