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

SPRacingF7DUAL - Dual SIMULTANEOUS gyro support. (#5264)

* CF/BF - Set STM32F7 SPI FAST clock to 13.5Mhz - Gyros not stable at
27mhz.

* CF/BF - Initial SPRacingF7DUAL commit.

Support two simultaneous gyro support (code by Dominic Clifton and Martin Budden)
There are new debug modes so you can see the difference between each gyro.

Notes:
* spi bus instance caching broke spi mpu detection because the detection
tries I2C first which overwrites the selected bus instance when using
dual gyro.
* ALL other dual-gyro boards have one sensor per bus.  SPRacingF7DUAL is has two per bus and thus commit has a lot of changes to fix SPI/BUS/GYRO initialisation issues.

* CF/BF - Add SPRacingF4EVODG target.

This target adds a second gyro to the board using the SPI pads on the back of the board.

* CF/BF - Temporarily disable Gyro EXTI pin to allow NEO target to build.
This commit is contained in:
Dominic Clifton 2018-03-03 23:29:31 +01:00 committed by Michael Keller
parent 9bcc6aca8e
commit cde9a9517b
29 changed files with 797 additions and 117 deletions

View file

@ -18,6 +18,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <math.h>
#include "platform.h"
@ -196,52 +197,58 @@ static IO_t busSwitchResetPin = IO_NONE;
void spiPreInit(void)
{
#ifdef USE_ACC_SPI_MPU6000
#ifdef GYRO_1_CS_PIN
spiPreInitCs(IO_TAG(GYRO_1_CS_PIN));
#endif
#ifdef GYRO_2_CS_PIN
spiPreInitCs(IO_TAG(GYRO_2_CS_PIN));
#endif
#ifdef MPU6000_CS_PIN
spiPreInitCs(IO_TAG(MPU6000_CS_PIN));
#endif
#ifdef USE_ACC_SPI_MPU6500
#ifdef MPU6500_CS_PIN
spiPreInitCs(IO_TAG(MPU6500_CS_PIN));
#endif
#ifdef USE_GYRO_SPI_MPU9250
#ifdef MPU9250_CS_PIN
spiPreInitCs(IO_TAG(MPU9250_CS_PIN));
#endif
#ifdef USE_GYRO_SPI_ICM20649
#ifdef ICM20649_CS_PIN
spiPreInitCs(IO_TAG(ICM20649_CS_PIN));
#endif
#ifdef USE_GYRO_SPI_ICM20689
#ifdef ICM20689_CS_PIN
spiPreInitCs(IO_TAG(ICM20689_CS_PIN));
#endif
#ifdef USE_ACCGYRO_BMI160
#ifdef BMI160_CS_PIN
spiPreInitCs(IO_TAG(BMI160_CS_PIN));
#endif
#ifdef USE_GYRO_L3GD20
#ifdef L3GD20_CS_PIN
spiPreInitCs(IO_TAG(L3GD20_CS_PIN));
#endif
#ifdef USE_MAX7456
#ifdef MAX7456_SPI_CS_PIN
spiPreInitCsOutPU(IO_TAG(MAX7456_SPI_CS_PIN)); // XXX 3.2 workaround for Kakute F4. See comment for spiPreInitCSOutPU.
#endif
#ifdef USE_SDCARD
spiPreInitCs(sdcardConfig()->chipSelectTag);
#endif
#ifdef USE_BARO_SPI_BMP280
#ifdef BMP280_CS_PIN
spiPreInitCs(IO_TAG(BMP280_CS_PIN));
#endif
#ifdef USE_BARO_SPI_MS5611
#ifdef MS5611_CS_PIN
spiPreInitCs(IO_TAG(MS5611_CS_PIN));
#endif
#ifdef USE_BARO_SPI_LPS
#ifdef LPS_CS_PIN
spiPreInitCs(IO_TAG(LPS_CS_PIN));
#endif
#ifdef USE_MAG_SPI_HMC5883
#ifdef HMC5883_CS_PIN
spiPreInitCs(IO_TAG(HMC5883_CS_PIN));
#endif
#ifdef USE_MAG_SPI_AK8963
#ifdef AK8963_CS_PIN
spiPreInitCs(IO_TAG(AK8963_CS_PIN));
#endif
#if defined(RTC6705_CS_PIN) && !defined(USE_VTX_RTC6705_SOFTSPI) // RTC6705 soft SPI initialisation handled elsewhere.
spiPreInitCs(IO_TAG(RTC6705_CS_PIN));
#endif
#ifdef USE_FLASH_M25P16
#ifdef M25P16_CS_PIN
spiPreInitCs(IO_TAG(M25P16_CS_PIN));
#endif
#if defined(USE_RX_SPI) && !defined(USE_RX_SOFTSPI)