From cfea76a54b88c069f7b57d2170525895c71c86bb Mon Sep 17 00:00:00 2001 From: Kaiowarez <60309480+Kaiowarez@users.noreply.github.com> Date: Thu, 31 Dec 2020 15:02:06 -0500 Subject: [PATCH] add target iflight f745 aio --- src/main/target/BETAFLIGHTF4/target.h | 9 +- src/main/target/IFLIGHT_F745_AIO/target.c | 48 +++++++ src/main/target/IFLIGHT_F745_AIO/target.h | 157 +++++++++++++++++++++ src/main/target/IFLIGHT_F745_AIO/target.mk | 12 ++ 4 files changed, 221 insertions(+), 5 deletions(-) create mode 100644 src/main/target/IFLIGHT_F745_AIO/target.c create mode 100644 src/main/target/IFLIGHT_F745_AIO/target.h create mode 100644 src/main/target/IFLIGHT_F745_AIO/target.mk diff --git a/src/main/target/BETAFLIGHTF4/target.h b/src/main/target/BETAFLIGHTF4/target.h index c3508959a8..93d8cd7b1d 100644 --- a/src/main/target/BETAFLIGHTF4/target.h +++ b/src/main/target/BETAFLIGHTF4/target.h @@ -74,7 +74,6 @@ #define USE_USB_DETECT #define USB_DETECT_PIN PC5 - #define USE_UART1 #define UART1_RX_PIN PA10 #define UART1_TX_PIN PA9 @@ -118,10 +117,10 @@ #define SPI3_MOSI_PIN PC12 #define USE_I2C -#define USE_I2C_DEVICE_2 -#define I2C2_SCL NONE // PB10, UART3_TX -#define I2C2_SDA NONE // PB11, UART3_RX -#define I2C_DEVICE (I2CDEV_2) +#define USE_I2C_DEVICE_1 +#define I2C1_SCL NONE // PB10, UART3_TX +#define I2C1_SDA NONE // PB11, UART3_RX +#define I2C_DEVICE (I2CDEV_1) #define USE_ADC #define CURRENT_METER_ADC_PIN PC1 diff --git a/src/main/target/IFLIGHT_F745_AIO/target.c b/src/main/target/IFLIGHT_F745_AIO/target.c new file mode 100644 index 0000000000..cf496fbcd7 --- /dev/null +++ b/src/main/target/IFLIGHT_F745_AIO/target.c @@ -0,0 +1,48 @@ +/* + * This file is part of Cleanflight and Betaflight. + * + * Cleanflight and Betaflight are free software. You can redistribute + * this software and/or modify this software 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. + * + * Cleanflight and Betaflight are distributed in the hope that they + * 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 this software. + * + * If not, see . + */ + +#include + +#include "platform.h" +#include "drivers/io.h" + +#include "drivers/dma.h" +#include "drivers/timer.h" +#include "drivers/timer_def.h" + +const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { + + DEF_TIM(TIM4, CH1, PD12, TIM_USE_LED, 0, 0 ), // S6_IN DMA2_ST7 + + DEF_TIM(TIM3, CH3, PB0, TIM_USE_MOTOR, 0, 0 ), // S10_OUT 1 DMA1_ST7 + DEF_TIM(TIM3, CH4, PB1, TIM_USE_MOTOR, 0, 0 ), // S6_OUT 2 DMA1_ST0 + DEF_TIM(TIM1, CH1, PE9, TIM_USE_MOTOR, 0, 0 ), // S2_OUT 3 DMA1_ST4 + DEF_TIM(TIM1, CH2, PE11, TIM_USE_MOTOR, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + + DEF_TIM(TIM8, CH3, PC8, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM1, CH3, PE13, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM2, CH3, PB10, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM2, CH4, PB11, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM8, CH1, PC6, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM8, CH2, PC7, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM2, CH4, PA3, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + DEF_TIM(TIM9, CH1, PA2, TIM_USE_ANY, 0, 0 ), // S1_OUT 4 DMA1_ST1 DMA1_ST3 + + }; diff --git a/src/main/target/IFLIGHT_F745_AIO/target.h b/src/main/target/IFLIGHT_F745_AIO/target.h new file mode 100644 index 0000000000..7a84a8969f --- /dev/null +++ b/src/main/target/IFLIGHT_F745_AIO/target.h @@ -0,0 +1,157 @@ +/* + * This file is part of Cleanflight and Betaflight. + * + * Cleanflight and Betaflight are free software. You can redistribute + * this software and/or modify this software 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. + * + * Cleanflight and Betaflight are distributed in the hope that they + * 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 this software. + * + * If not, see . + */ + +#pragma once + +#define TARGET_BOARD_IDENTIFIER "IFRC" + +#define USBD_PRODUCT_STRING "IFLIGHT_F745_AIO" + +#define LED0_PIN PC13 + +#define USE_BEEPER +#define BEEPER_PIN PD15 +#define BEEPER_INVERTED + +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_INSTANCE SPI1 + +#define USE_ACC +#define USE_ACC_SPI_MPU6000 +#define ACC_MPU6000_ALIGN CW0_DEG + +#define USE_GYRO +#define USE_GYRO_SPI_MPU6000 +#define GYRO_MPU6000_ALIGN CW0_DEG + +// MPU6000 interrupts +#define USE_MPU_DATA_READY_SIGNAL +#define MPU_INT_EXTI PD0 +#define USE_EXTI + +#define USE_MAG +#define USE_MAG_HMC5883 +#define USE_MAG_QMC5883 +#define MAG_I2C_INSTANCE (I2CDEV_1) + +//#define MAG_HMC5883_ALIGN CW270_DEG_FLIP +//#define MAG_HMC5883_ALIGN CW90_DEG + +#define USE_BARO +#define USE_BARO_MS5611 +#define USE_BARO_BMP280 +#define BARO_I2C_INSTANCE (I2CDEV_1) + +#define USABLE_TIMER_CHANNEL_COUNT 14 + +#define USE_VCP +#define USE_USB_DETECT +#define USB_DETECT_PIN PC4 + +#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_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 PC4 + +#define USE_SOFTSERIAL1 +#define USE_SOFTSERIAL2 + +#define SERIAL_PORT_COUNT 11 //VCP, USART1, USART2, USART3, UART4, UART5, USART6, USART7, USART8, SOFTSERIAL x 2 + +#define USE_ESCSERIAL + +#define USE_SPI +#define USE_SPI_DEVICE_1 +#define USE_SPI_DEVICE_2 +#define USE_SPI_DEVICE_3 +#define USE_SPI_DEVICE_4 + +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +#define SPI4_SCK_PIN PE2 +#define SPI4_MISO_PIN PE5 +#define SPI4_MOSI_PIN PE6 + +#define USE_MAX7456 +#define MAX7456_SPI_INSTANCE SPI4 +#define MAX7456_SPI_CS_PIN PE4 +#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) // 10MHz +#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST) + +#define ENABLE_BLACKBOX_LOGGING_ON_SPIFLASH_BY_DEFAULT +#define USE_FLASHFS +#define USE_FLASH_M25P16 +#define FLASH_CS_PIN PA15 +#define FLASH_SPI_INSTANCE SPI3 + +#define USE_I2C +#define USE_I2C_DEVICE_1 // External I2C +#define I2C_DEVICE (I2CDEV_1) +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 + +#define USE_ADC +#define VBAT_ADC_PIN PC3 +#define CURRENT_METER_ADC_PIN PC2 +#define RSSI_ADC_PIN PC5 + +#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS + +#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 USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(9) ) diff --git a/src/main/target/IFLIGHT_F745_AIO/target.mk b/src/main/target/IFLIGHT_F745_AIO/target.mk new file mode 100644 index 0000000000..52b07087de --- /dev/null +++ b/src/main/target/IFLIGHT_F745_AIO/target.mk @@ -0,0 +1,12 @@ +F7X5XG_TARGETS += $(TARGET) +FEATURES += VCP ONBOARDFLASH + +TARGET_SRC = \ + drivers/accgyro/accgyro_spi_mpu6000.c \ + drivers/barometer/barometer_ms5611.c \ + drivers/barometer/barometer_bmp280.c \ + drivers/compass/compass_hmc5883l.c \ + drivers/compass/compass_qmc5883l.c \ + drivers/light_ws2811strip.c \ + drivers/light_ws2811strip_hal.c \ + drivers/max7456.c