44 #include <drivers/device/i2c.h> 47 #include <drivers/drv_mag.h> 55 #ifndef CONFIG_SCHED_WORKQUEUE 56 # error This requires CONFIG_SCHED_WORKQUEUE. 64 #define RM3100_CONVERSION_INTERVAL 10000 // Microseconds, corresponds to 100 Hz (cycle count 200 on 3 axis) 65 #define UTESLA_TO_GAUSS 100.0f 66 #define RM3100_SENSITIVITY 75.0f 68 #define ADDR_POLL 0x00 73 #define ADDR_TMRC 0x0B 77 #define ADDR_BIST 0x33 78 #define ADDR_STATUS 0x34 79 #define ADDR_HSHAKE 0x35 80 #define ADDR_REVID 0x36 82 #define CCX_DEFAULT_MSB 0x00 83 #define CCX_DEFAULT_LSB 0xC8 84 #define CCY_DEFAULT_MSB CCX_DEFAULT_MSB 85 #define CCY_DEFAULT_LSB CCX_DEFAULT_LSB 86 #define CCZ_DEFAULT_MSB CCX_DEFAULT_MSB 87 #define CCZ_DEFAULT_LSB CCX_DEFAULT_LSB 88 #define CMM_DEFAULT 0x70 // No continuous mode 89 #define CONTINUOUS_MODE (1 << 0) 90 #define POLLING_MODE (0 << 0) 91 #define TMRC_DEFAULT 0x94 92 #define BIST_SELFTEST 0x8F 93 #define BIST_DEFAULT 0x00 94 #define BIST_XYZ_OK ((1 << 4) | (1 << 5) | (1 << 6)) 95 #define STATUS_DRDY (1 << 7) 97 #define RM3100_REVID 0x22 99 #define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0])) 108 RM3100_BUS_I2C_INTERNAL,
109 RM3100_BUS_I2C_EXTERNAL,
110 RM3100_BUS_SPI_INTERNAL,
111 RM3100_BUS_SPI_EXTERNAL
114 enum OPERATING_MODE {
129 virtual int ioctl(
struct file *file_pointer,
int cmd,
unsigned long arg);
131 virtual int read(
struct file *file_pointer,
char *
buffer,
size_t buffer_len);
154 ringbuffer::RingBuffer *_reports;
158 struct mag_report _last_report {};
169 bool _continuous_mode_set;
171 enum OPERATING_MODE _mode;
174 unsigned int _measure_ticks;
177 int _orb_class_instance;
181 uint8_t _check_state_cnt;
200 int check_measurement();
205 void convert_signed(int32_t *n);
228 static void cycle_trampoline(
void *arg);
A flexible ringbuffer class.
void stop()
Stop the automatic measurement state machine.
Definition: rm3100.cpp:619
void print_info()
Diagnostics - print some basic information about the driver.
Definition: rm3100.cpp:495
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
High-resolution timer with callouts and timekeeping.
Generally used magic defines.
Abstract class for any character device.
Definition: CDev.hpp:60
Rotation
Enum for board and external compass rotations.
Definition: rotation.h:51
Fundamental base class for all physical drivers (I2C, SPI).
Definition: Device.hpp:65
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
int set_default_register_values()
Configures the device with default register values.
Definition: rm3100.cpp:577
Definition: video_device.h:50
Performance measuring tools.