52 #include <px4_platform_common/defines.h> 55 #include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp> 62 #define RM3100_CONVERSION_INTERVAL 10000 // Microseconds, corresponds to 100 Hz (cycle count 200 on 3 axis) 63 #define UTESLA_TO_GAUSS 100.0f 64 #define RM3100_SENSITIVITY 75.0f 66 #define ADDR_POLL 0x00 71 #define ADDR_TMRC 0x0B 75 #define ADDR_BIST 0x33 76 #define ADDR_STATUS 0x34 77 #define ADDR_HSHAKE 0x35 78 #define ADDR_REVID 0x36 80 #define CCX_DEFAULT_MSB 0x00 81 #define CCX_DEFAULT_LSB 0xC8 82 #define CCY_DEFAULT_MSB CCX_DEFAULT_MSB 83 #define CCY_DEFAULT_LSB CCX_DEFAULT_LSB 84 #define CCZ_DEFAULT_MSB CCX_DEFAULT_MSB 85 #define CCZ_DEFAULT_LSB CCX_DEFAULT_LSB 86 #define CMM_DEFAULT 0x70 // No continuous mode 87 #define CONTINUOUS_MODE (1 << 0) 88 #define POLLING_MODE (0 << 0) 89 #define TMRC_DEFAULT 0x94 90 #define BIST_SELFTEST 0x8F 91 #define BIST_DEFAULT 0x00 92 #define BIST_XYZ_OK ((1 << 4) | (1 << 5) | (1 << 6)) 93 #define STATUS_DRDY (1 << 7) 95 #define RM3100_REVID 0x22 97 #define NUM_BUS_OPTIONS (sizeof(bus_options)/sizeof(bus_options[0])) 127 virtual int ioctl(
struct file *file_pointer,
int cmd,
unsigned long arg);
129 virtual int read(
struct file *file_pointer,
char *buffer,
size_t buffer_len);
perf_counter_t _conf_errors
int collect()
Collect the result of the most recent measurement.
virtual int read(struct file *file_pointer, char *buffer, size_t buffer_len)
int self_test()
Run sensor self-test.
perf_counter_t _sample_perf
bool _calibrated
the calibration is valid
void stop()
Stop the automatic measurement state machine.
device::Device * RM3100_I2C_interface(int bus)
enum OPERATING_MODE _mode
perf_counter_t _comms_errors
mag scaling factors; Vout = (Vin * Vscale) + Voffset
bool _continuous_mode_set
virtual int ioctl(struct file *file_pointer, int cmd, unsigned long arg)
Device(const Device &)=delete
struct mag_calibration_s _scale
High-resolution timer with callouts and timekeeping.
int reset()
Resets the device.
Abstract class for any character device.
int set_default_register_values()
Configures the device with default register values.
RM3100 operator=(const RM3100 &)
Rotation
Enum for board and external compass rotations.
void convert_signed(int32_t *n)
Converts int24_t stored in 32-bit container to int32_t.
RM3100(device::Device *interface, const char *path, enum Rotation rotation)
Simple error/warning functions, heavily inspired by the BSD functions of the same names...
void print_info()
Diagnostics - print some basic information about the driver.
unsigned int _measure_interval
__BEGIN_DECLS typedef void * orb_advert_t
ORB topic advertiser handle.
int check_measurement()
Check whether new data is available or not.
perf_counter_t _range_errors
ringbuffer::RingBuffer * _reports
void Run() override
Performs a poll cycle; collect from the previous measurement and start a new one. ...
int measure()
Issue a measurement command.
struct @83::@85::@87 file
Fundamental base class for all physical drivers (I2C, SPI).
void start()
Initialises the automatic measurement state machine and start it.
Performance measuring tools.
device::Device * RM3100_SPI_interface(int bus)
Base class for devices connected via I2C.