mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +08:00
HOTFIX: correct some logic errors with SPI chipselect generation.
Tested by Tridge.
This commit is contained in:
@@ -92,21 +92,21 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
|||||||
case PX4_SPIDEV_GYRO:
|
case PX4_SPIDEV_GYRO:
|
||||||
/* Making sure the other peripherals are not selected */
|
/* Making sure the other peripherals are not selected */
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected);
|
stm32_gpiowrite(GPIO_SPI_CS_GYRO, !selected);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PX4_SPIDEV_ACCEL:
|
case PX4_SPIDEV_ACCEL:
|
||||||
/* Making sure the other peripherals are not selected */
|
/* Making sure the other peripherals are not selected */
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, !selected);
|
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, !selected);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_MPU, 1);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PX4_SPIDEV_MPU:
|
case PX4_SPIDEV_MPU:
|
||||||
/* Making sure the other peripherals are not selected */
|
/* Making sure the other peripherals are not selected */
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_ACCEL, 1);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_GYRO, selected);
|
stm32_gpiowrite(GPIO_SPI_CS_GYRO, 1);
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_MPU, !selected);
|
stm32_gpiowrite(GPIO_SPI_CS_MPU, !selected);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -125,7 +125,7 @@ __EXPORT uint8_t stm32_spi1status(FAR struct spi_dev_s *dev, enum spi_dev_e devi
|
|||||||
__EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
__EXPORT void stm32_spi3select(FAR struct spi_dev_s *dev, enum spi_dev_e devid, bool selected)
|
||||||
{
|
{
|
||||||
/* there can only be one device on this bus, so always select it */
|
/* there can only be one device on this bus, so always select it */
|
||||||
stm32_gpiowrite(GPIO_SPI_CS_SDCARD, 0);
|
stm32_gpiowrite(GPIO_SPI_CS_SDCARD, !selected);
|
||||||
}
|
}
|
||||||
|
|
||||||
__EXPORT uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
__EXPORT uint8_t stm32_spi3status(FAR struct spi_dev_s *dev, enum spi_dev_e devid)
|
||||||
|
|||||||
Reference in New Issue
Block a user