32 #define BMM150_DEFAULT_I2C_BUS 0 33 #define BMM150_DEFAULT_SPI_BUS 0 34 #define BMM150_DEFAULT_ADDR 0x10 36 #define BMM150_DEFAULT_CHIPID 0x32 47 BMM150_REG_CHIP_ID = 0x40,
51 BMM150_REG_MAG_X_LSB = 0x42,
52 BMM150_REG_MAG_X_MSB = 0x43,
53 BMM150_REG_MAG_Y_LSB = 0x44,
54 BMM150_REG_MAG_Y_MSB = 0x45,
55 BMM150_REG_MAG_Z_LSB = 0x46,
56 BMM150_REG_MAG_Z_MSB = 0x47,
58 BMM150_REG_RHALL_LSB = 0x48,
59 BMM150_REG_RHALL_MSB = 0x49,
61 BMM150_REG_INT_STATUS = 0x4a,
63 BMM150_REG_POWER_CTRL = 0x4b,
65 BMM150_REG_OPMODE = 0x4c,
67 BMM150_REG_INT_EN = 0x4d,
68 BMM150_REG_INT_CONFIG = 0x4e,
70 BMM150_REG_LOW_THRES = 0x4f,
71 BMM150_REG_HIGH_THRES = 0x50,
73 BMM150_REG_REP_XY = 0x51,
74 BMM150_REG_REP_Z = 0x52,
79 BMM150_REG_TRIM_DIG_X1 = 0x5d,
80 BMM150_REG_TRIM_DIG_Y1 = 0x5e,
82 BMM150_REG_TRIM_DIG_Z4_LSB = 0x62,
83 BMM150_REG_TRIM_DIG_Z4_MSB = 0x63,
84 BMM150_REG_TRIM_DIG_X2 = 0x64,
85 BMM150_REG_TRIM_DIG_Y2 = 0x65,
87 BMM150_REG_TRIM_DIG_Z2_LSB = 0x68,
88 BMM150_REG_TRIM_DIG_Z2_MSB = 0x69,
89 BMM150_REG_TRIM_DIG_Z1_LSB = 0x6a,
90 BMM150_REG_TRIM_DIG_Z1_MSB = 0x6b,
91 BMM150_REG_TRIM_DIG_XYZ1_LSB = 0x6c,
92 BMM150_REG_TRIM_DIG_XYZ1_MSB = 0x6d,
93 BMM150_REG_TRIM_DIG_Z3_LSB = 0x6e,
94 BMM150_REG_TRIM_DIG_Z3_MSB = 0x6f,
95 BMM150_REG_TRIM_DIG_XY2 = 0x70,
96 BMM150_REG_TRIM_DIG_XY1 = 0x71
103 _BMM150_MAG_XY_LSB_RESERVED_BITS = 0x02 | 0x04,
105 BMM150_MAG_XY_LSB_SELFTEST_XY = 0x01,
107 BMM150_MAG_XY_LSB_LSB0 = 0x08,
108 BMM150_MAG_XY_LSB_LSB1 = 0x10,
109 BMM150_MAG_XY_LSB_LSB2 = 0x20,
110 BMM150_MAG_XY_LSB_LSB3 = 0x40,
111 BMM150_MAG_XY_LSB_LSB4 = 0x80,
112 _BMM150_MAG_XY_LSB_LSB_MASK = 31,
113 _BMM150_MAG_XY_LSB_LSB_SHIFT = 3
114 } BMM150_MAG_XY_LSB_BITS_T;
120 BMM150_MAG_Z_LSB_SELFTEST_Z = 0x01,
122 BMM150_MAG_Z_LSB_LSB0 = 0x02,
123 BMM150_MAG_Z_LSB_LSB1 = 0x04,
124 BMM150_MAG_Z_LSB_LSB2 = 0x08,
125 BMM150_MAG_Z_LSB_LSB3 = 0x10,
126 BMM150_MAG_Z_LSB_LSB4 = 0x20,
127 BMM150_MAG_Z_LSB_LSB5 = 0x40,
128 BMM150_MAG_Z_LSB_LSB6 = 0x80,
129 _BMM150_MAG_Z_LSB_LSB_MASK = 127,
130 _BMM150_MAG_Z_LSB_LSB_SHIFT = 1
137 _BMM150_MAG_RHALL_LSB_RESERVED_BITS = 0x02,
139 BMM150_MAG_RHALL_LSB_DATA_READY_STATUS = 0x01,
141 BMM150_MAG_RHALL_LSB_LSB0 = 0x04,
142 BMM150_MAG_RHALL_LSB_LSB1 = 0x08,
143 BMM150_MAG_RHALL_LSB_LSB2 = 0x10,
144 BMM150_MAG_RHALL_LSB_LSB3 = 0x20,
145 BMM150_MAG_RHALL_LSB_LSB4 = 0x40,
146 BMM150_MAG_RHALL_LSB_LSB5 = 0x80,
147 _BMM150_MAG_RHALL_LSB_LSB_MASK = 63,
148 _BMM150_MAG_RHALL_LSB_LSB_SHIFT = 2
149 } BMM150_MAG_RHALL_LSB_BITS_T;
155 BMM150_INT_STATUS_LOW_INT_X = 0x01,
156 BMM150_INT_STATUS_LOW_INT_Y = 0x02,
157 BMM150_INT_STATUS_LOW_INT_Z = 0x04,
158 BMM150_INT_STATUS_HIGH_INT_X = 0x08,
159 BMM150_INT_STATUS_HIGH_INT_Y = 0x10,
160 BMM150_INT_STATUS_HIGH_INT_Z = 0x20,
161 BMM150_INT_STATUS_OVERFLOW = 0x40,
162 BMM150_INT_STATUS_DATA_OVERRUN = 0x80
163 } BMM150_INT_STATUS_BITS_T;
169 _BMM150_POWER_CTRL_RESERVED_BITS = 0x40 | 0x20 | 0x10 | 0x08,
171 BMM150_POWER_CTRL_POWER_CTRL_BIT = 0x01,
172 BMM150_POWER_CTRL_SOFT_RESET0 = 0x02,
173 BMM150_POWER_CTRL_SPI3EN = 0x04,
175 BMM150_POWER_CTRL_SOFT_RESET1 = 0x80
182 BMM150_OPMODE_SELFTTEST = 0x01,
184 BMM150_OPMODE_OPERATION_MODE0 = 0x02,
185 BMM150_OPMODE_OPERATION_MODE1 = 0x04,
186 _BMM150_OPMODE_OPERATION_MODE_MASK = 3,
187 _BMM150_OPMODE_OPERATION_MODE_SHIFT = 1,
189 BMM150_OPMODE_DATA_RATE0 = 0x08,
190 BMM150_OPMODE_DATA_RATE1 = 0x10,
191 BMM150_OPMODE_DATA_RATE2 = 0x20,
192 _BMM150_OPMODE_DATA_RATE_MASK = 7,
193 _BMM150_OPMODE_DATA_RATE_SHIFT = 3,
195 BMM150_OPMODE_ADV_SELFTEST0 = 0x40,
196 BMM150_OPMODE_ADV_SELFTEST1 = 0x80,
197 _BMM150_OPMODE_ADV_SELFTEST_MASK = 3,
198 _BMM150_OPMODE_ADV_SELFTEST_SHIFT = 6
205 BMM150_OPERATION_MODE_NORMAL = 0,
206 BMM150_OPERATION_MODE_FORCED = 1,
207 BMM150_OPERATION_MODE_SLEEP = 3
208 } BMM150_OPERATION_MODE_T;
214 BMM150_DATA_RATE_10HZ = 0,
215 BMM150_DATA_RATE_2HZ = 1,
216 BMM150_DATA_RATE_6HZ = 2,
217 BMM150_DATA_RATE_8HZ = 3,
218 BMM150_DATA_RATE_15HZ = 4,
219 BMM150_DATA_RATE_20HZ = 5,
220 BMM150_DATA_RATE_25HZ = 6,
221 BMM150_DATA_RATE_30HZ = 7
222 } BMM150_DATA_RATE_T;
228 BMM150_INT_EN_LOW_INT_X_EN = 0x01,
229 BMM150_INT_EN_LOW_INT_Y_EN = 0x02,
230 BMM150_INT_EN_LOW_INT_Z_EN = 0x04,
231 BMM150_INT_EN_HIGH_INT_X_EN = 0x08,
232 BMM150_INT_EN_HIGH_INT_Y_EN = 0x10,
233 BMM150_INT_EN_HIGH_INT_Z_EN = 0x20,
234 BMM150_INT_EN_OVERFLOW_INT_EN = 0x40,
235 BMM150_INT_EN_DATA_OVERRUN_INT_EN = 0x80
242 BMM150_INT_CONFIG_INT_POLARITY = 0x01,
243 BMM150_INT_CONFIG_INT_LATCH = 0x02,
244 BMM150_INT_CONFIG_DR_POLARITY = 0x04,
245 BMM150_INT_CONFIG_CHANNEL_X = 0x08,
246 BMM150_INT_CONFIG_CHANNEL_Y = 0x10,
247 BMM150_INT_CONFIG_CHANNEL_Z = 0x20,
248 BMM150_INT_CONFIG_INT_PIN_EN = 0x40,
249 BMM150_INT_CONFIG_DR_PIN_EN = 0x80
250 } BMM150_INT_CONFIG_T;
256 BMM150_INTERRUPT_INT,
258 } BMM150_INTERRUPT_PINS_T;
264 BMM150_USAGE_LOW_POWER,
265 BMM150_USAGE_REGULAR,
266 BMM150_USAGE_ENHANCED_REGULAR,
267 BMM150_USAGE_HIGH_ACCURACY
268 } BMM150_USAGE_PRESETS_T;