Loading...
Searching...
No Matches

Device driver for the LIS3MDL 3-axis magnetometer. More...

Detailed Description

Device driver for the LIS3MDL 3-axis magnetometer.

This driver provides [S]ensor [A]ctuator [U]ber [L]ayer capabilities.

Files

file  lis3mdl.h
 Device driver interface for the LIS3MDL 3-axis magnetometer.
 
file  lis3mdl-internal.h
 Definitions for the LIS3MDL 3-axis magnetometer.
 
file  lis3mdl_params.h
 Default configuration for LIS3MDL devices.
 

Data Structures

struct  lis3mdl_3d_data_t
 3d data container of the LIS3MDL sensor More...
 
struct  lis3mdl_params_t
 Device initialization parameters. More...
 
struct  lis3mdl_t
 Device descriptor for LIS3MDL sensor. More...
 

Enumerations

enum  lis3mdl_xy_mode_t { LIS3MDL_XY_MODE_LOW = 0x00 , LIS3MDL_XY_MODE_MEDIUM = 0x20 , LIS3MDL_XY_MODE_HIGH = 0x40 , LIS3MDL_XY_MODE_ULTRA = 0x60 }
 Operating mode of x- and y-axis for LIS3MDL. More...
 
enum  lis3mdl_z_mode_t { LIS3MDL_Z_MODE_LOW = 0x00 , LIS3MDL_Z_MODE_MEDIUM = 0x04 , LIS3MDL_Z_MODE_HIGH = 0x08 , LIS3MDL_Z_MODE_ULTRA = 0x0C }
 Operating mode of z-axis for LIS3MDL. More...
 
enum  lis3mdl_odr_t {
  LIS3MDL_ODR_0_625Hz = 0x00 , LIS3MDL_ODR_1_25Hz = 0x04 , LIS3MDL_ODR_2_5Hz = 0x08 , LIS3MDL_ODR_10Hz = 0x10 ,
  LIS3DML_ODR_20HZ = 0x14 , LIS3DML_ODR_40HZ = 0x18 , LIS3MDL_ODR_80HZ = 0x1C
}
 Output data rate [Hz] for LIS3MDL. More...
 
enum  lis3mdl_scale_t { LIS3MDL_SCALE_4G = 0x00 , LIS3MDL_SCALE_8G = 0x20 , LIS3MDL_SCALE_12G = 0x40 , LIS3MDL_SCALE_16G = 0x60 }
 Scale [gauss] for LIS3MDL. More...
 
enum  lis3mdl_op_t { LIS3MDL_OP_CONT_CONV = 0x00 , LIS3MDL_OP_SNGL_CONV = 0x01 , LIS3MDL_OP_PDOWN = 0x11 }
 Operating modes. More...
 

Functions

int lis3mdl_init (lis3mdl_t *dev, const lis3mdl_params_t *params)
 Initialize a new LIS3DML device.
 
void lis3mdl_read_mag (const lis3mdl_t *dev, lis3mdl_3d_data_t *data)
 Reads the magnometer value of LIS3MDL.
 
void lis3mdl_read_temp (const lis3mdl_t *dev, int16_t *value)
 Reads the temperature value of LIS3MDL.
 
void lis3mdl_enable (const lis3mdl_t *dev)
 Enable the LIS3MDL device.
 
void lis3mdl_disable (const lis3mdl_t *dev)
 Disable the LIS3MDL device.
 

Enumeration Type Documentation

◆ lis3mdl_odr_t

Output data rate [Hz] for LIS3MDL.

Enumerator
LIS3MDL_ODR_0_625Hz 

0.625Hz

LIS3MDL_ODR_1_25Hz 

1.250Hz

LIS3MDL_ODR_2_5Hz 

5.000Hz

LIS3MDL_ODR_10Hz 

10.000Hz

LIS3DML_ODR_20HZ 

20.000Hz

LIS3DML_ODR_40HZ 

40.000Hz

LIS3MDL_ODR_80HZ 

80.000Hz

Definition at line 67 of file lis3mdl.h.

◆ lis3mdl_op_t

Operating modes.

Enumerator
LIS3MDL_OP_CONT_CONV 

Continous-conversion mode.

LIS3MDL_OP_SNGL_CONV 

Single-conversion mode.

LIS3MDL_OP_PDOWN 

Power-down mode.

Definition at line 90 of file lis3mdl.h.

◆ lis3mdl_scale_t

Scale [gauss] for LIS3MDL.

Enumerator
LIS3MDL_SCALE_4G 

+- 4 gauss

LIS3MDL_SCALE_8G 

+- 8 gauss

LIS3MDL_SCALE_12G 

+- 12 gauss

LIS3MDL_SCALE_16G 

+- 16 gauss

Definition at line 80 of file lis3mdl.h.

◆ lis3mdl_xy_mode_t

Operating mode of x- and y-axis for LIS3MDL.

Enumerator
LIS3MDL_XY_MODE_LOW 

Low-power mode.

LIS3MDL_XY_MODE_MEDIUM 

Medium-performance mode.

LIS3MDL_XY_MODE_HIGH 

High-performance mode.

LIS3MDL_XY_MODE_ULTRA 

Ultra-High-performance mode.

Definition at line 47 of file lis3mdl.h.

◆ lis3mdl_z_mode_t

Operating mode of z-axis for LIS3MDL.

Enumerator
LIS3MDL_Z_MODE_LOW 

Low-power mode.

LIS3MDL_Z_MODE_MEDIUM 

Medium-performance mode.

LIS3MDL_Z_MODE_HIGH 

High-performance mode.

LIS3MDL_Z_MODE_ULTRA 

Ultra-High-performance mode.

Definition at line 57 of file lis3mdl.h.

Function Documentation

◆ lis3mdl_disable()

void lis3mdl_disable ( const lis3mdl_t dev)

Disable the LIS3MDL device.

Parameters
[in]devdevice descriptor of LIS3MDL

◆ lis3mdl_enable()

void lis3mdl_enable ( const lis3mdl_t dev)

Enable the LIS3MDL device.

Parameters
[in]devdevice descriptor of LIS3MDL

◆ lis3mdl_init()

int lis3mdl_init ( lis3mdl_t dev,
const lis3mdl_params_t params 
)

Initialize a new LIS3DML device.

Parameters
[in]devdevice descriptor of LIS3MDL
[in]paramsinitialization parameters
Returns
0 on success
-1 on error

◆ lis3mdl_read_mag()

void lis3mdl_read_mag ( const lis3mdl_t dev,
lis3mdl_3d_data_t data 
)

Reads the magnometer value of LIS3MDL.

Parameters
[in]devdevice descriptor of LIS3MDL
[in]datameasured magnetometer data

◆ lis3mdl_read_temp()

void lis3mdl_read_temp ( const lis3mdl_t dev,
int16_t *  value 
)

Reads the temperature value of LIS3MDL.

Parameters
[in]devdevice descriptor of LIS3MDL
[in]valuemeasured temperature in degree celsius