mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-24 16:55:36 +03:00
SPI CS preinit for configurability
This commit is contained in:
parent
ca09a8e2fc
commit
f9a43099db
22 changed files with 219 additions and 113 deletions
|
@ -197,73 +197,6 @@ static IO_t busSwitchResetPin = IO_NONE;
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_SPI
|
||||
// Pre-initialize all CS pins to input with pull-up.
|
||||
// It's sad that we can't do this with an initialized array,
|
||||
// since we will be taking care of configurable CS pins shortly.
|
||||
|
||||
void spiPreInit(void)
|
||||
{
|
||||
#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 MPU6500_CS_PIN
|
||||
spiPreInitCs(IO_TAG(MPU6500_CS_PIN));
|
||||
#endif
|
||||
#ifdef MPU9250_CS_PIN
|
||||
spiPreInitCs(IO_TAG(MPU9250_CS_PIN));
|
||||
#endif
|
||||
#ifdef ICM20649_CS_PIN
|
||||
spiPreInitCs(IO_TAG(ICM20649_CS_PIN));
|
||||
#endif
|
||||
#ifdef ICM20689_CS_PIN
|
||||
spiPreInitCs(IO_TAG(ICM20689_CS_PIN));
|
||||
#endif
|
||||
#ifdef BMI160_CS_PIN
|
||||
spiPreInitCs(IO_TAG(BMI160_CS_PIN));
|
||||
#endif
|
||||
#ifdef L3GD20_CS_PIN
|
||||
spiPreInitCs(IO_TAG(L3GD20_CS_PIN));
|
||||
#endif
|
||||
#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 BMP280_CS_PIN
|
||||
spiPreInitCs(IO_TAG(BMP280_CS_PIN));
|
||||
#endif
|
||||
#ifdef MS5611_CS_PIN
|
||||
spiPreInitCs(IO_TAG(MS5611_CS_PIN));
|
||||
#endif
|
||||
#ifdef LPS_CS_PIN
|
||||
spiPreInitCs(IO_TAG(LPS_CS_PIN));
|
||||
#endif
|
||||
#ifdef HMC5883_CS_PIN
|
||||
spiPreInitCs(IO_TAG(HMC5883_CS_PIN));
|
||||
#endif
|
||||
#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 FLASH_CS_PIN
|
||||
spiPreInitCs(IO_TAG(FLASH_CS_PIN));
|
||||
#endif
|
||||
#if defined(USE_RX_SPI)
|
||||
spiPreInitCs(IO_TAG(RX_NSS_PIN));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void init(void)
|
||||
{
|
||||
#ifdef USE_ITCM_RAM
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue