|
|
|
@ -76,6 +76,7 @@ __EXPORT void stm32_spiinitialize(void)
@@ -76,6 +76,7 @@ __EXPORT void stm32_spiinitialize(void)
|
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_HMC5983); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_MS5611); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_ICM_20608_G); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_BMI160); |
|
|
|
|
|
|
|
|
|
/* De-activate all peripherals,
|
|
|
|
|
* required for some peripheral |
|
|
|
@ -85,6 +86,7 @@ __EXPORT void stm32_spiinitialize(void)
@@ -85,6 +86,7 @@ __EXPORT void stm32_spiinitialize(void)
|
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
|
|
|
|
|
px4_arch_configgpio(GPIO_DRDY_MPU9250); |
|
|
|
|
px4_arch_configgpio(GPIO_DRDY_HMC5983); |
|
|
|
@ -105,6 +107,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
@@ -105,6 +107,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
|
|
|
|
switch (devid) { |
|
|
|
|
case PX4_SPIDEV_ICM: |
|
|
|
|
/* Making sure the other peripherals are not selected */ |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MPU9250, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
@ -117,6 +120,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
@@ -117,6 +120,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
|
|
|
|
|
|
|
|
|
case PX4_SPIDEV_BARO: |
|
|
|
|
/* Making sure the other peripherals are not selected */ |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MPU9250, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, !selected); |
|
|
|
@ -125,6 +129,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
@@ -125,6 +129,7 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
|
|
|
|
|
|
|
|
|
case PX4_SPIDEV_HMC: |
|
|
|
|
/* Making sure the other peripherals are not selected */ |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MPU9250, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, !selected); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
@ -133,12 +138,22 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
@@ -133,12 +138,22 @@ __EXPORT void stm32_spi1select(FAR struct spi_dev_s *dev, enum spi_dev_e devid,
|
|
|
|
|
|
|
|
|
|
case PX4_SPIDEV_MPU: |
|
|
|
|
/* Making sure the other peripherals are not selected */ |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MPU9250, !selected); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
case PX4_SPIDEV_BMI: |
|
|
|
|
/* Making sure the other peripherals are not selected */ |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MPU9250, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, !selected); |
|
|
|
|
break; |
|
|
|
|
|
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
@ -187,11 +202,13 @@ __EXPORT void board_spi_reset(int ms)
@@ -187,11 +202,13 @@ __EXPORT void board_spi_reset(int ms)
|
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_OFF_HMC5983); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_OFF_MS5611); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_OFF_ICM_20608_G); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_OFF_BMI160); |
|
|
|
|
|
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_OFF_MPU9250, 0); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_OFF_HMC5983, 0); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_OFF_MS5611, 0); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_OFF_ICM_20608_G, 0); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_OFF_BMI160, 0); |
|
|
|
|
|
|
|
|
|
px4_arch_configgpio(GPIO_SPI1_SCK_OFF); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI1_MISO_OFF); |
|
|
|
@ -231,6 +248,7 @@ __EXPORT void board_spi_reset(int ms)
@@ -231,6 +248,7 @@ __EXPORT void board_spi_reset(int ms)
|
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_HMC5983); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_MS5611); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_ICM_20608_G); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI_CS_BMI160); |
|
|
|
|
|
|
|
|
|
/* De-activate all peripherals,
|
|
|
|
|
* required for some peripheral |
|
|
|
@ -240,6 +258,7 @@ __EXPORT void board_spi_reset(int ms)
@@ -240,6 +258,7 @@ __EXPORT void board_spi_reset(int ms)
|
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_HMC5983, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_MS5611, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_ICM_20608_G, 1); |
|
|
|
|
px4_arch_gpiowrite(GPIO_SPI_CS_BMI160, 1); |
|
|
|
|
|
|
|
|
|
px4_arch_configgpio(GPIO_SPI1_SCK); |
|
|
|
|
px4_arch_configgpio(GPIO_SPI1_MISO); |
|
|
|
|