48 class MPU6000_I2C :
public device::I2C
51 MPU6000_I2C(
int bus,
int device_type);
52 ~MPU6000_I2C()
override =
default;
54 int read(
unsigned address,
void *
data,
unsigned count)
override;
55 int write(
unsigned address,
void *
data,
unsigned count)
override;
69 return new MPU6000_I2C(bus, device_type);
72 MPU6000_I2C::MPU6000_I2C(
int bus,
int device_type) :
73 I2C(
"MPU6000_I2C", nullptr, bus, PX4_I2C_MPU6050_ADDR, 400000),
74 _device_type(device_type)
83 if (
sizeof(cmd) < (count + 1)) {
88 cmd[1] = *(uint8_t *)data;
89 return transfer(&cmd[0], count + 1,
nullptr, 0);
103 int ret = transfer(&cmd, 1, &((uint8_t *)data)[offset], count);
104 return ret ==
OK ? count : ret;
static struct vehicle_status_s status
#define MPU_MAX_WRITE_BUFFER_SIZE
static void read(bootloader_app_shared_t *pshared)
Report conversation within the mpu, including command byte and interrupt status.
device::Device * MPU6000_I2C_interface(int bus, int device_type, bool external_bus)
static void write(bootloader_app_shared_t *pshared)
Fundamental base class for all physical drivers (I2C, SPI).
Base class for devices connected via I2C.