PX4 Firmware
PX4 Autopilot Software http://px4.io
HMC5883.hpp File Reference
#include <px4_platform_common/px4_config.h>
#include <px4_platform_common/defines.h>
#include <px4_platform_common/time.h>
#include <drivers/device/i2c.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdlib.h>
#include <stdbool.h>
#include <semaphore.h>
#include <string.h>
#include <fcntl.h>
#include <poll.h>
#include <errno.h>
#include <stdio.h>
#include <math.h>
#include <unistd.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <lib/perf/perf_counter.h>
#include <systemlib/err.h>
#include <drivers/drv_mag.h>
#include <drivers/drv_hrt.h>
#include <drivers/device/ringbuffer.h>
#include <drivers/drv_device.h>
#include <uORB/uORB.h>
#include <float.h>
#include <px4_platform_common/getopt.h>
#include <lib/conversion/rotation.h>
#include "hmc5883.h"
Include dependency graph for HMC5883.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  HMC5883
 
struct  HMC5883::_last_report
 used for info() More...
 

Macros

#define HMC5883_CONVERSION_INTERVAL   (1000000 / 150) /* microseconds */
 
#define ADDR_CONF_A   0x00
 
#define ADDR_CONF_B   0x01
 
#define ADDR_MODE   0x02
 
#define ADDR_DATA_OUT_X_MSB   0x03
 
#define ADDR_DATA_OUT_X_LSB   0x04
 
#define ADDR_DATA_OUT_Z_MSB   0x05
 
#define ADDR_DATA_OUT_Z_LSB   0x06
 
#define ADDR_DATA_OUT_Y_MSB   0x07
 
#define ADDR_DATA_OUT_Y_LSB   0x08
 
#define ADDR_STATUS   0x09
 
#define ADDR_TEMP_OUT_MSB   0x31
 
#define ADDR_TEMP_OUT_LSB   0x32
 
#define HMC5883L_MODE_NORMAL   (0 << 0) /* default */
 
#define HMC5883L_MODE_POSITIVE_BIAS   (1 << 0) /* positive bias */
 
#define HMC5883L_MODE_NEGATIVE_BIAS   (1 << 1) /* negative bias */
 
#define HMC5883L_AVERAGING_1   (0 << 5) /* conf a register */
 
#define HMC5883L_AVERAGING_2   (1 << 5)
 
#define HMC5883L_AVERAGING_4   (2 << 5)
 
#define HMC5883L_AVERAGING_8   (3 << 5)
 
#define MODE_REG_CONTINOUS_MODE   (0 << 0)
 
#define MODE_REG_SINGLE_MODE   (1 << 0) /* default */
 
#define STATUS_REG_DATA_OUT_LOCK   (1 << 1) /* page 16: set if data is only partially read, read device to reset */
 
#define STATUS_REG_DATA_READY   (1 << 0) /* page 16: set if all axes have valid measurements */
 
#define HMC5983_TEMP_SENSOR_ENABLE   (1 << 7)
 

Macro Definition Documentation

◆ ADDR_CONF_A

#define ADDR_CONF_A   0x00

◆ ADDR_CONF_B

#define ADDR_CONF_B   0x01

Definition at line 81 of file HMC5883.hpp.

Referenced by HMC5883::check_range(), and HMC5883::set_range().

◆ ADDR_DATA_OUT_X_LSB

#define ADDR_DATA_OUT_X_LSB   0x04

Definition at line 84 of file HMC5883.hpp.

◆ ADDR_DATA_OUT_X_MSB

#define ADDR_DATA_OUT_X_MSB   0x03

Definition at line 83 of file HMC5883.hpp.

Referenced by HMC5883::collect().

◆ ADDR_DATA_OUT_Y_LSB

#define ADDR_DATA_OUT_Y_LSB   0x08

Definition at line 88 of file HMC5883.hpp.

◆ ADDR_DATA_OUT_Y_MSB

#define ADDR_DATA_OUT_Y_MSB   0x07

Definition at line 87 of file HMC5883.hpp.

◆ ADDR_DATA_OUT_Z_LSB

#define ADDR_DATA_OUT_Z_LSB   0x06

Definition at line 86 of file HMC5883.hpp.

◆ ADDR_DATA_OUT_Z_MSB

#define ADDR_DATA_OUT_Z_MSB   0x05

Definition at line 85 of file HMC5883.hpp.

◆ ADDR_MODE

#define ADDR_MODE   0x02

Definition at line 82 of file HMC5883.hpp.

Referenced by HMC5883::measure().

◆ ADDR_STATUS

#define ADDR_STATUS   0x09

Definition at line 89 of file HMC5883.hpp.

Referenced by RM3100::check_measurement().

◆ ADDR_TEMP_OUT_LSB

#define ADDR_TEMP_OUT_LSB   0x32

Definition at line 93 of file HMC5883.hpp.

◆ ADDR_TEMP_OUT_MSB

#define ADDR_TEMP_OUT_MSB   0x31

Definition at line 92 of file HMC5883.hpp.

Referenced by HMC5883::collect().

◆ HMC5883_CONVERSION_INTERVAL

#define HMC5883_CONVERSION_INTERVAL   (1000000 / 150) /* microseconds */

Definition at line 78 of file HMC5883.hpp.

Referenced by HMC5883::ioctl(), HMC5883::read(), and HMC5883::Run().

◆ HMC5883L_AVERAGING_1

#define HMC5883L_AVERAGING_1   (0 << 5) /* conf a register */

Definition at line 100 of file HMC5883.hpp.

◆ HMC5883L_AVERAGING_2

#define HMC5883L_AVERAGING_2   (1 << 5)

Definition at line 101 of file HMC5883.hpp.

◆ HMC5883L_AVERAGING_4

#define HMC5883L_AVERAGING_4   (2 << 5)

Definition at line 102 of file HMC5883.hpp.

◆ HMC5883L_AVERAGING_8

#define HMC5883L_AVERAGING_8   (3 << 5)

Definition at line 103 of file HMC5883.hpp.

◆ HMC5883L_MODE_NEGATIVE_BIAS

#define HMC5883L_MODE_NEGATIVE_BIAS   (1 << 1) /* negative bias */

Definition at line 98 of file HMC5883.hpp.

◆ HMC5883L_MODE_NORMAL

#define HMC5883L_MODE_NORMAL   (0 << 0) /* default */

Definition at line 96 of file HMC5883.hpp.

◆ HMC5883L_MODE_POSITIVE_BIAS

#define HMC5883L_MODE_POSITIVE_BIAS   (1 << 0) /* positive bias */

Definition at line 97 of file HMC5883.hpp.

◆ HMC5983_TEMP_SENSOR_ENABLE

#define HMC5983_TEMP_SENSOR_ENABLE   (1 << 7)

Definition at line 111 of file HMC5883.hpp.

Referenced by HMC5883::collect(), and HMC5883::set_temperature_compensation().

◆ MODE_REG_CONTINOUS_MODE

#define MODE_REG_CONTINOUS_MODE   (0 << 0)

Definition at line 105 of file HMC5883.hpp.

Referenced by LIS3MDL::measure().

◆ MODE_REG_SINGLE_MODE

#define MODE_REG_SINGLE_MODE   (1 << 0) /* default */

Definition at line 106 of file HMC5883.hpp.

Referenced by LIS3MDL::measure(), and HMC5883::measure().

◆ STATUS_REG_DATA_OUT_LOCK

#define STATUS_REG_DATA_OUT_LOCK   (1 << 1) /* page 16: set if data is only partially read, read device to reset */

Definition at line 108 of file HMC5883.hpp.

◆ STATUS_REG_DATA_READY

#define STATUS_REG_DATA_READY   (1 << 0) /* page 16: set if all axes have valid measurements */

Definition at line 109 of file HMC5883.hpp.