dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_bmm150_priv.h
Go to the documentation of this file.
1 
13 /*
14  * This program is free software; you can redistribute it and/or modify
15  * it under the terms of the GNU General Public License as published by
16  * the Free Software Foundation; either version 3 of the License, or
17  * (at your option) any later version.
18  *
19  * This program is distributed in the hope that it will be useful, but
20  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  * for more details.
23  *
24  * You should have received a copy of the GNU General Public License along
25  * with this program; if not, see <http://www.gnu.org/licenses/>
26  */
27 
28 #ifndef PIOS_BMM150_PRIV_H
29 #define PIOS_BMM150_PRIV_H
30 
31 #include "pios_bmm150.h"
32 
33 #define BMM150_REG_MAG_CHIPID 0x40
34 #define BMM150_VAL_MAG_CHIPID 0x32
35 #define BMM150_REG_MAG_X_LSB 0x42
36 #define BMM150_REG_MAG_X_MSB 0x43
37 #define BMM150_REG_MAG_Y_LSB 0x44
38 #define BMM150_REG_MAG_Y_MSB 0x45
39 #define BMM150_REG_MAG_Z_LSB 0x46
40 #define BMM150_REG_MAG_Z_MSB 0x47
41 #define BMM150_REG_MAG_HALL_RESISTANCE_LSB 0x48
42 #define BMM150_VAL_MAG_HALL_RESISTANCE_LSB_DRDY 0x01
43 #define BMM150_REG_MAG_HALL_RESISTANCE_MSB 0x49
44 #define BMM150_REG_MAG_INT_STATUS 0x4A
45 #define BMM150_REG_MAG_POWER_CONTROL 0x4B
46 #
47 #define BMM150_VAL_MAG_POWER_CONTROL_SOFTRESET 0x82
48 /* According to datasheet, full POR behavior attained by poweroff and
49  * going back to poweron */
50 #define BMM150_VAL_MAG_POWER_CONTROL_POWERON 0x01
51 #define BMM150_VAL_MAG_POWER_CONTROL_POWEROFF 0x00
52 #define BMM150_REG_MAG_OPERATION_MODE 0x4C
53 #define BMM150_VAL_MAG_OPERATION_MODE_ODR30 0x38
54 #define BMM150_VAL_MAG_OPERATION_MODE_ODR25 0x30
55 #define BMM150_VAL_MAG_OPERATION_MODE_ODR20 0x28
56 #define BMM150_VAL_MAG_OPERATION_MODE_ODR15 0x20
57 #define BMM150_VAL_MAG_OPERATION_MODE_ODR10 0x00
58 #define BMM150_VAL_MAG_OPERATION_MODE_ODR8 0x18
59 #define BMM150_VAL_MAG_OPERATION_MODE_ODR6 0x10
60 #define BMM150_VAL_MAG_OPERATION_MODE_ODR2 0x08
61 
62 #define BMM150_VAL_MAG_OPERATION_MODE_OPMODE_NORMAL 0x00
63 #define BMM150_VAL_MAG_OPERATION_MODE_OPMODE_FORCED 0x02
64 #define BMM150_VAL_MAG_OPERATION_MODE_OPMODE_SLEEP 0x06
65 #define BMM150_REG_MAG_INTERRUPT_SETTINGS 0x4D
66 #define BMM150_REG_MAG_INTERRUPT_SETTINGS_AXES_ENABLE_BITS 0x4E
67 #define BMM150_REG_MAG_LOWTHRESH_INTERRUPT_SETTING 0x4F
68 #define BMM150_REG_MAG_HIGHTHRESH_INTERRUPT_SETTING 0x50
69 #define BMM150_REG_MAG_X_Y_AXIS_REP 0x51
70 #define BMM150_REG_MAG_Z_AXIS_REP 0x52
71 
72 /* trim registers */
73 #define BMM150_DIG_X1 0x5D
74 #define BMM150_DIG_Y1 0x5E
75 #define BMM150_DIG_Z4_LSB 0x62
76 #define BMM150_DIG_Z4_MSB 0x63
77 #define BMM150_DIG_X2 0x64
78 #define BMM150_DIG_Y2 0x65
79 #define BMM150_DIG_Z2_LSB 0x68
80 #define BMM150_DIG_Z2_MSB 0x69
81 #define BMM150_DIG_Z1_LSB 0x6A
82 #define BMM150_DIG_Z1_MSB 0x6B
83 #define BMM150_DIG_XYZ1_LSB 0x6C
84 #define BMM150_DIG_XYZ1_MSB 0x6D
85 #define BMM150_DIG_Z3_LSB 0x6E
86 #define BMM150_DIG_Z3_MSB 0x6F
87 #define BMM150_DIG_XY2 0x70
88 #define BMM150_DIG_XY1 0x71
89 
90 #define BMM050_INIT_VALUE (0)
91 #define BMM050_OVERFLOW_OUTPUT_FLOAT 0.0f
92 #define BMM050_FLIP_OVERFLOW_ADCVAL -4096
93 #define BMM050_HALL_OVERFLOW_ADCVAL -16384
94 
95 #endif /* PIOS_BMM150_PRIV_H */
96