1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Merge pull request #7695 from mikeller/add_missing_unified_resources

Added missing features to unified targets, centralised feature configuration.
This commit is contained in:
Michael Keller 2019-03-07 03:54:34 +13:00 committed by GitHub
commit 687d066219
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 483 additions and 271 deletions

View file

@ -45,6 +45,8 @@ volatile uint8_t transponderIrDataTransferInProgress = 0;
static IO_t transponderIO = IO_NONE;
static TIM_HandleTypeDef TimHandle;
static uint16_t timerChannel = 0;
static uint8_t output;
static uint8_t alternateFunction;
#if !defined(STM32F7)
#error "Transponder (via HAL) not supported on this MCU."
@ -69,6 +71,8 @@ void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder)
const timerHardware_t *timerHardware = timerGetByTag(ioTag);
TIM_TypeDef *timer = timerHardware->tim;
timerChannel = timerHardware->channel;
output = timerHardware->output;
alternateFunction = timerHardware->alternateFunction;
#if defined(USE_DMA_SPEC)
const dmaChannelSpec_t *dmaSpec = dmaGetChannelSpecByTimer(timerHardware);
@ -253,7 +257,7 @@ void transponderIrDisable(void)
}
TIM_DMACmd(&TimHandle, timerChannel, DISABLE);
if (timerHardware->output & TIMER_OUTPUT_N_CHANNEL) {
if (output & TIMER_OUTPUT_N_CHANNEL) {
HAL_TIMEx_PWMN_Stop(&TimHandle, timerChannel);
} else {
HAL_TIM_PWM_Stop(&TimHandle, timerChannel);
@ -268,7 +272,7 @@ void transponderIrDisable(void)
IOLo(transponderIO);
#endif
IOConfigGPIOAF(transponderIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLDOWN), timerHardware->alternateFunction);
IOConfigGPIOAF(transponderIO, IO_CONFIG(GPIO_MODE_AF_PP, GPIO_SPEED_FREQ_VERY_HIGH, GPIO_PULLDOWN), alternateFunction);
}
void transponderIrTransmit(void)

View file

@ -42,6 +42,7 @@ volatile uint8_t transponderIrDataTransferInProgress = 0;
static IO_t transponderIO = IO_NONE;
static TIM_TypeDef *timer = NULL;
uint8_t alternateFunction;
#if defined(STM32F3)
static DMA_Channel_TypeDef *dmaRef = NULL;
#elif defined(STM32F4)
@ -74,6 +75,7 @@ void transponderIrHardwareInit(ioTag_t ioTag, transponder_t *transponder)
const timerHardware_t *timerHardware = timerGetByTag(ioTag);
timer = timerHardware->tim;
alternateFunction = timerHardware->alternateFunction;
#if defined(USE_DMA_SPEC)
const dmaChannelSpec_t *dmaSpec = dmaGetChannelSpecByTimer(timerHardware);
@ -235,7 +237,7 @@ void transponderIrDisable(void)
TIM_Cmd(timer, DISABLE);
IOInit(transponderIO, OWNER_TRANSPONDER, 0);
IOConfigGPIOAF(transponderIO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_DOWN), timerHardware->alternateFunction);
IOConfigGPIOAF(transponderIO, IO_CONFIG(GPIO_Mode_AF, GPIO_Speed_50MHz, GPIO_OType_PP, GPIO_PuPd_DOWN), alternateFunction);
#ifdef TRANSPONDER_INVERTED
IOHi(transponderIO);

View file

@ -20,68 +20,15 @@
#pragma once
// Treat the target as generic, and expect manufacturer id / board name
// to be supplied when the board is configured for the first time
#define USE_UNIFIED_TARGET
#include "target/common_unified.h"
#define TARGET_BOARD_IDENTIFIER "S405"
#define USBD_PRODUCT_STRING "Betaflight STM32F405"
#define USE_BEEPER
// MPU interrupt
#define USE_EXTI
#define USE_MPU_DATA_READY_SIGNAL
//#define DEBUG_MPU_DATA_READY_INTERRUPT
#define USE_GYRO_EXTI
#define USE_ACC
#define USE_GYRO
#define USE_ACC_MPU6050
#define USE_GYRO_MPU6050
#define USE_ACC_MPU6500
#define USE_GYRO_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO_SPI_MPU6000
#define USE_ACC_SPI_MPU6500
#define USE_GYRO_SPI_MPU6500
#define USE_ACC_SPI_ICM20689
#define USE_GYRO_SPI_ICM20689
// Other USE_ACCs and USE_GYROs should follow
#define USE_MAG
#define USE_MAG_HMC5883
#define USE_MAG_SPI_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8963
#define USE_MAG_SPI_AK8963
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define USE_BARO_LPS
#define USE_BARO_SPI_LPS
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define USE_MAX7456
#define USE_I2C
#define USE_I2C_DEVICE_1
#define USE_I2C_DEVICE_2
#define USE_I2C_DEVICE_3
#define I2C_FULL_RECONFIGURABILITY
#define USE_VCP
#define USE_UART1
#define USE_UART2
@ -89,20 +36,14 @@
#define USE_UART4
#define USE_UART5
#define USE_UART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 6)
#define USE_INVERTER
#define SERIAL_PORT_COUNT 9
#define USE_ESCSERIAL
#define USE_SPI
#define USE_SPI_DEVICE_1
#define USE_SPI_DEVICE_2
#define USE_SPI_DEVICE_3
#define SPI_FULL_RECONFIGURABILITY
#define USE_ADC
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff

View file

@ -5,4 +5,14 @@ TARGET_SRC = \
$(addprefix drivers/accgyro/,$(notdir $(wildcard $(SRC_DIR)/drivers/accgyro/*.c))) \
$(addprefix drivers/barometer/,$(notdir $(wildcard $(SRC_DIR)/drivers/barometer/*.c))) \
$(addprefix drivers/compass/,$(notdir $(wildcard $(SRC_DIR)/drivers/compass/*.c))) \
drivers/max7456.c
drivers/max7456.c \
rx/cc2500_common.c \
rx/cc2500_frsky_shared.c \
rx/cc2500_frsky_d.c \
rx/cc2500_frsky_x.c \
rx/cc2500_sfhss.c \
rx/a7105_flysky.c \
rx/cyrf6936_spektrum.c \
drivers/rx/rx_cc2500.c \
drivers/rx/rx_a7105.c \
drivers/rx/rx_cyrf6936.c

View file

@ -20,100 +20,27 @@
#pragma once
// Treat the target as generic, and expect manufacturer id / board name
// to be supplied when the board is configured for the first time
#define USE_UNIFIED_TARGET
#include "target/common_unified.h"
#define TARGET_BOARD_IDENTIFIER "S411"
#define USBD_PRODUCT_STRING "Betaflight STM32F411"
#define USE_BEEPER
// MPU interrupt
#define USE_EXTI
#define USE_MPU_DATA_READY_SIGNAL
//#define DEBUG_MPU_DATA_READY_INTERRUPT
#define USE_GYRO_EXTI
#define USE_ACC
#define USE_GYRO
#define USE_ACC_MPU6050
#define USE_GYRO_MPU6050
#define USE_ACC_MPU6500
#define USE_GYRO_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO_SPI_MPU6000
#define USE_ACC_SPI_MPU6500
#define USE_GYRO_SPI_MPU6500
#define USE_ACC_SPI_ICM20689
#define USE_GYRO_SPI_ICM20689
// Other USE_ACCs and USE_GYROs should follow
#define USE_MAG
#define USE_MAG_HMC5883
#define USE_MAG_SPI_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8963
#define USE_MAG_SPI_AK8963
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define USE_BARO_LPS
#define USE_BARO_SPI_LPS
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define USE_MAX7456
#define USE_I2C
#define USE_I2C_DEVICE_1
#define USE_I2C_DEVICE_2
#define USE_I2C_DEVICE_3
#define I2C_FULL_RECONFIGURABILITY
#define USE_VCP
#define USE_UART1
#define USE_UART2
#define USE_UART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 3)
#define USE_INVERTER
#define SERIAL_PORT_COUNT 6
#define USE_ESCSERIAL
#define USE_SPI
#define USE_SPI_DEVICE_1
#define USE_SPI_DEVICE_2
#define USE_SPI_DEVICE_3
#define SPI_FULL_RECONFIGURABILITY
#define USE_ADC
#define USE_RX_SPI
#define USE_RX_FRSKY_SPI_D
#define USE_RX_FRSKY_SPI_X
#define USE_RX_SFHSS_SPI
#define USE_RX_FRSKY_SPI_TELEMETRY
#define USE_RX_CC2500_SPI_PA_LNA
#define USE_RX_CC2500_SPI_DIVERSITY
#define USE_RX_FLYSKY
#define USE_RX_SPEKTRUM
#define USE_RX_SPEKTRUM_TELEMETRY
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff

View file

@ -20,69 +20,16 @@
#pragma once
// Treat the target as generic, and expect manufacturer id / board name
// to be supplied when the board is configured for the first time
#define USE_UNIFIED_TARGET
#include "target/common_unified.h"
#define TARGET_BOARD_IDENTIFIER "S745"
#define USBD_PRODUCT_STRING "Betaflight STM32F745"
#define USE_BEEPER
// MPU interrupt
#define USE_EXTI
#define USE_MPU_DATA_READY_SIGNAL
//#define DEBUG_MPU_DATA_READY_INTERRUPT
#define USE_GYRO_EXTI
#define USE_ACC
#define USE_GYRO
#define USE_ACC_MPU6050
#define USE_GYRO_MPU6050
#define USE_ACC_MPU6500
#define USE_GYRO_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO_SPI_MPU6000
#define USE_ACC_SPI_MPU6500
#define USE_GYRO_SPI_MPU6500
#define USE_ACC_SPI_ICM20689
#define USE_GYRO_SPI_ICM20689
// Other USE_ACCs and USE_GYROs should follow
#define USE_MAG
#define USE_MAG_HMC5883
#define USE_MAG_SPI_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8963
#define USE_MAG_SPI_AK8963
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define USE_BARO_LPS
#define USE_BARO_SPI_LPS
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define USE_MAX7456
#define USE_I2C
#define USE_I2C_DEVICE_1
#define USE_I2C_DEVICE_2
#define USE_I2C_DEVICE_3
#define USE_I2C_DEVICE_4
#define I2C_FULL_RECONFIGURABILITY
#define USE_VCP
#define USE_UART1
#define USE_UART2
@ -92,23 +39,15 @@
#define USE_UART6
#define USE_UART7
#define USE_UART8
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 11
#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 8)
#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 USE_SPI_DEVICE_5
#define USE_SPI_DEVICE_6
#define SPI_FULL_RECONFIGURABILITY
#define USE_ADC
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff

View file

@ -20,68 +20,15 @@
#pragma once
// Treat the target as generic, and expect manufacturer id / board name
// to be supplied when the board is configured for the first time
#define USE_UNIFIED_TARGET
#include "target/common_unified.h"
#define TARGET_BOARD_IDENTIFIER "S7X2"
#define USBD_PRODUCT_STRING "Betaflight STM32F7x2"
#define USE_BEEPER
// MPU interrupt
#define USE_EXTI
#define USE_MPU_DATA_READY_SIGNAL
//#define DEBUG_MPU_DATA_READY_INTERRUPT
#define USE_GYRO_EXTI
#define USE_ACC
#define USE_GYRO
#define USE_ACC_MPU6050
#define USE_GYRO_MPU6050
#define USE_ACC_MPU6500
#define USE_GYRO_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO_SPI_MPU6000
#define USE_ACC_SPI_MPU6500
#define USE_GYRO_SPI_MPU6500
#define USE_ACC_SPI_ICM20689
#define USE_GYRO_SPI_ICM20689
// Other USE_ACCs and USE_GYROs should follow
#define USE_MAG
#define USE_MAG_HMC5883
#define USE_MAG_SPI_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8963
#define USE_MAG_SPI_AK8963
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define USE_BARO_LPS
#define USE_BARO_SPI_LPS
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define USE_MAX7456
#define USE_I2C
#define USE_I2C_DEVICE_1
#define USE_I2C_DEVICE_2
#define USE_I2C_DEVICE_3
#define I2C_FULL_RECONFIGURABILITY
#define USE_VCP
#define USE_UART1
#define USE_UART2
@ -89,20 +36,12 @@
#define USE_UART4
#define USE_UART5
#define USE_UART6
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define SERIAL_PORT_COUNT 9
#define SERIAL_PORT_COUNT (UNIFIED_SERIAL_PORT_COUNT + 6)
#define USE_ESCSERIAL
#define USE_SPI
#define USE_SPI_DEVICE_1
#define USE_SPI_DEVICE_2
#define USE_SPI_DEVICE_3
#define SPI_FULL_RECONFIGURABILITY
#define USE_ADC
#define TARGET_IO_PORTA 0xffff
#define TARGET_IO_PORTB 0xffff

View file

@ -294,3 +294,12 @@
#else
#undef USE_UNIFIED_TARGET
#endif
#if !defined(USE_RANGEFINDER)
#undef USE_RANGEFINDER_HCSR04
#undef USE_RANGEFINDER_SRF10
#undef USE_RANGEFINDER_HCSR04_I2C
#undef USE_RANGEFINDER_VL53L0X
#undef USE_RANGEFINDER_UIB
#undef USE_RANGEFINDER_TF
#endif

View file

@ -0,0 +1,115 @@
/*
* 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 <http://www.gnu.org/licenses/>.
*/
#pragma once
// Treat the target as unified, and expect manufacturer id / board name
// to be supplied when the board is configured for the first time
#define USE_UNIFIED_TARGET
#define USE_BEEPER
// MPU interrupt
#define USE_EXTI
#define USE_MPU_DATA_READY_SIGNAL
#define USE_GYRO_EXTI
#define USE_ACC
#define USE_GYRO
#define USE_ACC_MPU6050
#define USE_GYRO_MPU6050
#define USE_ACC_MPU6500
#define USE_GYRO_MPU6500
#define USE_ACC_SPI_MPU6000
#define USE_GYRO_SPI_MPU6000
#define USE_ACC_SPI_MPU6500
#define USE_GYRO_SPI_MPU6500
#define USE_ACC_SPI_ICM20689
#define USE_GYRO_SPI_ICM20689
// Other USE_ACCs and USE_GYROs should follow
#define USE_MAG
#define USE_MAG_DATA_READY_SIGNAL
#define USE_MAG_HMC5883
#define USE_MAG_SPI_HMC5883
#define USE_MAG_QMC5883
#define USE_MAG_LIS3MDL
#define USE_MAG_AK8963
#define USE_MAG_SPI_AK8963
#define USE_BARO
#define USE_BARO_MS5611
#define USE_BARO_SPI_MS5611
#define USE_BARO_BMP280
#define USE_BARO_SPI_BMP280
#define USE_BARO_LPS
#define USE_BARO_SPI_LPS
#define USE_SDCARD
#define USE_SDCARD_SPI
#define USE_FLASHFS
#define USE_FLASH_M25P16
#define USE_MAX7456
#define USE_TRANSPONDER
//TODO: Make this actually work by making the pins configurable
#define USE_RANGEFINDER
#define USE_RANGEFINDER_HCSR04
#define USE_RANGEFINDER_TF
#define USE_SPI
#define SPI_FULL_RECONFIGURABILITY
#define USE_I2C
#define I2C_FULL_RECONFIGURABILITY
#define USE_VCP
#define USE_SOFTSERIAL1
#define USE_SOFTSERIAL2
#define UNIFIED_SERIAL_PORT_COUNT 3
#define USE_USB_DETECT
//TODO: Re-enable this after it's been fixed to work with unified targets
//#define USE_ESCSERIAL
#define USE_ADC
#if defined(STM32F4)
//We currently only have stdperiph drivers for this
#define USE_RX_SPI
#define USE_RX_FRSKY_SPI_D
#define USE_RX_FRSKY_SPI_X
#define USE_RX_SFHSS_SPI
#define USE_RX_FRSKY_SPI_TELEMETRY
#define USE_RX_CC2500_SPI_PA_LNA
#define USE_RX_CC2500_SPI_DIVERSITY
#define USE_RX_FLYSKY
#define USE_RX_FLYSKY_SPI_LED
#endif