dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pios_lis3mdl_priv.h
Go to the documentation of this file.
1 
11 /*
12  * This program is free software; you can redistribute it and/or modify
13  * it under the terms of the GNU General Public License as published by
14  * the Free Software Foundation; either version 3 of the License, or
15  * (at your option) any later version.
16  *
17  * This program is distributed in the hope that it will be useful, but
18  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20  * for more details.
21  *
22  * You should have received a copy of the GNU General Public License along
23  * with this program; if not, see <http://www.gnu.org/licenses/>
24  */
25 
26 #ifndef PIOS_LIS3MDL_PRIV_H
27 #define PIOS_LIS3MDL_PRIV_H
28 
29 #include "pios_lis3mdl.h"
30 
51 };
52 
53 #define LIS_ADDRESS_READ 0x80
54 #define LIS_ADDRESS_AUTOINCREMENT 0x40
55 
56 #define LIS_WHO_AM_I_VAL 0x3d
57 
58 #define LIS_CTRL1_TEMPEN 0x80
59 #define LIS_CTRL1_OPMODE_MASK 0x60
60 
61 #define LIS_CTRL1_OPMODE_UHP 0x60 /* Ultra high perofrmance */
62 #define LIS_CTRL1_ODR_MASK 0x1c
63 #define LIS_CTRL1_ODR_80 0x1c /* Mfr recommended */
64 #define LIS_CTRL1_ODR_40 0x18
65 #define LIS_CTRL1_ODR_20 0x14
66 
67 #define LIS_CTRL1_FASTODR 0x02 /* generates 155Hz with UHP */
68 #define LIS_CTRL1_SELFTEST 0x01
69 
70 #define LIS_CTRL2_FS_MASK 0x60
71 #define LIS_CTRL2_FS_16GAU 0x60
72 #define LIS_CTRL2_FS_12GAU 0x40 /* Mfr recommended; 2281
73  * counts/gauss. typ RMS
74  * noise seems to be about
75  * 3 milligauss or 7 counts
76  */
77 #define LIS_RANGE_12GAU_COUNTS_PER_MGAU 2.281f
78 
79 #define LIS_CTRL2_FS_8GAU 0x20
80 #define LIS_CTRL2_FS_4GAU 0x00
81 
82 #define LIS_CTRL2_REBOOT 0x04
83 #define LIS_CTRL2_SOFTRST 0x02
84 
85 #define LIS_CTRL3_LP 0x20
86 #define LIS_CTRL3_SPITHREEWIRE 0x04
87 #define LIS_CTRL3_MODE_MASK 0x03
88 
89 #define LIS_CTRL3_MODE_CONTINUOUS 0x00
90 #define LIS_CTRL3_MODE_SINGLE 0x01
91 #define LIS_CTRL3_MODE_POWERDOWN 0x03
92 
93 #define LIS_CTRL4_OPMODEZ_MASK 0x0c
94 #define LIS_CTRL4_OPMODEZ_UHP 0x0c
95 /* Endianness is also here, but default value here corresponds to register
96  * map and microarchitecture endianness (x86=LE, ARM as we use=LE, etc).
97  */
98 
99 #define LIS_CTRL5_FASTREAD 0x80
100 #define LIS_CTRL5_BDU 0x40
101 
102 #define LIS_STATUS_ZYXOR 0x80
103 #define LIS_STATUS_ZOR 0x40
104 #define LIS_STATUS_YOR 0x20
105 #define LIS_STATUS_XOR 0x10
106 #define LIS_STATUS_ZYXDA 0x08
107 #define LIS_STATUS_ZDA 0x04
108 #define LIS_STATUS_YDA 0x02
109 #define LIS_STATUS_XDA 0x01
110 
111 #endif /* PIOS_LIS3MDL_PRIV_H */
112 
pios_lis3_regs