mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-26 03:53:33 +08:00
i2c_spi_buses: respect CONFIG_I2C and CONFIG_SPI
- bmp280, dps310, and ms5611 barometers support boards without I2C
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
@@ -52,3 +53,4 @@ static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_I2C
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/spi.h>
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include <imxrt_gpio.h>
|
||||
|
||||
#define CS_IOMUX (IOMUX_CMOS_OUTPUT | IOMUX_PULL_UP_100K | IOMUX_DRIVE_33OHM | IOMUX_SPEED_LOW | IOMUX_SLEW_FAST)
|
||||
@@ -135,3 +137,4 @@ static inline constexpr SPI::bus_device_external_cfg_t initSPIConfigExternal(SPI
|
||||
ret.drdy_gpio = drdy_gpio;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -32,9 +32,12 @@
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include "../../../kinetis/include/px4_arch/spi_hw_description.h"
|
||||
|
||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX_BUS_ITEMS])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
@@ -52,3 +53,4 @@ static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_I2C
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/spi.h>
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include <kinetis.h>
|
||||
|
||||
static inline constexpr px4_spi_bus_device_t initSPIDevice(uint32_t devid, SPI::CS cs_gpio, SPI::DRDY drdy_gpio = {})
|
||||
@@ -129,3 +131,5 @@ static inline constexpr SPI::bus_device_external_cfg_t initSPIConfigExternal(SPI
|
||||
ret.drdy_gpio = drdy_gpio;
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -32,9 +32,12 @@
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include "../../../imxrt/include/px4_arch/spi_hw_description.h"
|
||||
|
||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX_BUS_ITEMS])
|
||||
{
|
||||
return true;
|
||||
}
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
px4_i2c_bus_t ret{};
|
||||
@@ -50,3 +52,4 @@ static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_I2C
|
||||
|
||||
@@ -35,6 +35,8 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
px4_i2c_bus_t ret{};
|
||||
@@ -50,3 +52,4 @@ static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_I2C
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/i2c.h>
|
||||
|
||||
#if defined(CONFIG_I2C)
|
||||
|
||||
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
|
||||
{
|
||||
@@ -52,3 +53,4 @@ static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
|
||||
ret.is_external = true;
|
||||
return ret;
|
||||
}
|
||||
#endif // CONFIG_I2C
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
#include <px4_arch/hw_description.h>
|
||||
#include <px4_platform_common/spi.h>
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include <stm32_gpio.h>
|
||||
|
||||
@@ -168,3 +169,5 @@ constexpr bool validateSPIConfig(const px4_spi_bus_all_hw_t spi_buses_conf[BOARD
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "../../../stm32_common/include/px4_arch/spi_hw_description.h"
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX_BUS_ITEMS])
|
||||
{
|
||||
const bool nuttx_enabled_spi_buses[] = {
|
||||
@@ -84,3 +86,5 @@ constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
****************************************************************************/
|
||||
#pragma once
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
#include "../../../stm32_common/include/px4_arch/spi_hw_description.h"
|
||||
|
||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX_BUS_ITEMS])
|
||||
@@ -84,3 +86,5 @@ constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
#include "../../../stm32_common/include/px4_arch/spi_hw_description.h"
|
||||
|
||||
#if defined(CONFIG_SPI)
|
||||
|
||||
constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX_BUS_ITEMS])
|
||||
{
|
||||
const bool nuttx_enabled_spi_buses[] = {
|
||||
@@ -84,3 +86,5 @@ constexpr bool validateSPIConfig(const px4_spi_bus_t spi_busses_conf[SPI_BUS_MAX
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif // CONFIG_SPI
|
||||
|
||||
Reference in New Issue
Block a user