diff --git a/fake_travis_build.sh b/fake_travis_build.sh index 03b894df06..b15b111429 100755 --- a/fake_travis_build.sh +++ b/fake_travis_build.sh @@ -23,7 +23,8 @@ targets=("PUBLISHMETA=True" \ "TARGET=SINGULARITY" \ "TARGET=SIRINFPV" \ "TARGET=X_RACERSPI" \ - "TARGET=RCEXPLORERF3") + "TARGET=RCEXPLORERF3"\ + "TARGET=YUPIF4") #fake a travis build environment diff --git a/src/main/target/YUPIF4/target.c b/src/main/target/YUPIF4/target.c new file mode 100644 index 0000000000..3b21e47a87 --- /dev/null +++ b/src/main/target/YUPIF4/target.c @@ -0,0 +1,32 @@ +/* + * 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/timer.h" + +const timerHardware_t timerHardware[USABLE_TIMER_CHANNEL_COUNT] = { + { TIM8, IO_TAG(PC8), TIM_Channel_3, TIM8_CC_IRQn, 0, IOCFG_AF_PP }, // PPM IN + { TIM2, IO_TAG(PA0), TIM_Channel_1, TIM2_IRQn, 1, IOCFG_AF_PP }, // MS1 + { TIM2, IO_TAG(PA1), TIM_Channel_2, TIM2_IRQn, 1, IOCFG_AF_PP }, // MS2 + { TIM2, IO_TAG(PA2), TIM_Channel_3, TIM2_IRQn, 1, IOCFG_AF_PP }, // MS3 + { TIM2, IO_TAG(PA3), TIM_Channel_4, TIM2_IRQn, 1, IOCFG_AF_PP }, // MS4 + { TIM3, IO_TAG(PB0), TIM_Channel_3, TIM3_IRQn, 1, IOCFG_AF_PP }, // MS5 + { TIM3, IO_TAG(PB1), TIM_Channel_4, TIM3_IRQn, 1, IOCFG_AF_PP }, // MS6 +}; diff --git a/src/main/target/YUPIF4/target.h b/src/main/target/YUPIF4/target.h new file mode 100644 index 0000000000..63b00c01d9 --- /dev/null +++ b/src/main/target/YUPIF4/target.h @@ -0,0 +1,155 @@ +/* + * 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 +#define TARGET_BOARD_IDENTIFIER "YPF4" + +#define CONFIG_START_FLASH_ADDRESS (0x08080000) //0x08080000 to 0x080A0000 (FLASH_Sector_8) + +#define USBD_PRODUCT_STRING "YupiF4" + +#define LED0 PB6 +#define LED1 PB4 +#define LED2 PB5 + +#define BEEPER PC9 + +#define INVERTER PB15 +#define INVERTER_USART USART6 + + +// MPU6500 interrupt +#define USE_EXTI +#define USE_MPU_DATA_READY_SIGNAL +#define MPU_INT_EXTI PC4 + +//MPU6500 +#define MPU6500_CS_PIN PA4 +#define MPU6500_SPI_INSTANCE SPI1 + +#define ACC +#define USE_ACC_MPU6500 +#define USE_ACC_SPI_MPU6500 +#define ACC_MPU6500_ALIGN CW90_DEG + +#define GYRO +#define USE_GYRO_MPU6500 +#define USE_GYRO_SPI_MPU6500 +#define GYRO_MPU6500_ALIGN CW90_DEG + +#define USE_VCP +//#define VBUS_SENSING_PIN PA8 +//#define VBUS_SENSING_ENABLED + +// UART Ports +#define USE_UART1 +#define UART1_RX_PIN PA10 +#define UART1_TX_PIN PA9 + +#define USE_UART3 +#define UART3_RX_PIN PB11 +#define UART3_TX_PIN PB10 + +#define USE_UART6 +#define UART6_RX_PIN PC7 +#define UART6_TX_PIN PC6 + +#define SERIAL_PORT_COUNT 4 // VCP, UART1, UART3, UART6 + + +// SD Card +#define USE_SDCARD +#define SDCARD_DETECT_INVERTED + +#define SDCARD_DETECT_PIN PD2 +#define SDCARD_SPI_INSTANCE SPI3 +#define SDCARD_SPI_CS_PIN PA15 + +// SPI2 is on the APB1 bus whose clock runs at 84MHz. Divide to under 400kHz for init: +#define SDCARD_SPI_INITIALIZATION_CLOCK_DIVIDER 256 // 328kHz +// Divide to under 25MHz for normal operation: +#define SDCARD_SPI_FULL_SPEED_CLOCK_DIVIDER 4 // 21MHz + +#define SDCARD_DMA_CHANNEL_TX DMA1_Stream5 +#define SDCARD_DMA_CHANNEL_TX_COMPLETE_FLAG DMA_FLAG_TCIF5 +#define SDCARD_DMA_CLK RCC_AHB1Periph_DMA1 +#define SDCARD_DMA_CHANNEL DMA_Channel_0 + + +// SPI Ports +#define USE_SPI + +#define USE_SPI_DEVICE_1 //MPU6500 +#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 //Free +#define SPI2_NSS_PIN PB12 +#define SPI2_SCK_PIN PB13 +#define SPI2_MISO_PIN PC2 +*/ + +#define USE_SPI_DEVICE_3 //dataslash - SD Card +#define SPI3_NSS_PIN PB3 +#define SPI3_SCK_PIN PC10 +#define SPI3_MISO_PIN PC11 +#define SPI3_MOSI_PIN PC12 + + +#define USE_I2C +#define I2C_DEVICE (I2CDEV_1) // SCL PB8 - SDA PB9 +#define USE_I2C_PULLUP + +// ADC inputs +#define BOARD_HAS_VOLTAGE_DIVIDER +#define USE_ADC +#define VBAT_ADC_PIN PC1 +#define RSSI_ADC_GPIO_PIN PC0 + + +#define LED_STRIP +// LED Strip can run off Pin 6 (PB1) +#define WS2811_PIN PB1 +#define WS2811_TIMER TIM3 +#define WS2811_TIMER_CHANNEL TIM_Channel_4 +#define WS2811_DMA_HANDLER_IDENTIFER DMA1_ST2_HANDLER +#define WS2811_DMA_STREAM DMA1_Stream2 +#define WS2811_DMA_FLAG DMA_FLAG_TCIF2 +#define WS2811_DMA_IT DMA_IT_TCIF2 +#define WS2811_DMA_CHANNEL DMA_Channel_5 +#define WS2811_DMA_IRQ DMA1_Stream2_IRQn + + +// Default configuration +#define ENABLE_BLACKBOX_LOGGING_ON_SDCARD_BY_DEFAULT +#define DEFAULT_FEATURES FEATURE_BLACKBOX +#define DEFAULT_RX_FEATURE FEATURE_RX_SERIAL +#define SERIALRX_PROVIDER SERIALRX_SBUS + +// Target IO and timers +#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 (BIT(2)) + +#define USABLE_TIMER_CHANNEL_COUNT 7 +#define USED_TIMERS (TIM_N(2) | TIM_N(3) | TIM_N(8)) diff --git a/src/main/target/YUPIF4/target.mk b/src/main/target/YUPIF4/target.mk new file mode 100644 index 0000000000..a5e7683b42 --- /dev/null +++ b/src/main/target/YUPIF4/target.mk @@ -0,0 +1,7 @@ +F405_TARGETS += $(TARGET) +FEATURES += SDCARD VCP + +TARGET_SRC = \ + drivers/accgyro_spi_mpu6500.c \ + drivers/accgyro_mpu6500.c +