PX4 Firmware
PX4 Autopilot Software http://px4.io
lis3mdl.h File Reference

Shared defines for the LIS3MDL driver. More...

#include <float.h>
#include <drivers/device/i2c.h>
#include <drivers/device/ringbuffer.h>
#include <drivers/drv_hrt.h>
#include <drivers/drv_mag.h>
#include <lib/conversion/rotation.h>
#include <systemlib/err.h>
#include <px4_platform_common/px4_work_queue/ScheduledWorkItem.hpp>
#include <perf/perf_counter.h>
#include <px4_platform_common/defines.h>
Include dependency graph for lis3mdl.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

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

Macros

#define LIS3MDL_CONVERSION_INTERVAL   (1000000 / 80) /* 12,500 microseconds */
 LIS3MDL internal constants and data structures. More...
 
#define NUM_BUS_OPTIONS   (sizeof(lis3mdl::bus_options)/sizeof(lis3mdl::bus_options[0]))
 
#define ADDR_WHO_AM_I   0x0f
 
#define ID_WHO_AM_I   0x3d
 
#define ADDR_CTRL_REG1   0x20
 
#define ADDR_CTRL_REG2   0x21
 
#define ADDR_CTRL_REG3   0x22
 
#define ADDR_CTRL_REG4   0x23
 
#define ADDR_CTRL_REG5   0x24
 
#define ADDR_STATUS_REG   0x27
 
#define ADDR_OUT_X_L   0x28
 
#define ADDR_OUT_X_H   0x29
 
#define ADDR_OUT_Y_L   0x2a
 
#define ADDR_OUT_Y_H   0x2b
 
#define ADDR_OUT_Z_L   0x2c
 
#define ADDR_OUT_Z_H   0x2d
 
#define ADDR_OUT_T_L   0x2e
 
#define ADDR_OUT_T_H   0x2f
 
#define MODE_REG_CONTINOUS_MODE   (0 << 0)
 
#define MODE_REG_SINGLE_MODE   (1 << 0) /* default */
 
#define CNTL_REG1_DEFAULT   0xFC
 
#define CNTL_REG2_DEFAULT   0x00
 
#define CNTL_REG3_DEFAULT   0x00
 
#define CNTL_REG4_DEFAULT   0x0C
 
#define CNTL_REG5_DEFAULT   0x00
 

Typedefs

typedef device::Device *(* LIS3MDL_constructor) (int)
 

Enumerations

enum  LIS3MDL_BUS { LIS3MDL_BUS_ALL = 0, LIS3MDL_BUS_I2C_INTERNAL, LIS3MDL_BUS_I2C_EXTERNAL, LIS3MDL_BUS_SPI }
 
enum  OPERATING_MODE { CONTINUOUS = 0, SINGLE, CONTINUOUS = 0, SINGLE }
 

Functions

device::DeviceLIS3MDL_SPI_interface (int bus)
 
device::DeviceLIS3MDL_I2C_interface (int bus)
 

Detailed Description

Shared defines for the LIS3MDL driver.

Definition in file lis3mdl.h.

Macro Definition Documentation

◆ ADDR_CTRL_REG1

#define ADDR_CTRL_REG1   0x20

Definition at line 68 of file lis3mdl.h.

◆ ADDR_CTRL_REG2

#define ADDR_CTRL_REG2   0x21

Definition at line 69 of file lis3mdl.h.

◆ ADDR_CTRL_REG3

#define ADDR_CTRL_REG3   0x22

Definition at line 70 of file lis3mdl.h.

◆ ADDR_CTRL_REG4

#define ADDR_CTRL_REG4   0x23

Definition at line 71 of file lis3mdl.h.

◆ ADDR_CTRL_REG5

#define ADDR_CTRL_REG5   0x24

Definition at line 72 of file lis3mdl.h.

◆ ADDR_OUT_T_H

#define ADDR_OUT_T_H   0x2f

Definition at line 82 of file lis3mdl.h.

◆ ADDR_OUT_T_L

#define ADDR_OUT_T_L   0x2e

Definition at line 81 of file lis3mdl.h.

Referenced by LIS3MDL::collect().

◆ ADDR_OUT_X_H

#define ADDR_OUT_X_H   0x29

Definition at line 76 of file lis3mdl.h.

◆ ADDR_OUT_X_L

#define ADDR_OUT_X_L   0x28

Definition at line 75 of file lis3mdl.h.

◆ ADDR_OUT_Y_H

#define ADDR_OUT_Y_H   0x2b

Definition at line 78 of file lis3mdl.h.

◆ ADDR_OUT_Y_L

#define ADDR_OUT_Y_L   0x2a

Definition at line 77 of file lis3mdl.h.

◆ ADDR_OUT_Z_H

#define ADDR_OUT_Z_H   0x2d

Definition at line 80 of file lis3mdl.h.

◆ ADDR_OUT_Z_L

#define ADDR_OUT_Z_L   0x2c

Definition at line 79 of file lis3mdl.h.

◆ ADDR_STATUS_REG

#define ADDR_STATUS_REG   0x27

Definition at line 74 of file lis3mdl.h.

◆ ADDR_WHO_AM_I

#define ADDR_WHO_AM_I   0x0f

Definition at line 65 of file lis3mdl.h.

◆ CNTL_REG1_DEFAULT

#define CNTL_REG1_DEFAULT   0xFC

Definition at line 87 of file lis3mdl.h.

Referenced by LIS3MDL::LIS3MDL(), and LIS3MDL::set_default_register_values().

◆ CNTL_REG2_DEFAULT

#define CNTL_REG2_DEFAULT   0x00

Definition at line 88 of file lis3mdl.h.

Referenced by LIS3MDL::LIS3MDL(), and LIS3MDL::set_default_register_values().

◆ CNTL_REG3_DEFAULT

#define CNTL_REG3_DEFAULT   0x00

Definition at line 89 of file lis3mdl.h.

Referenced by LIS3MDL::LIS3MDL(), and LIS3MDL::set_default_register_values().

◆ CNTL_REG4_DEFAULT

#define CNTL_REG4_DEFAULT   0x0C

Definition at line 90 of file lis3mdl.h.

Referenced by LIS3MDL::LIS3MDL(), and LIS3MDL::set_default_register_values().

◆ CNTL_REG5_DEFAULT

#define CNTL_REG5_DEFAULT   0x00

Definition at line 91 of file lis3mdl.h.

Referenced by LIS3MDL::LIS3MDL(), and LIS3MDL::set_default_register_values().

◆ ID_WHO_AM_I

#define ID_WHO_AM_I   0x3d

Definition at line 66 of file lis3mdl.h.

◆ LIS3MDL_CONVERSION_INTERVAL

#define LIS3MDL_CONVERSION_INTERVAL   (1000000 / 80) /* 12,500 microseconds */

LIS3MDL internal constants and data structures.

Definition at line 61 of file lis3mdl.h.

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

◆ MODE_REG_CONTINOUS_MODE

#define MODE_REG_CONTINOUS_MODE   (0 << 0)

Definition at line 84 of file lis3mdl.h.

◆ MODE_REG_SINGLE_MODE

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

Definition at line 85 of file lis3mdl.h.

◆ NUM_BUS_OPTIONS

#define NUM_BUS_OPTIONS   (sizeof(lis3mdl::bus_options)/sizeof(lis3mdl::bus_options[0]))

Definition at line 63 of file lis3mdl.h.

Typedef Documentation

◆ LIS3MDL_constructor

typedef device::Device*(* LIS3MDL_constructor) (int)

Definition at line 96 of file lis3mdl.h.

Enumeration Type Documentation

◆ LIS3MDL_BUS

Enumerator
LIS3MDL_BUS_ALL 
LIS3MDL_BUS_I2C_INTERNAL 
LIS3MDL_BUS_I2C_EXTERNAL 
LIS3MDL_BUS_SPI 

Definition at line 98 of file lis3mdl.h.

◆ OPERATING_MODE

Enumerator
CONTINUOUS 
SINGLE 
CONTINUOUS 
SINGLE 

Definition at line 105 of file lis3mdl.h.

Function Documentation

◆ LIS3MDL_I2C_interface()

device::Device* LIS3MDL_I2C_interface ( int  bus)

◆ LIS3MDL_SPI_interface()

device::Device* LIS3MDL_SPI_interface ( int  bus)