37 #include "drivers/drv_mag.h" 42 #define MPU9250_MAG_RANGE_GA 1.5e-3f; 46 #define MPU9250_AK8963_SAMPLE_RATE 100 50 #define AK8963_I2C_ADDR 0x0C 51 #define AK8963_DEVICE_ID 0x48 53 #define AK8963REG_WIA 0x00 54 #define AK8963REG_ST1 0x02 55 #define AK8963REG_HXL 0x03 56 #define AK8963REG_ASAX 0x10 57 #define AK8963REG_CNTL1 0x0A 58 #define AK8963REG_CNTL2 0x0B 60 #define AK8963_SINGLE_MEAS_MODE 0x01 61 #define AK8963_CONTINUOUS_MODE1 0x02 62 #define AK8963_CONTINUOUS_MODE2 0x06 63 #define AK8963_POWERDOWN_MODE 0x00 64 #define AK8963_SELFTEST_MODE 0x08 65 #define AK8963_FUZE_MODE 0x0F 66 #define AK8963_16BIT_ADC 0x10 67 #define AK8963_14BIT_ADC 0x00 68 #define AK8963_RESET 0x01 69 #define AK8963_HOFL 0x08 73 #define AK09916_DEVICE_ID_A 0x48 // same as AK8963 74 #define AK09916_DEVICE_ID_B 0x09 // additional ID byte ("INFO" on AK9063 without content specification.) 76 #define AK09916REG_HXL 0x11 77 #define AK09916REG_HXH 0x12 78 #define AK09916REG_HYL 0x13 79 #define AK09916REG_HYH 0x14 80 #define AK09916REG_HZL 0x15 81 #define AK09916REG_HZH 0x16 82 #define AK09916REG_ST1 0x10 83 #define AK09916REG_ST2 0x18 84 #define AK09916REG_CNTL2 0x31 85 #define AK09916REG_CNTL3 0x32 88 #define AK09916_CNTL2_POWERDOWN_MODE 0x00 89 #define AK09916_CNTL2_SINGLE_MODE 0x01 90 #define AK09916_CNTL2_CONTINOUS_MODE_10HZ 0x02 91 #define AK09916_CNTL2_CONTINOUS_MODE_20HZ 0x04 92 #define AK09916_CNTL2_CONTINOUS_MODE_50HZ 0x06 93 #define AK09916_CNTL2_CONTINOUS_MODE_100HZ 0x08 94 #define AK09916_CNTL2_SELFTEST_MODE 0x10 95 #define AK09916_CNTL3_SRST 0x01 96 #define AK09916_ST1_DRDY 0x01 97 #define AK09916_ST1_DOR 0x02 101 #pragma pack(push, 1) 111 #pragma pack(push, 1) 123 extern device::Device *AK8963_I2C_interface(
int bus,
bool external_bus);
137 virtual int ioctl(
struct file *filp,
int cmd,
unsigned long arg);
140 void set_passthrough(uint8_t reg, uint8_t size, uint8_t *out = NULL);
141 void passthrough_read(uint8_t reg, uint8_t *buf, uint8_t size);
142 void passthrough_write(uint8_t reg, uint8_t val);
143 void read_block(uint8_t reg, uint8_t *val, uint8_t count);
145 int ak8963_reset(
void);
146 int ak8963_setup(
void);
147 int ak8963_setup_master_i2c(
void);
148 bool ak8963_check_id(uint8_t &
id);
149 bool ak8963_read_adjustments(
void);
162 uint8_t read_reg(
unsigned reg);
163 void write_reg(
unsigned reg, uint8_t value);
165 bool is_passthrough() {
return _interface ==
nullptr; }
170 int _mag_orb_class_instance;
171 int _mag_class_instance;
172 bool _mag_reading_data;
173 ringbuffer::RingBuffer *_mag_reports;
175 float _mag_range_scale;
185 bool check_duplicate(uint8_t *mag_data);
188 uint8_t _last_mag_data[6];
A flexible ringbuffer class.
mag scaling factors; Vout = (Vin * Vscale) + Voffset
Definition: drv_mag.h:56
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
Definition: uORB.h:134
Abstract class for any character device.
Definition: CDev.hpp:60
Fundamental base class for all physical drivers (I2C, SPI).
Definition: Device.hpp:65
Definition: mpu9250.h:256
Helper class implementing the magnetometer driver node.
Definition: mag.h:131
Performance measuring tools.