diff --git a/src/main/target/REVO/target.h b/src/main/target/REVO/target.h index 3e6219999..6021f0151 100644 --- a/src/main/target/REVO/target.h +++ b/src/main/target/REVO/target.h @@ -25,11 +25,6 @@ #define TARGET_BOARD_IDENTIFIER "A4SD" #define USBD_PRODUCT_STRING "AirbotF4SD" -#elif defined(REVOLT) -#define TARGET_BOARD_IDENTIFIER "RVLT" -#define USBD_PRODUCT_STRING "Revolt" -#define TARGET_DEFAULT_MIXER MIXER_QUADX_1234 - #elif defined(SOULF4) #define TARGET_BOARD_IDENTIFIER "SOUL" #define USBD_PRODUCT_STRING "DemonSoulF4" @@ -54,14 +49,11 @@ #define LED2_PIN PB6 #endif -// Disable LED1, conflicts with AirbotF4/Flip32F4/Revolt beeper +// Disable LED1, conflicts with AirbotF4/Flip32F4 beeper #if defined(AIRBOTF4) || defined(AIRBOTF4SD) #define USE_BEEPER #define BEEPER_PIN PB4 #define BEEPER_INVERTED -#elif defined(REVOLT) -#define USE_BEEPER -#define BEEPER_PIN PB4 #elif defined(SOULF4) #define USE_BEEPER #define BEEPER_PIN PB6 @@ -73,9 +65,6 @@ #define BEEPER_PIN NONE #endif -#if defined(REVOLT) -#define ENABLE_DSHOT_DMAR true -#endif // PC0 used as inverter select GPIO #ifdef AIRBOTF4SD @@ -115,7 +104,7 @@ #define USE_ACC_SPI_MPU6000 #define ACC_MPU6000_ALIGN CW180_DEG -#elif defined(REVOLT) || defined(PODIUMF4) +#elif defined(PODIUMF4) #define USE_GYRO_MPU6500 #define USE_GYRO_SPI_MPU6500 @@ -208,11 +197,11 @@ #define UART3_RX_PIN PB11 #define UART3_TX_PIN PB10 -#if defined(REVOLT) || defined(REVO) +#if defined(REVO) #define USE_UART4 #define UART4_RX_PIN PA1 #define UART4_TX_PIN PA0 -#endif // REVOLT || REVO +#endif // REVO #define USE_UART6 #define UART6_RX_PIN PC7 @@ -222,7 +211,7 @@ #define USE_SOFTSERIAL1 #define USE_SOFTSERIAL2 -#if defined(REVOLT) || defined(REVO) +#if defined(REVO) #define SERIAL_PORT_COUNT 7 //VCP, USART1, USART3, UART4, USART6, SOFTSERIAL x 2 #else #define SERIAL_PORT_COUNT 6 //VCP, USART1, USART3, USART6, SOFTSERIAL x 2 @@ -287,10 +276,7 @@ #define TARGET_IO_PORTC 0xffff #define TARGET_IO_PORTD (BIT(2)) -#ifdef REVOLT -#define USABLE_TIMER_CHANNEL_COUNT 11 -#define USED_TIMERS ( TIM_N(2) | TIM_N(3) | TIM_N(4) | TIM_N(8) | TIM_N(12) ) -#elif defined(AIRBOTF4) || defined(AIRBOTF4SD) +#if defined(AIRBOTF4) || defined(AIRBOTF4SD) #define USABLE_TIMER_CHANNEL_COUNT 13 #define USED_TIMERS ( TIM_N(1) | TIM_N(2) | TIM_N(3) | TIM_N(5) | TIM_N(8) | TIM_N(12) ) #else diff --git a/src/main/target/REVO/REVOLT.mk b/src/main/target/REVOLT/REVOLTOSD.mk similarity index 100% rename from src/main/target/REVO/REVOLT.mk rename to src/main/target/REVOLT/REVOLTOSD.mk diff --git a/src/main/target/REVOLT/config.c b/src/main/target/REVOLT/config.c new file mode 100644 index 000000000..14fca0375 --- /dev/null +++ b/src/main/target/REVOLT/config.c @@ -0,0 +1,40 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include +#include + +#include + +#include "drivers/serial.h" +#include "rx/rx.h" + +#include "telemetry/telemetry.h" + +#include "fc/config.h" + + +#ifdef USE_TARGET_CONFIG + +#include "pg/pg.h" + + +void targetConfiguration(void) +{ + rxConfigMutable()->halfDuplex = true; +} +#endif diff --git a/src/main/target/REVOLT/target.c b/src/main/target/REVOLT/target.c new file mode 100644 index 000000000..a5cdb281b --- /dev/null +++ b/src/main/target/REVOLT/target.c @@ -0,0 +1,36 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + +#include + +#include +#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(TIM11, CH1, PB9, TIM_USE_ANY, 0, 0), //cam control + + DEF_TIM(TIM8, CH2N, PB0, TIM_USE_MOTOR, 0, 0), // Motor 1 + DEF_TIM(TIM8, CH3N, PB1, TIM_USE_MOTOR, 0, 0), // Motor 2 + DEF_TIM(TIM5, CH4, PA2, TIM_USE_MOTOR, 0, 1), // Motor 3 + DEF_TIM(TIM5, CH3, PA3, TIM_USE_MOTOR, 0, 0), // Motor 4 + + DEF_TIM(TIM4, CH1, PB6, TIM_USE_LED, 0, 0), // LED for REVOLT +}; diff --git a/src/main/target/REVOLT/target.h b/src/main/target/REVOLT/target.h new file mode 100644 index 000000000..0a88c51d4 --- /dev/null +++ b/src/main/target/REVOLT/target.h @@ -0,0 +1,173 @@ +/* + * This file is part of Cleanflight. + * + * Cleanflight 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. + * + * Cleanflight 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 Cleanflight. If not, see . + */ + + + +#pragma once + + +#if defined(REVOLTOSD) +#define TARGET_BOARD_IDENTIFIER "ROSD" +#define USBD_PRODUCT_STRING "RevoltOSD" +#else +#define TARGET_BOARD_IDENTIFIER "RVLT" +#define USBD_PRODUCT_STRING "Revolt" +#endif + + +#define TARGET_DEFAULT_MIXER MIXER_QUADX_1234 + + + +#define LED0_PIN PB5 + +#define USE_BEEPER +#define BEEPER_PIN PB4 + +#define ENABLE_DSHOT_DMAR true + +#define USE_TRANSPONDER + +#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS +#define SERIALRX_UART SERIAL_PORT_USART1 + +#define USE_TARGET_CONFIG + +#define USE_SERIAL_4WAY_BLHELI_INTERFACE + + +#define INVERTER_PIN_UART1 PC0 + +/*----------Spi Config--------*/ +#define USE_SPI + +#define USE_SPI_DEVICE_1 +#define SPI1_NSS_PIN PA4 +#define SPI1_SCK_PIN PA5 +#define SPI1_MISO_PIN PA6 +#define SPI1_MOSI_PIN PA7 + +#define USE_SPI_DEVICE_2 +#define SPI2_NSS_PIN PB12 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PB14 +#define SPI2_MOSI_PIN PB15 + +#define USE_SPI_DEVICE_3 +#define SPI3_NSS_PIN PB3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + +/*----------I2C Config--------*/ +#define USE_I2C +#define USE_I2C_DEVICE_1 +#define I2C_DEVICE (I2CDEV_1) +#define I2C1_SCL PB8 +#define I2C1_SDA PB9 + +/*----------Gyro Config--------*/ +#define MPU6000_CS_PIN PA4 +#define MPU6000_SPI_INSTANCE SPI1 + +#define MPU6500_CS_PIN PA4 +#define MPU6500_SPI_INSTANCE SPI1 + +#define USE_GYRO +#define USE_ACC + +#define USE_GYRO_MPU6500 +#define USE_GYRO_SPI_MPU6500 +#define GYRO_MPU6500_ALIGN CW0_DEG + +#define USE_ACC_MPU6500 +#define USE_ACC_SPI_MPU6500 +#define ACC_MPU6500_ALIGN CW0_DEG + + +#define USE_EXTI +#define MPU_INT_EXTI PC4 +#define USE_MPU_DATA_READY_SIGNAL + +/*----------Flash Config--------*/ +#define M25P16_CS_PIN PB3 + +#if defined(REVOLTOSD) +#define M25P16_SPI_INSTANCE SPI2 +#else +#define M25P16_SPI_INSTANCE SPI3 +#endif + + +#define USE_FLASHFS +#define USE_FLASH_M25P16 + +#if defined(REVOLTOSD) +/*----------OSD Config--------*/ +#define USE_MAX7456 +#define MAX7456_SPI_INSTANCE SPI2 +#define MAX7456_SPI_CS_PIN PD2 +#define MAX7456_SPI_CLK (SPI_CLOCK_STANDARD) // 10MHz +#define MAX7456_RESTORE_CLK (SPI_CLOCK_FAST) +#endif + + + +/*----------Uart Config--------*/ +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 +#define UART1_AHB1_PERIPHERALS RCC_AHB1Periph_DMA2 + +#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_SOFTSERIAL1 +#define USE_SOFTSERIAL2 + +#define SERIAL_PORT_COUNT 7 //VCP, USART1, USART3, UART4, USART6, SOFTSERIAL x 2 + +#define USE_ESCSERIAL +#define ESCSERIAL_TIMER_TX_PIN PC6 // UART 6 + +/*----------ADC Config--------*/ +#define USE_ADC + +#define CURRENT_METER_ADC_PIN PC1 +#define VBAT_ADC_PIN PC2 + +#define USE_VCP +#define VBUS_SENSING_PIN PC5 + + +#define TARGET_IO_PORTA 0xffff +#define TARGET_IO_PORTB 0xffff +#define TARGET_IO_PORTC 0xffff +#define TARGET_IO_PORTD (BIT(2)) + +#define USABLE_TIMER_CHANNEL_COUNT 11 +#define USED_TIMERS ( TIM_N(3) | TIM_N(4) | TIM_N(5) | TIM_N(8) | TIM_N(11) ) diff --git a/src/main/target/REVOLT/target.mk b/src/main/target/REVOLT/target.mk new file mode 100644 index 000000000..73baac09b --- /dev/null +++ b/src/main/target/REVOLT/target.mk @@ -0,0 +1,8 @@ +F405_TARGETS += $(TARGET) +FEATURES = VCP ONBOARDFLASH + +TARGET_SRC = \ + drivers/accgyro/accgyro_spi_mpu6000.c \ + drivers/accgyro/accgyro_mpu6500.c \ + drivers/accgyro/accgyro_spi_mpu6500.c \ + drivers/max7456.c