40 #include <px4_platform_common/px4_config.h> 50 class ICM20948_I2C :
public device::I2C
53 ICM20948_I2C(
int bus, uint32_t address);
54 ~ICM20948_I2C()
override =
default;
56 int read(
unsigned address,
void *
data,
unsigned count)
override;
57 int write(
unsigned address,
void *
data,
unsigned count)
override;
69 return new ICM20948_I2C(bus, address);
72 ICM20948_I2C::ICM20948_I2C(
int bus, uint32_t address) :
73 I2C(
"ICM20948_I2C", nullptr, bus, address, 400000)
83 if (
sizeof(cmd) < (count + 1)) {
88 cmd[1] = *(uint8_t *)data;
89 return transfer(&cmd[0], count + 1,
nullptr, 0);
103 return transfer(&cmd, 1, &((uint8_t *)data)[offset], count);
static struct vehicle_status_s status
#define ICMREG_20948_WHOAMI
static void read(bootloader_app_shared_t *pshared)
Generic device / sensor interface.
Report conversation within the mpu, including command byte and interrupt status.
static void write(bootloader_app_shared_t *pshared)
device::Device * ICM20948_I2C_interface(int bus, uint32_t address)
Fundamental base class for all physical drivers (I2C, SPI).
#define ICMREG_20948_BANK_SEL
#define DRV_DEVTYPE_ICM20948
Base class for devices connected via I2C.