lis3mdl.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
24 #ifndef LIS3MDL_H
25 #define LIS3MDL_H
26 
27 #include <stdint.h>
28 #include "periph/i2c.h"
29 #include "periph/gpio.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
38 typedef struct {
39  int16_t x_axis;
40  int16_t y_axis;
41  int16_t z_axis;
43 
47 typedef enum {
53 
57 typedef enum {
63 
67 typedef enum {
76 
80 typedef enum {
86 
90 typedef enum {
94 } lis3mdl_op_t;
95 
99 typedef struct {
101  uint8_t addr;
108 
109 
113 typedef struct {
115 } lis3mdl_t;
116 
126 int lis3mdl_init(lis3mdl_t *dev, const lis3mdl_params_t *params);
127 
134 void lis3mdl_read_mag(const lis3mdl_t *dev, lis3mdl_3d_data_t *data);
135 
142 void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value);
143 
149 void lis3mdl_enable(const lis3mdl_t *dev);
150 
156 void lis3mdl_disable(const lis3mdl_t *dev);
157 
158 #ifdef __cplusplus
159 }
160 #endif
161 
162 #endif /* LIS3MDL_H */
163 
lis3mdl_xy_mode_t
Operating mode of x- and y-axis for LIS3MDL.
Definition: lis3mdl.h:47
Low-power mode.
Definition: lis3mdl.h:58
5.000Hz
Definition: lis3mdl.h:70
uint8_t addr
Magnometer I2C address.
Definition: lis3mdl.h:101
int16_t z_axis
Magnometer data from z_axis.
Definition: lis3mdl.h:41
int lis3mdl_init(lis3mdl_t *dev, const lis3mdl_params_t *params)
Initialize a new LIS3DML device.
lis3mdl_odr_t odr
Output data rate.
Definition: lis3mdl.h:104
Low-level GPIO peripheral driver interface definitions.
lis3mdl_odr_t
Output data rate [Hz] for LIS3MDL.
Definition: lis3mdl.h:67
lis3mdl_z_mode_t
Operating mode of z-axis for LIS3MDL.
Definition: lis3mdl.h:57
Device descriptor for LIS3MDL sensor.
Definition: lis3mdl.h:113
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:157
lis3mdl_scale_t scale
Scale factor.
Definition: lis3mdl.h:105
lis3mdl_scale_t
Scale [gauss] for LIS3MDL.
Definition: lis3mdl.h:80
3d data container of the LIS3MDL sensor
Definition: lis3mdl.h:38
i2c_t i2c
I2C device.
Definition: lis3mdl.h:100
int16_t y_axis
Magnometer data from y_axis.
Definition: lis3mdl.h:40
+- 8 gauss
Definition: lis3mdl.h:82
+- 4 gauss
Definition: lis3mdl.h:81
80.000Hz
Definition: lis3mdl.h:74
+- 12 gauss
Definition: lis3mdl.h:83
lis3mdl_params_t params
Initialization parameters.
Definition: lis3mdl.h:114
Ultra-High-performance mode.
Definition: lis3mdl.h:61
void lis3mdl_disable(const lis3mdl_t *dev)
Disable the LIS3MDL device.
lis3mdl_z_mode_t z_mode
Power mode of z-axis.
Definition: lis3mdl.h:103
Low-power mode.
Definition: lis3mdl.h:48
20.000Hz
Definition: lis3mdl.h:72
void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value)
Reads the temperature value of LIS3MDL.
Device initialization parameters.
Definition: lis3mdl.h:99
10.000Hz
Definition: lis3mdl.h:71
+- 16 gauss
Definition: lis3mdl.h:84
Single-conversion mode.
Definition: lis3mdl.h:92
High-performance mode.
Definition: lis3mdl.h:60
lis3mdl_xy_mode_t xy_mode
Power mode of x- and y-axis.
Definition: lis3mdl.h:102
40.000Hz
Definition: lis3mdl.h:73
lis3mdl_op_t op_mode
Operation mode.
Definition: lis3mdl.h:106
lis3mdl_op_t
Operating modes.
Definition: lis3mdl.h:90
High-performance mode.
Definition: lis3mdl.h:50
Power-down mode.
Definition: lis3mdl.h:93
Continous-conversion mode.
Definition: lis3mdl.h:91
int16_t x_axis
Magnometer data from x-axis.
Definition: lis3mdl.h:39
void lis3mdl_enable(const lis3mdl_t *dev)
Enable the LIS3MDL device.
1.250Hz
Definition: lis3mdl.h:69
void lis3mdl_read_mag(const lis3mdl_t *dev, lis3mdl_3d_data_t *data)
Reads the magnometer value of LIS3MDL.
Ultra-High-performance mode.
Definition: lis3mdl.h:51
Medium-performance mode.
Definition: lis3mdl.h:49
Medium-performance mode.
Definition: lis3mdl.h:59
Low-level I2C peripheral driver interface definition.