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 struct {
46  uint8_t addr;
47 } lis3mdl_t;
48 
52 typedef enum {
58 
62 typedef enum {
68 
72 typedef enum {
81 
85 typedef enum {
91 
95 typedef enum {
99 } lis3mdl_op_t;
100 
116 int lis3mdl_init(lis3mdl_t *dev, i2c_t i2c, uint8_t address,
117  lis3mdl_xy_mode_t xy_mode, lis3mdl_z_mode_t z_mode,
118  lis3mdl_odr_t odr, lis3mdl_scale_t scale,
119  lis3mdl_op_t op_mode);
120 
127 void lis3mdl_read_mag(const lis3mdl_t *dev, lis3mdl_3d_data_t *data);
128 
135 void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value);
136 
142 void lis3mdl_enable(const lis3mdl_t *dev);
143 
149 void lis3mdl_disable(const lis3mdl_t *dev);
150 
151 #ifdef __cplusplus
152 }
153 #endif
154 
155 #endif /* LIS3MDL_H */
156 
80.000Hz
Definition: lis3mdl.h:79
High-performance mode.
Definition: lis3mdl.h:55
int16_t z_axis
Magnometer data from z_axis.
Definition: lis3mdl.h:38
High-performance mode.
Definition: lis3mdl.h:65
20.000Hz
Definition: lis3mdl.h:77
+- 4 gauss
Definition: lis3mdl.h:86
+- 16 gauss
Definition: lis3mdl.h:89
Low-level GPIO peripheral driver interface definitions.
10.000Hz
Definition: lis3mdl.h:76
Device descriptor for LIS3MDL sensor.
Definition: lis3mdl.h:44
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:113
lis3mdl_scale_t
Scale [gauss] for LIS3MDL.
Definition: lis3mdl.h:85
3d data container of the LIS3MDL sensor
Definition: lis3mdl.h:35
void lis3mdl_enable(const lis3mdl_t *dev)
Enable the LIS3MDL device.
5.000Hz
Definition: lis3mdl.h:75
void lis3mdl_read_mag(const lis3mdl_t *dev, lis3mdl_3d_data_t *data)
Reads the magnometer value of LIS3MDL.
int16_t y_axis
Magnometer data from y_axis.
Definition: lis3mdl.h:37
40.000Hz
Definition: lis3mdl.h:78
+- 8 gauss
Definition: lis3mdl.h:87
lis3mdl_odr_t
Output data rate [Hz] for LIS3MDL.
Definition: lis3mdl.h:72
Single-conversion mode.
Definition: lis3mdl.h:97
lis3mdl_xy_mode_t
Operating mode of x- and y-axis for LIS3MDL.
Definition: lis3mdl.h:52
Low-power mode.
Definition: lis3mdl.h:63
void lis3mdl_read_temp(const lis3mdl_t *dev, int16_t *value)
Reads the temperature value of LIS3MDL.
void lis3mdl_disable(const lis3mdl_t *dev)
Disable the LIS3MDL device.
+- 12 gauss
Definition: lis3mdl.h:88
lis3mdl_z_mode_t
Operating mode of z-axis for LIS3MDL.
Definition: lis3mdl.h:62
Ultra-High-performance mode.
Definition: lis3mdl.h:56
i2c_t i2c
I2C device.
Definition: lis3mdl.h:45
Ultra-High-performance mode.
Definition: lis3mdl.h:66
Continous-conversion mode.
Definition: lis3mdl.h:96
Medium-performance mode.
Definition: lis3mdl.h:54
int lis3mdl_init(lis3mdl_t *dev, i2c_t i2c, uint8_t address, lis3mdl_xy_mode_t xy_mode, lis3mdl_z_mode_t z_mode, lis3mdl_odr_t odr, lis3mdl_scale_t scale, lis3mdl_op_t op_mode)
Initialize a new LIS3DML device.
uint8_t addr
Magnometer I2C address.
Definition: lis3mdl.h:46
Power-down mode.
Definition: lis3mdl.h:98
1.250Hz
Definition: lis3mdl.h:74
int16_t x_axis
Magnometer data from x-axis.
Definition: lis3mdl.h:36
Low-power mode.
Definition: lis3mdl.h:53
Medium-performance mode.
Definition: lis3mdl.h:64
lis3mdl_op_t
Operating modes.
Definition: lis3mdl.h:95
Low-level I2C peripheral driver interface definition.