40 #include <px4_platform_common/px4_config.h> 47 #define HMC5883L_ADDRESS 0x1E 57 virtual int read(
unsigned address,
void *
data,
unsigned count);
58 virtual int write(
unsigned address,
void *data,
unsigned count);
60 virtual int ioctl(
unsigned operation,
unsigned &arg);
90 return CDev::ioctl(
nullptr, operation, arg);
102 uint8_t
data[3] = {0, 0, 0};
118 DEVICE_DEBUG(
"ID byte mismatch (%02x,%02x,%02x)", data[0], data[1], data[2]);
130 if (
sizeof(buf) < (count + 1)) {
135 memcpy(&buf[1], data, count);
137 return transfer(&buf[0], count + 1,
nullptr, 0);
143 uint8_t cmd = address;
144 return transfer(&cmd, 1, (uint8_t *)data, count);
#define MAGIOCGEXTERNAL
determine if mag is external or onboard
virtual ~HMC5883_I2C()=default
#define DRV_MAG_DEVTYPE_HMC5883
Sensor type definitions.
virtual int read(unsigned address, void *data, unsigned count)
device::Device * HMC5883_I2C_interface(int bus)
Generic device / sensor interface.
virtual int write(unsigned address, void *data, unsigned count)
Shared defines for the hmc5883 driver.
Fundamental base class for all physical drivers (I2C, SPI).
virtual int ioctl(unsigned operation, unsigned &arg)
#define DEVICE_DEBUG(FMT,...)
Base class for devices connected via I2C.