Merge pull request #7723 from jflyper/bfdev-fix-lps-driver-hardfaulting-on-non-SPI-detect-call

[BARO, LPS] Don't fiddle with SPI if the device is not on SPI bus
This commit is contained in:
Michael Keller 2019-03-16 23:55:34 +13:00 committed by GitHub
commit f6cef94b28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -252,6 +252,11 @@ bool lpsDetect(baroDev_t *baro)
{
//Detect
busDevice_t *busdev = &baro->busdev;
if (busdev->bustype != BUSTYPE_SPI) {
return false;
}
IOInit(busdev->busdev_u.spi.csnPin, OWNER_BARO_CS, 0);
IOConfigGPIO(busdev->busdev_u.spi.csnPin, IOCFG_OUT_PP);
IOHi(busdev->busdev_u.spi.csnPin); // Disable