mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-31 10:26:52 +08:00
[DO NOT MERGE] px4_i2c_device_external hacks
This commit is contained in:
@@ -42,7 +42,17 @@ bool px4_i2c_bus_external(const px4_i2c_bus_t &bus)
|
||||
{
|
||||
return bus.is_external;
|
||||
}
|
||||
#endif
|
||||
#endif // BOARD_OVERRIDE_I2C_BUS_EXTERNAL
|
||||
|
||||
#ifndef BOARD_OVERRIDE_I2C_DEVICE_EXTERNAL
|
||||
#include <drivers/device/Device.hpp>
|
||||
bool px4_i2c_device_external(const uint32_t device_id)
|
||||
{
|
||||
device::Device::DeviceId dev_id{};
|
||||
dev_id.devid = device_id;
|
||||
return px4_i2c_bus_external(dev_id.devid_s.bus);
|
||||
}
|
||||
#endif // BOARD_OVERRIDE_I2C_DEVICE_EXTERNAL
|
||||
|
||||
bool I2CBusIterator::next()
|
||||
{
|
||||
|
||||
@@ -66,6 +66,11 @@ static inline bool px4_i2c_bus_external(int bus)
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* runtime-check if a board has a specific device as external.
|
||||
* This can be overridden by a board to add run-time checks.
|
||||
*/
|
||||
__EXPORT bool px4_i2c_device_external(const uint32_t device_id);
|
||||
|
||||
/**
|
||||
* @class I2CBusIterator
|
||||
|
||||
Reference in New Issue
Block a user