move I2C bus clock defaults to board px4_i2c_buses

This commit is contained in:
Daniel Agar
2022-10-08 13:25:15 -04:00
parent 30150f723a
commit bb96343e8d
18 changed files with 77 additions and 141 deletions
@@ -38,17 +38,19 @@
#if defined(CONFIG_I2C)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;
@@ -38,17 +38,19 @@
#if defined(CONFIG_I2C)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;
@@ -37,17 +37,19 @@
#if defined(CONFIG_I2C)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;
@@ -37,17 +37,19 @@
#if defined(CONFIG_I2C)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;
@@ -36,19 +36,23 @@
#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)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;
}
#endif // CONFIG_I2C
@@ -38,17 +38,19 @@
#if defined(CONFIG_I2C)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusInternal(int bus, uint32_t max_speed_hz = 400'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = false;
return ret;
}
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus)
static inline constexpr px4_i2c_bus_t initI2CBusExternal(int bus, uint32_t max_speed_hz = 100'000)
{
px4_i2c_bus_t ret{};
ret.max_speed_hz = max_speed_hz;
ret.bus = bus;
ret.is_external = true;
return ret;