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 
21 #ifndef LIS3MDL_H
22 #define LIS3MDL_H
23 
24 #include <stdint.h>
25 #include "periph/i2c.h"
26 #include "periph/gpio.h"
27 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
35 typedef struct {
36  int16_t x_axis;
37  int16_t y_axis;
38  int16_t z_axis;
40 
44 typedef enum {
50 
54 typedef enum {
60 
64 typedef enum {
73 
77 typedef enum {
83 
87 typedef enum {
91 } lis3mdl_op_t;
92 
96 typedef struct {
98  uint8_t addr;
105 
106 
110 typedef struct {
112 } lis3mdl_t;
113 
123 int lis3mdl_init(lis3mdl_t *dev, const lis3mdl_params_t *params);
124 
131 void lis3mdl_read_mag(const lis3mdl_t *dev, lis3mdl_3d_data_t *data);
132 
139 void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value);
140 
146 void lis3mdl_enable(const lis3mdl_t *dev);
147 
153 void lis3mdl_disable(const lis3mdl_t *dev);
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* LIS3MDL_H */
160 
lis3mdl_xy_mode_t
Operating mode of x- and y-axis for LIS3MDL.
Definition: lis3mdl.h:44
Low-power mode.
Definition: lis3mdl.h:55
5.000Hz
Definition: lis3mdl.h:67
uint8_t addr
Magnometer I2C address.
Definition: lis3mdl.h:98
int16_t z_axis
Magnometer data from z_axis.
Definition: lis3mdl.h:38
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:101
Low-level GPIO peripheral driver interface definitions.
lis3mdl_odr_t
Output data rate [Hz] for LIS3MDL.
Definition: lis3mdl.h:64
lis3mdl_z_mode_t
Operating mode of z-axis for LIS3MDL.
Definition: lis3mdl.h:54
Device descriptor for LIS3MDL sensor.
Definition: lis3mdl.h:110
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:108
lis3mdl_scale_t scale
Scale factor.
Definition: lis3mdl.h:102
lis3mdl_scale_t
Scale [gauss] for LIS3MDL.
Definition: lis3mdl.h:77
3d data container of the LIS3MDL sensor
Definition: lis3mdl.h:35
i2c_t i2c
I2C device.
Definition: lis3mdl.h:97
int16_t y_axis
Magnometer data from y_axis.
Definition: lis3mdl.h:37
+- 8 gauss
Definition: lis3mdl.h:79
+- 4 gauss
Definition: lis3mdl.h:78
80.000Hz
Definition: lis3mdl.h:71
+- 12 gauss
Definition: lis3mdl.h:80
lis3mdl_params_t params
Initialization parameters.
Definition: lis3mdl.h:111
Ultra-High-performance mode.
Definition: lis3mdl.h:58
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:100
Low-power mode.
Definition: lis3mdl.h:45
20.000Hz
Definition: lis3mdl.h:69
void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value)
Reads the temperature value of LIS3MDL.
Device initialization parameters.
Definition: lis3mdl.h:96
10.000Hz
Definition: lis3mdl.h:68
+- 16 gauss
Definition: lis3mdl.h:81
Single-conversion mode.
Definition: lis3mdl.h:89
High-performance mode.
Definition: lis3mdl.h:57
lis3mdl_xy_mode_t xy_mode
Power mode of x- and y-axis.
Definition: lis3mdl.h:99
40.000Hz
Definition: lis3mdl.h:70
lis3mdl_op_t op_mode
Operation mode.
Definition: lis3mdl.h:103
lis3mdl_op_t
Operating modes.
Definition: lis3mdl.h:87
High-performance mode.
Definition: lis3mdl.h:47
Power-down mode.
Definition: lis3mdl.h:90
Continous-conversion mode.
Definition: lis3mdl.h:88
int16_t x_axis
Magnometer data from x-axis.
Definition: lis3mdl.h:36
void lis3mdl_enable(const lis3mdl_t *dev)
Enable the LIS3MDL device.
1.250Hz
Definition: lis3mdl.h:66
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:48
Medium-performance mode.
Definition: lis3mdl.h:46
Medium-performance mode.
Definition: lis3mdl.h:56
Low-level I2C peripheral driver interface definition.