43 #include "../CDev.hpp" 45 #include <px4_platform_common/i2c.h> 47 #if !defined(CONFIG_I2C) 48 # error I2C support requires CONFIG_I2C 64 I2C &operator=(
const I2C &) =
delete;
66 I2C &operator=(
I2C &&) =
delete;
68 virtual int init()
override;
70 static int set_bus_clock(
unsigned bus,
unsigned clock_hz);
72 static unsigned int _bus_clocks[BOARD_NUMBER_I2C_BUSES];
90 I2C(
const char *
name,
const char *devname,
const int bus,
const uint16_t address,
const uint32_t frequency);
96 virtual int probe() {
return PX4_OK; }
110 int transfer(
const uint8_t *
send,
const unsigned send_len, uint8_t *recv,
const unsigned recv_len);
112 virtual bool external()
const override {
return px4_i2c_bus_external(_device_id.devid_s.bus); }
115 uint32_t _frequency{0};
116 px4_i2c_dev_t *_dev{
nullptr};
Abstract class for character device on I2C.
virtual bool external() const override
Namespace encapsulating all device framework classes, functions and data.
virtual int probe()
Check for the presence of the device on the bus.
void init()
Activates/configures the hardware registers.