/*==============================================================================
Generated on: 2025-03-24 13:58:26.623161
Generated by: betaflight_target_converter.py
Source: https://github.com/betaflight/unified-targets
Board name: STACKX
Manufacturer ID: LEGA

//copy this line to madflight.ino to use this flight controller
#include <madflight_zzz_LEGA-STACKX.h>

Note: madflight will pick the last sensor defined here, this might not be the sensor that is actually on the board. Comment the offending sensors out.
==============================================================================*/

#define HAL_BOARD_NAME "BETAFLIGHT-LEGA-STACKX"
#define HAL_MCU "STM32F405"

#define MADFLIGHT_BOARD R""(
imu_gizmo MPU6500 // #define USE_GYRO_SPI_MPU6500
// resource BEEPER 1 C15
pin_out0 PB8 // resource MOTOR 1 B08
pin_out1 PA2 // resource MOTOR 2 A02
pin_out2 PA15 // resource MOTOR 3 A15
pin_out3 PA3 // resource MOTOR 4 A03
pin_rcl_ppm PB0 // resource PPM 1 B00
// resource LED_STRIP 1 A00
pin_ser0_tx PA9 // resource SERIAL_TX 1 A09
pin_ser2_tx PB10 // resource SERIAL_TX 3 B10
pin_ser5_tx PC6 // resource SERIAL_TX 6 C06
pin_ser0_rx PA10 // resource SERIAL_RX 1 A10
pin_ser2_rx PB11 // resource SERIAL_RX 3 B11
pin_ser5_rx PC7 // resource SERIAL_RX 6 C07
pin_ser5_inv PC8 // resource INVERTER 6 C08
pin_led PC13 // resource LED 1 C13
// resource LED 2 C14
pin_spi0_sclk PA5 // resource SPI_SCK 1 A05
pin_spi1_sclk PB13 // resource SPI_SCK 2 B13
pin_spi2_sclk PC10 // resource SPI_SCK 3 C10
pin_spi0_miso PA6 // resource SPI_MISO 1 A06
pin_spi1_miso PC2 // resource SPI_MISO 2 C02
pin_spi2_miso PC11 // resource SPI_MISO 3 C11
pin_spi0_mosi PA7 // resource SPI_MOSI 1 A07
pin_spi1_mosi PC3 // resource SPI_MOSI 2 C03
pin_spi2_mosi PC12 // resource SPI_MOSI 3 C12
// resource ESCSERIAL 1 B00
pin_bat_v PC0 // resource ADC_BATT 1 C00
bat_gizmo ADC
// resource ADC_RSSI 1 C01
pin_bat_i PA1 // resource ADC_CURR 1 A01
bat_gizmo ADC
pin_bbx_cs PB9 // resource SDCARD_CS 1 B09
bbx_gizmo SDSPI
// resource SDCARD_DETECT 1 B07
// resource FLASH_CS 1 D02
// resource OSD_CS 1 B12
pin_imu_int PC4 // resource GYRO_EXTI 1 C04
pin_imu_cs PA4 // resource GYRO_CS 1 A04
// resource USB_DETECT 1 A08
// resource VTX_CS 1 B03
// resource VTX_DATA 1 B05
// resource VTX_CLK 1 B04
// set blackbox_device = SDCARD
// set current_meter = ADC
// set battery_meter = ADC
// set beeper_inversion = ON
// set beeper_od = OFF
// set sdcard_detect_inverted = ON
// set sdcard_mode = SPI
bbx_spi_bus 2 // set sdcard_spi_bus = 3
// set system_hse_mhz = 8
// set max7456_spi_bus = 2
// set flash_spi_bus = 3
// set gyro_1_bustype = SPI
imu_spi_bus 0 // set gyro_1_spibus = 1
imu_align CW90 // set gyro_1_sensor_align = CW90
// set gyro_1_align_yaw = 900
)"" //end of MADFLIGHT_BOARD


/*
#==============================================================================
# BetaFlight Source file
#==============================================================================
# Betaflight / STM32F405 (S405) 4.2.0 Mar  5 2020 / 22:29:55 (c29b125a59) MSP API: 1.43

#define USE_ACC
#define USE_ACC_SPI_MPU6500
#define USE_GYRO
#define USE_GYRO_SPI_MPU6500
#define USE_MAX7456
#define USE_SDCARD

board_name STACKX
manufacturer_id LEGA

# resources
resource BEEPER 1 C15
resource MOTOR 1 B08
resource MOTOR 2 A02
resource MOTOR 3 A15
resource MOTOR 4 A03
resource PPM 1 B00
resource LED_STRIP 1 A00
resource SERIAL_TX 1 A09
resource SERIAL_TX 3 B10
resource SERIAL_TX 6 C06
resource SERIAL_RX 1 A10
resource SERIAL_RX 3 B11
resource SERIAL_RX 6 C07
resource INVERTER 6 C08
resource LED 1 C13
resource LED 2 C14
resource SPI_SCK 1 A05
resource SPI_SCK 2 B13
resource SPI_SCK 3 C10
resource SPI_MISO 1 A06
resource SPI_MISO 2 C02
resource SPI_MISO 3 C11
resource SPI_MOSI 1 A07
resource SPI_MOSI 2 C03
resource SPI_MOSI 3 C12
resource ESCSERIAL 1 B00
resource ADC_BATT 1 C00
resource ADC_RSSI 1 C01
resource ADC_CURR 1 A01
resource SDCARD_CS 1 B09
resource SDCARD_DETECT 1 B07
resource FLASH_CS 1 D02
resource OSD_CS 1 B12
resource GYRO_EXTI 1 C04
resource GYRO_CS 1 A04
resource USB_DETECT 1 A08
resource VTX_CS 1 B03
resource VTX_DATA 1 B05
resource VTX_CLK 1 B04

# timer
timer B00 AF2
# pin B00: TIM3 CH3 (AF2)
timer B08 AF2
# pin B08: TIM4 CH3 (AF2)
timer A02 AF1
# pin A02: TIM2 CH3 (AF1)
timer A15 AF1
# pin A15: TIM2 CH1 (AF1)
timer A03 AF1
# pin A03: TIM2 CH4 (AF1)
timer A00 AF2
# pin A00: TIM5 CH1 (AF2)

# dma
dma SPI_TX 3 0
# SPI_TX 3: DMA1 Stream 5 Channel 0
dma ADC 1 1
# ADC 1: DMA2 Stream 4 Channel 0
dma pin B00 0
# pin B00: DMA1 Stream 7 Channel 5
dma pin B08 0
# pin B08: DMA1 Stream 7 Channel 2
dma pin A02 0
# pin A02: DMA1 Stream 1 Channel 3
dma pin A15 0
# pin A15: DMA1 Stream 5 Channel 3
dma pin A03 1
# pin A03: DMA1 Stream 6 Channel 3
dma pin A00 0
# pin A00: DMA1 Stream 2 Channel 6

# feature
feature OSD

# master
set blackbox_device = SDCARD
set current_meter = ADC
set battery_meter = ADC
set beeper_inversion = ON
set beeper_od = OFF
set sdcard_detect_inverted = ON
set sdcard_mode = SPI
set sdcard_spi_bus = 3
set system_hse_mhz = 8
set max7456_spi_bus = 2
set flash_spi_bus = 3
set gyro_1_bustype = SPI
set gyro_1_spibus = 1
set gyro_1_sensor_align = CW90
set gyro_1_align_yaw = 900

*/
