2 * Copyright © 2012 Keith Packard <keithp@keithp.com>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; version 2 of the License.
8 * This program is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
18 #ifndef _AO_HMC5883_H_
19 #define _AO_HMC5883_H_
21 #define HMC5883_ADDR_WRITE 0x3c
22 #define HMC5883_ADDR_READ 0x3d
24 #define HMC5883_CONFIG_A 0
26 #define HMC5883_CONFIG_A_MA 5
27 #define HMC5883_CONFIG_A_MA_1 0
28 #define HMC5883_CONFIG_A_MA_2 1
29 #define HMC5883_CONFIG_A_MA_4 2
30 #define HMC5883_CONFIG_A_MA_8 3
31 #define HMC5883_CONFIG_A_MA_MASK 3
33 #define HMC5883_CONFIG_A_DO 2
34 #define HMC5883_CONFIG_A_DO_0_75 0
35 #define HMC5883_CONFIG_A_DO_1_5 1
36 #define HMC5883_CONFIG_A_DO_3 2
37 #define HMC5883_CONFIG_A_DO_7_5 3
38 #define HMC5883_CONFIG_A_DO_15 4
39 #define HMC5883_CONFIG_A_DO_30 5
40 #define HMC5883_CONFIG_A_DO_75 6
41 #define HMC5883_CONFIG_A_DO_MASK 7
43 #define HMC5883_CONFIG_A_MS 0
44 #define HMC5883_CONFIG_A_MS_NORMAL 0
45 #define HMC5883_CONFIG_A_MS_POSITIVE_BIAS 1
46 #define HMC5883_CONFIG_A_MS_NEGATIVE_BIAS 2
47 #define HMC5883_CONFIG_A_MS_MASK 3
49 #define HMC5883_CONFIG_B 1
51 #define HMC5883_CONFIG_B_GN 5
52 #define HMC5883_CONFIG_B_GN_0_88 0
53 #define HMC5883_CONFIG_B_GN_1_3 1
54 #define HMC5883_CONFIG_B_GN_1_9 2
55 #define HMC5883_CONFIG_B_GN_2_5 3
56 #define HMC5883_CONFIG_B_GN_4_0 4
57 #define HMC5883_CONFIG_B_GN_4_7 5
58 #define HMC5883_CONFIG_B_GN_5_6 6
59 #define HMC5883_CONFIG_B_GN_8_1 7
60 #define HMC5883_CONFIG_B_GN_MASK 7
62 #define HMC5883_MODE 2
63 #define HMC5883_MODE_CONTINUOUS 0
64 #define HMC5883_MODE_SINGLE 1
65 #define HMC5883_MODE_IDLE 2
67 #define HMC5883_X_MSB 3
68 #define HMC5883_X_LSB 4
69 #define HMC5883_Y_MSB 5
70 #define HMC5883_Y_LSB 6
71 #define HMC5883_Z_MSB 7
72 #define HMC5883_Z_LSB 8
73 #define HMC5883_STATUS 9
74 #define HMC5883_ID_A 10
75 #define HMC5883_ID_B 11
76 #define HMC5883_ID_C 12
78 struct ao_hmc5883_sample {
83 ao_hmc5883_init(void);
85 #endif /* _AO_HMC5883_H_ */