The friendly Operating System for the Internet of Things
mag3110_reg.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 PHYTEC Messtechnik GmbH
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  */
9 
21 #ifndef MAG3110_REG_H
22 #define MAG3110_REG_H
23 
24 #ifdef __cplusplus
25 extern "C"
26 {
27 #endif
28 
29 #define MAG3110_DR_STATUS 0x00
30 #define MAG3110_OUT_X_MSB 0x01
31 #define MAG3110_OUT_X_LSB 0x02
32 #define MAG3110_OUT_Y_MSB 0x03
33 #define MAG3110_OUT_Y_LSB 0x04
34 #define MAG3110_OUT_Z_MSB 0x05
35 #define MAG3110_OUT_Z_LSB 0x06
36 #define MAG3110_WHO_AM_I 0x07
37 #define MAG3110_SYSMOD 0x08
38 #define MAG3110_OFF_X_MSB 0x09
39 #define MAG3110_OFF_X_LSB 0x0A
40 #define MAG3110_OFF_Y_MSB 0x0B
41 #define MAG3110_OFF_Y_LSB 0x0C
42 #define MAG3110_OFF_Z_MSB 0x0D
43 #define MAG3110_OFF_Z_LSB 0x0E
44 #define MAG3110_DIE_TEMP 0x0F
45 #define MAG3110_CTRL_REG1 0x10
46 #define MAG3110_CTRL_REG2 0x11
48 #define MAG3110_DR_STATUS_ZYXOW (1 << 7)
49 #define MAG3110_DR_STATUS_ZOW (1 << 6)
50 #define MAG3110_DR_STATUS_YOW (1 << 5)
51 #define MAG3110_DR_STATUS_XOW (1 << 4)
52 #define MAG3110_DR_STATUS_ZYXDR (1 << 3)
53 #define MAG3110_DR_STATUS_ZDR (1 << 2)
54 #define MAG3110_DR_STATUS_YDR (1 << 1)
55 #define MAG3110_DR_STATUS_XDR (1 << 0)
56 
57 #define MAG3110_ID 0xC4
59 #define MAG3110_SYSMOD_STANDBY 0
60 #define MAG3110_SYSMOD_ACTIVE_RAW 1
61 #define MAG3110_SYSMOD_ACTIVE 2
62 
63 #define MAG3110_CTRL_REG1_DROS_SHIFT 3
64 #define MAG3110_CTRL_REG1_DROS_MASK 0xF8
65 #define MAG3110_CTRL_REG1_DROS(x) (((uint8_t)(((uint8_t)(x))<<MAG3110_CTRL_REG1_DROS_SHIFT))\
66  &MAG3110_CTRL_REG1_DROS_MASK)
67 #define MAG3110_CTRL_REG1_FR (1 << 2)
68 #define MAG3110_CTRL_REG1_TM (1 << 1)
69 #define MAG3110_CTRL_REG1_AC (1 << 0)
70 
71 #define MAG3110_CTRL_REG2_AUTO_MRST_EN (1 << 7)
72 #define MAG3110_CTRL_REG2_RAW (1 << 5)
73 #define MAG3110_CTRL_REG2_MAG_RST (1 << 4)
74 
75 #ifdef __cplusplus
76 }
77 #endif
78 
79 #endif
80