mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
Bring up BMI160 for px4fmu-v4 targets
This commit is contained in:
parent
126172d70c
commit
10867131fa
@ -187,6 +187,11 @@ then
|
||||
if mpu9250 -R 2 start
|
||||
then
|
||||
fi
|
||||
|
||||
# Internal SPI bus BMI160
|
||||
if bmi160 start
|
||||
then
|
||||
fi
|
||||
fi
|
||||
|
||||
if ver hwcmp PX4FMU_V1
|
||||
|
||||
@ -84,6 +84,7 @@
|
||||
#define GPIO_SPI_CS_LIS3MDL (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTE|GPIO_PIN15)
|
||||
#define GPIO_SPI_CS_MS5611 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN7)
|
||||
#define GPIO_SPI_CS_ICM_20608_G (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN15)
|
||||
#define GPIO_SPI_CS_BMI160 (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTC|GPIO_PIN2)
|
||||
|
||||
#define GPIO_SPI_CS_FRAM (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_SET|GPIO_PORTD|GPIO_PIN10)
|
||||
|
||||
@ -106,6 +107,7 @@
|
||||
#define GPIO_SPI_CS_OFF_LIS3MDL _PIN_OFF(GPIO_SPI_CS_LIS3MDL)
|
||||
#define GPIO_SPI_CS_OFF_MS5611 _PIN_OFF(GPIO_SPI_CS_MS5611)
|
||||
#define GPIO_SPI_CS_OFF_ICM_20608_G _PIN_OFF(GPIO_SPI_CS_ICM_20608_G)
|
||||
#define GPIO_SPI_CS_OFF_BMI160 _PIN_OFF(GPIO_SPI_CS_BMI160)
|
||||
|
||||
#define GPIO_DRDY_OFF_MPU9250 _PIN_OFF(GPIO_DRDY_MPU9250)
|
||||
#define GPIO_DRDY_OFF_HMC5983 _PIN_OFF(GPIO_DRDY_HMC5983)
|
||||
|
||||
@ -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)
|
||||
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,
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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,
|
||||
|
||||
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)
|
||||
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)
|
||||
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)
|
||||
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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user