Skip to content

Commit

Permalink
Add IFLIGHT_BLITZ_F7_AIO target (iNavFlight#8977)
Browse files Browse the repository at this point in the history
This is the only fc I have on my fleet that does not have an INAV target

MCU is F745 with 1mb flash.

Baro and gyro ok.
Font upload ok.
Led strip ok. (built in led on the bottom is addressable)
M1-M4 works with DSHOOT600.
Board alignment ok.
Blackbox ok. (Needed SPI3_*_AF for it to work)
1st flight ok

Should work for a few different FC by iFlight, like the iFlight BLITZ Whoop AIO and the Defender 25 F7 AIO.
  • Loading branch information
mmosca authored and sensei-hacker committed Oct 4, 2023
1 parent 806f7da commit 063abb4
Show file tree
Hide file tree
Showing 6 changed files with 267 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/boards/IFLIGHT_BLITZ_F7_AIO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This target should work for boards using the same target in BetaFlight, like the iFlight BLITZ Whoop AIO and the Defender 25 F7 AIO.

# Hardware
- STM32F745
- Baro
- Blackbox
- Compatible with STMF745 based boards from iFlight that use `IFLIGHT_BLITZ_F7_AIO` target in BetaFlight. The target maps more outputs than usually are available on the board.

1 change: 1 addition & 0 deletions src/main/io/ledstrip.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#include "config/parameter_group.h"
#include "common/color.h"
#include "rx/rx.h"

#define LED_MAX_STRIP_LENGTH 32
#define LED_CONFIGURABLE_COLOR_COUNT 16
Expand Down
1 change: 1 addition & 0 deletions src/main/target/IFLIGHT_BLITZ_F7_AIO/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target_stm32f745xg(IFLIGHT_BLITZ_F7_AIO)
19 changes: 19 additions & 0 deletions src/main/target/IFLIGHT_BLITZ_F7_AIO/config.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdbool.h>
#include <stdint.h>

#include <platform.h>

#include "io/serial.h"
#include "io/ledstrip.h"

#include "sensors/boardalignment.h"

void targetConfiguration(void)
{
// UART1 is in the plug for vtx
serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(SERIAL_PORT_USART1)].functionMask = FUNCTION_MSP_OSD;

boardAlignmentMutable()->yawDeciDegrees = 1350;

DEFINE_LED(ledStripConfigMutable()->ledConfigs, 0, 0, COLOR_GREEN, 0, LED_FUNCTION_ARM_STATE, LED_FLAG_OVERLAY(LED_OVERLAY_WARNING), 0);
}
49 changes: 49 additions & 0 deletions src/main/target/IFLIGHT_BLITZ_F7_AIO/target.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* This file is part of INAV Project.
*
* INAV Project is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* INAV Project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with INAV Project. If not, see <http://www.gnu.org/licenses/>.
*/

#include <stdint.h>

#include "platform.h"

#include "drivers/bus.h"
#include "drivers/io.h"
#include "drivers/pwm_mapping.h"
#include "drivers/timer.h"
#include "drivers/pinio.h"
#include "drivers/sensor.h"

//BUSDEV_REGISTER_SPI_TAG(busdev_bmi270, DEVHW_BMI270, BMI270_SPI_BUS, BMI270_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_BMI270_ALIGN);
//BUSDEV_REGISTER_SPI_TAG(busdev_icm42605, DEVHW_ICM42605, ICM42605_SPI_BUS, ICM42605_CS_PIN, NONE, 0, DEVFLAGS_NONE, IMU_ICM42605_ALIGN);

timerHardware_t timerHardware[] = {
DEF_TIM(TIM2, CH2, PB3, TIM_USE_PPM, 0, 0), // PPM

DEF_TIM(TIM3, CH1, PB4, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 0), // S1
DEF_TIM(TIM3, CH3, PB0, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 0), // S2
DEF_TIM(TIM3, CH2, PB5, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 0), // S3
DEF_TIM(TIM3, CH4, PB1, TIM_USE_MC_MOTOR | TIM_USE_FW_MOTOR, 0, 0), // S4
DEF_TIM(TIM1, CH1, PE9, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S5
DEF_TIM(TIM1, CH2, PE11, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S6
DEF_TIM(TIM1, CH3, PE13, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S7
DEF_TIM(TIM1, CH4, PE14, TIM_USE_MC_MOTOR | TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S8
DEF_TIM(TIM4, CH1, PB6, TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S9
DEF_TIM(TIM4, CH2, PB7, TIM_USE_MC_SERVO | TIM_USE_FW_SERVO, 0, 0), // S10

DEF_TIM(TIM8, CH4, PC9, TIM_USE_LED, 0, 0), // LED
};

const int timerHardwareCount = sizeof(timerHardware) / sizeof(timerHardware[0]);
189 changes: 189 additions & 0 deletions src/main/target/IFLIGHT_BLITZ_F7_AIO/target.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
/*
* This file is part of INAV Project.
*
* INAV Project is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* INAV Project is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with INAV Project. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#define TARGET_BOARD_IDENTIFIER "IB7A"

#define USBD_PRODUCT_STRING "IFLIGHT_BLITZ_F7_AIO"

#define LED0 PD15

#define BEEPER PD3
#define BEEPER_INVERTED

// ******************* SPI *************************
#define USE_SPI

#define USE_SPI_DEVICE_1
#define SPI1_SCK_PIN PA5
#define SPI1_MISO_PIN PA6
#define SPI1_MOSI_PIN PA7
#define SPI1_NSS_PIN PA4

#define USE_SPI_DEVICE_2
#define SPI2_SCK_PIN PB13
#define SPI2_MISO_PIN PB14
#define SPI2_MOSI_PIN PB15

#define USE_SPI_DEVICE_3
#define SPI3_SCK_PIN PC10
#define SPI3_SCK_AF GPIO_AF6_SPI3
#define SPI3_MISO_PIN PC11
#define SPI3_MISO_AF GPIO_AF6_SPI3
#define SPI3_MOSI_PIN PD6
#define SPI3_MOSI_AF GPIO_AF5_SPI3
#define SPI3_NSS_PIN PA15

#define USE_SPI_DEVICE_4
#define SPI4_SCK_PIN PE2
#define SPI4_MISO_PIN PE5
#define SPI4_MOSI_PIN PE6
#define SPI4_NSS_PIN PE4


// *************** Gyro & ACC **********************

#define USE_IMU_BMI270
#define IMU_BMI270_ALIGN CW0_DEG
#define BMI270_SPI_BUS BUS_SPI1
#define BMI270_CS_PIN SPI1_NSS_PIN

#define USE_IMU_ICM42605
#define IMU_ICM42605_ALIGN CW0_DEG
#define ICM42605_SPI_BUS BUS_SPI1
#define ICM42605_CS_PIN SPI1_NSS_PIN

// *************** I2C/Baro/Mag *********************
#define USE_I2C
#define USE_I2C_DEVICE_1
#define I2C1_SCL PB8
#define I2C1_SDA PB9

#define USE_I2C_DEVICE_4
#define I2C2_SCL PD12
#define I2C2_SDA PD13

#define USE_BARO
#define BARO_I2C_BUS BUS_I2C4
#define USE_BARO_BMP280
#define USE_BARO_DPS310

#define USE_MAG
#define MAG_I2C_BUS BUS_I2C1
#define USE_MAG_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_IST8310
#define USE_MAG_IST8308
#define USE_MAG_MAG3110
#define USE_MAG_LIS3MDL

#define TEMPERATURE_I2C_BUS BUS_I2C1
#define PITOT_I2C_BUS BUS_I2C1

// *************** Blackbox **************************

#define USE_FLASHFS
#define USE_FLASH_M25P16

#define M25P16_SPI_BUS BUS_SPI3
#define M25P16_CS_PIN SPI3_NSS_PIN
//#define M25P16_SPI_SHARED

#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT

// *************** OSD *****************************

#define USE_MAX7456
#define MAX7456_SPI_BUS BUS_SPI4
#define MAX7456_CS_PIN SPI4_NSS_PIN

// *************** UART *****************************
#define USE_VCP

#define USE_UART1
#define UART1_RX_PIN PA10
#define UART1_TX_PIN PA9

#define USE_UART2
#define UART2_RX_PIN PA3
#define UART2_TX_PIN PA2

#define USE_UART3
#define UART3_RX_PIN PB11
#define UART3_TX_PIN PB10

#define USE_UART4
#define UART4_RX_PIN PA1
#define UART4_TX_PIN PA0

#define USE_UART5
#define UART5_RX_PIN PD2
#define UART5_TX_PIN PC12

#define USE_UART6
#define UART6_RX_PIN PC7
#define UART6_TX_PIN PC6

#define USE_UART7
#define UART7_RX_PIN PE7
#define UART7_TX_PIN PE8

#define USE_UART8
#define UART8_RX_PIN PE0
#define UART8_TX_PIN PE1

#define SERIAL_PORT_COUNT 9

#define DEFAULT_RX_TYPE RX_TYPE_SERIAL
#define SERIALRX_PROVIDER SERIALRX_CRSF
#define SERIALRX_UART SERIAL_PORT_USART3

// *************** ADC *****************************
#define USE_ADC
#define ADC_INSTANCE ADC1
#define ADC1_DMA_STREAM DMA2_Stream0
#define ADC_CHANNEL_1_PIN PC3
#define ADC_CHANNEL_2_PIN PC2
#define ADC_CHANNEL_3_PIN PC5
#define ADC_CHANNEL_4_PIN PC1
#define VBAT_ADC_CHANNEL ADC_CHN_1
#define CURRENT_METER_ADC_CHANNEL ADC_CHN_2
#define RSSI_ADC_CHANNEL ADC_CHN_3
#define AIRSPEED_ADC_CHANNEL ADC_CHN_4
#define CURRENT_METER_SCALE 200

#define USE_RANGEFINDER
#define RANGEFINDER_I2C_BUS BUS_I2C1

#define DEFAULT_FEATURES (FEATURE_TX_PROF_SEL | FEATURE_CURRENT_METER | FEATURE_TELEMETRY | FEATURE_VBAT | FEATURE_OSD | FEATURE_BLACKBOX | FEATURE_LED_STRIP )

#define USE_LED_STRIP
#define WS2811_PIN PC9

#define USE_SERIAL_4WAY_BLHELI_INTERFACE

#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff
#define TARGET_IO_PORTC 0xffff
#define TARGET_IO_PORTD 0xffff
#define TARGET_IO_PORTE 0xffff
#define TARGET_IO_PORTF 0xffff

#define MAX_PWM_OUTPUT_PORTS 10
#define USE_DSHOT
#define USE_ESC_SENSOR

0 comments on commit 063abb4

Please sign in to comment.