42 #include <px4_platform_common/px4_config.h> 45 #if defined(PX4_I2C_OBDEV_BMP280) || defined(PX4_I2C_EXT_OBDEV_BMP280) 50 BMP280_I2C(uint8_t bus, uint32_t
device);
51 virtual ~BMP280_I2C()
override =
default;
55 uint8_t
get_reg(uint8_t addr)
override;
56 int set_reg(uint8_t value, uint8_t addr)
override;
61 uint32_t
get_device_id()
const override {
return device::I2C::get_device_id(); }
70 return new BMP280_I2C(busnum, device);
73 BMP280_I2C::BMP280_I2C(uint8_t bus, uint32_t
device) :
74 I2C(
"BMP280_I2C", nullptr, bus, device, 100 * 1000)
79 BMP280_I2C::get_reg(uint8_t addr)
81 uint8_t cmd[2] = { (uint8_t)(addr), 0};
82 transfer(&cmd[0], 1, &cmd[1], 1);
88 BMP280_I2C::set_reg(uint8_t value, uint8_t addr)
90 uint8_t cmd[2] = { (uint8_t)(addr), value};
91 return transfer(cmd,
sizeof(cmd),
nullptr, 0);
95 BMP280_I2C::get_data(uint8_t addr)
97 const uint8_t cmd = addr;
108 BMP280_I2C::get_calibration(uint8_t addr)
110 const uint8_t cmd = addr;
virtual int set_reg(uint8_t value, uint8_t addr)=0
bmp280::calibration_s * _cal
virtual bmp280::data_s * get_data(uint8_t addr)=0
Shared defines for the bmp280 driver.
Namespace encapsulating all device framework classes, functions and data.
virtual bmp280::calibration_s * get_calibration(uint8_t addr)=0
bmp280::IBMP280 * bmp280_i2c_interface(uint8_t busnum, uint32_t device)
virtual uint8_t get_reg(uint8_t addr)=0
void init()
Activates/configures the hardware registers.
virtual uint32_t get_device_id() const =0
static struct mpu9x50_data _data
IMU measurement data.
Base class for devices connected via I2C.