42#define CHIP_NAME "Bosch BMM150"
43#define MANUFACTURER_NAME "Bosch"
44#define SUPPLY_VOLTAGE_MIN 1.62f
45#define SUPPLY_VOLTAGE_MAX 3.6f
46#define MAX_CURRENT 20.0f
47#define TEMPERATURE_MIN -40.0f
48#define TEMPERATURE_MAX 85.0f
49#define DRIVER_VERSION 1000
54#define BMM150_REG_CHIP_ID 0x40
55#define BMM150_REG_DATA_X_LSB 0x42
56#define BMM150_REG_DATA_X_MSB 0x43
57#define BMM150_REG_DATA_Y_LSB 0x44
58#define BMM150_REG_DATA_Y_MSB 0x45
59#define BMM150_REG_DATA_Z_LSB 0x46
60#define BMM150_REG_DATA_Z_MSB 0x47
61#define BMM150_REG_RHALL_LSB 0x48
62#define BMM150_REG_RHALL_MSB 0x49
63#define BMM150_REG_INTERRUPT_STATUS 0x4A
64#define BMM150_REG_CONFIG_0 0x4B
65#define BMM150_REG_CONFIG_1 0x4C
66#define BMM150_REG_CONFIG_2 0x4D
67#define BMM150_REG_CONFIG_3 0x4E
68#define BMM150_REG_LOW_THRESHOLD 0x4F
69#define BMM150_REG_HIGH_THRESHOLD 0x50
70#define BMM150_REG_REPXY 0x51
71#define BMM150_REG_REPZ 0x52
76#define BMM150_REG_DIG_X1 0x5D
77#define BMM150_REG_DIG_Y1 0x5E
78#define BMM150_REG_DIG_Z4_LSB 0x62
79#define BMM150_REG_DIG_Z4_MSB 0x63
80#define BMM150_REG_DIG_X2 0x64
81#define BMM150_REG_DIG_Y2 0x65
82#define BMM150_REG_DIG_Z2_LSB 0x68
83#define BMM150_REG_DIG_Z2_MSB 0x69
84#define BMM150_REG_DIG_Z1_LSB 0x6A
85#define BMM150_REG_DIG_Z1_MSB 0x6B
86#define BMM150_REG_DIG_XYZ1_LSB 0x6C
87#define BMM150_REG_DIG_XYZ1_MSB 0x6D
88#define BMM150_REG_DIG_Z3_LSB 0x6E
89#define BMM150_REG_DIG_Z3_MSB 0x6F
90#define BMM150_REG_DIG_XY2 0x70
91#define BMM150_REG_DIG_XY1 0x71
104static uint8_t a_bmm150_iic_spi_read(
bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
118 if (handle->
spi_read(reg, buf, len) != 0)
138static uint8_t a_bmm150_iic_spi_write(
bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
152 if (handle->
spi_write(reg, buf, len) != 0)
172 uint8_t trim_x1y1[2];
173 uint8_t trim_xyz_data[4];
174 uint8_t trim_xy1xy2[10];
175 uint16_t temp_msb = 0;
180 handle->
debug_print(
"bmm150: read dig x1 failed.\n");
187 handle->
debug_print(
"bmm150: read dig z4 failed.\n");
194 handle->
debug_print(
"bmm150: read dig z2 failed.\n");
198 handle->
dig_x1 = (int8_t)trim_x1y1[0];
199 handle->
dig_y1 = (int8_t)trim_x1y1[1];
200 handle->
dig_x2 = (int8_t)trim_xyz_data[2];
201 handle->
dig_y2 = (int8_t)trim_xyz_data[3];
202 temp_msb = ((uint16_t)trim_xy1xy2[3]) << 8;
203 handle->
dig_z1 = (uint16_t)(temp_msb | trim_xy1xy2[2]);
204 temp_msb = ((uint16_t)trim_xy1xy2[1]) << 8;
205 handle->
dig_z2 = (int16_t)(temp_msb | trim_xy1xy2[0]);
206 temp_msb = ((uint16_t)trim_xy1xy2[7]) << 8;
207 handle->
dig_z3 = (int16_t)(temp_msb | trim_xy1xy2[6]);
208 temp_msb = ((uint16_t)trim_xyz_data[1]) << 8;
209 handle->
dig_z4 = (int16_t)(temp_msb | trim_xyz_data[0]);
210 handle->
dig_xy1 = trim_xy1xy2[9];
211 handle->
dig_xy2 = (int8_t)trim_xy1xy2[8];
212 temp_msb = ((uint16_t)(trim_xy1xy2[5] & 0x7F)) << 8;
213 handle->
dig_xyz1 = (uint16_t)(temp_msb | trim_xy1xy2[4]);
226static float a_bmm150_compensate_x(
bmm150_handle_t *handle, int16_t mag_data_x, uint16_t data_rhall)
229 float process_comp_x0;
230 float process_comp_x1;
231 float process_comp_x2;
232 float process_comp_x3;
233 float process_comp_x4;
235 process_comp_x0 = (((float)handle->
dig_xyz1) * 16384.0f / (float)data_rhall);
236 retval = (process_comp_x0 - 16384.0f);
237 process_comp_x1 = ((float)handle->
dig_xy2) * (retval * retval / 268435456.0f);
238 process_comp_x2 = process_comp_x1 + retval * ((float)handle->
dig_xy1) / 16384.0f;
239 process_comp_x3 = ((float)handle->
dig_x2) + 160.0f;
240 process_comp_x4 = (float)mag_data_x * ((process_comp_x2 + 256.0f) * process_comp_x3);
241 retval = ((process_comp_x4 / 8192.0f) + (((float)handle->
dig_x1) * 8.0f)) / 16.0f;
254static float a_bmm150_compensate_y(
bmm150_handle_t *handle, int16_t mag_data_y, uint16_t data_rhall)
257 float process_comp_y0;
258 float process_comp_y1;
259 float process_comp_y2;
260 float process_comp_y3;
261 float process_comp_y4;
263 process_comp_y0 = ((float)handle->
dig_xyz1) * 16384.0f / (
float)data_rhall;
264 retval = process_comp_y0 - 16384.0f;
265 process_comp_y1 = ((float)handle->
dig_xy2) * (retval * retval / 268435456.0f);
266 process_comp_y2 = process_comp_y1 + retval * ((float)handle->
dig_xy1) / 16384.0f;
267 process_comp_y3 = ((float)handle->
dig_y2) + 160.0f;
268 process_comp_y4 = (float)mag_data_y * (((process_comp_y2) + 256.0f) * process_comp_y3);
269 retval = ((process_comp_y4 / 8192.0f) + (((float)handle->
dig_y1) * 8.0f)) / 16.0f;
282static float a_bmm150_compensate_z(
bmm150_handle_t *handle, int16_t mag_data_z, uint16_t data_rhall)
285 float process_comp_z0;
286 float process_comp_z1;
287 float process_comp_z2;
288 float process_comp_z3;
289 float process_comp_z4;
290 float process_comp_z5;
292 process_comp_z0 = ((float)mag_data_z) - ((
float)handle->
dig_z4);
293 process_comp_z1 = ((float)data_rhall) - ((
float)handle->
dig_xyz1);
294 process_comp_z2 = (((float)handle->
dig_z3) * process_comp_z1);
295 process_comp_z3 = ((float)handle->
dig_z1) * ((
float)data_rhall) / 32768.0f;
296 process_comp_z4 = ((float)handle->
dig_z2) + process_comp_z3;
297 process_comp_z5 = (process_comp_z0 * 131072.0f) - process_comp_z2;
298 retval = (process_comp_z5 / ((process_comp_z4) * 4.0f)) / 16.0f;
317 handle->
debug_print(
"bmm150: read config 0 failed.\n");
324 handle->
debug_print(
"bmm150: write config 0 failed.\n");
333 handle->
debug_print(
"bmm150: iic deinit failed.\n");
344 handle->
debug_print(
"bmm150: spi deinit failed.\n");
369 handle->
iic_spi = (uint8_t)interface;
411 handle->
iic_addr = (uint8_t)addr_pin;
465 handle->
debug_print(
"bmm150: read data x failed.\n");
502 handle->
debug_print(
"bmm150: read data y failed.\n");
539 handle->
debug_print(
"bmm150: read data z failed.\n");
576 handle->
debug_print(
"bmm150: read rhall failed.\n");
614 handle->
debug_print(
"bmm150: read interrupt status failed.\n");
650 handle->
debug_print(
"bmm150: read config 0 failed.\n");
659 handle->
debug_print(
"bmm150: write config 0 failed.\n");
696 handle->
debug_print(
"bmm150: read config 0 failed.\n");
705 handle->
debug_print(
"bmm150: write config 0 failed.\n");
742 handle->
debug_print(
"bmm150: read config 0 failed.\n");
779 handle->
debug_print(
"bmm150: read config 0 failed.\n");
788 handle->
debug_print(
"bmm150: write config 0 failed.\n");
824 handle->
debug_print(
"bmm150: read config 0 failed.\n");
861 handle->
debug_print(
"bmm150: read config 1 failed.\n");
870 handle->
debug_print(
"bmm150: write config 1 failed.\n");
906 handle->
debug_print(
"bmm150: read config 1 failed.\n");
943 handle->
debug_print(
"bmm150: read config 1 failed.\n");
952 handle->
debug_print(
"bmm150: write config 1 failed.\n");
988 handle->
debug_print(
"bmm150: read config 1 failed.\n");
1025 handle->
debug_print(
"bmm150: read config 1 failed.\n");
1034 handle->
debug_print(
"bmm150: write config 1 failed.\n");
1070 handle->
debug_print(
"bmm150: read config 1 failed.\n");
1107 handle->
debug_print(
"bmm150: read config 1 failed.\n");
1112 prev |= enable << 0;
1116 handle->
debug_print(
"bmm150: write config 1 failed.\n");
1152 handle->
debug_print(
"bmm150: read config 1 failed.\n");
1190 handle->
debug_print(
"bmm150: read config 2 failed.\n");
1194 prev &= ~(1 << (uint8_t)status);
1197 prev |= enable << (uint8_t)status;
1201 prev |= (uint8_t)(!enable) << (uint8_t)status;
1206 handle->
debug_print(
"bmm150: write config 2 failed.\n");
1243 handle->
debug_print(
"bmm150: read config 2 failed.\n");
1249 *enable = (
bmm150_bool_t)((prev >> (uint8_t)(status)) & 0x01);
1253 *enable = (
bmm150_bool_t)(!((prev >> (uint8_t)(status)) & 0x01));
1287 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1292 prev |= enable << 7;
1296 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1332 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1369 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1374 prev |= enable << 6;
1378 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1414 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1451 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1456 prev |= (uint8_t)(!enable) << 5;
1460 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1496 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1533 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1538 prev |= (uint8_t)(!enable) << 4;
1542 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1578 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1615 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1620 prev |= (uint8_t)(!enable) << 3;
1624 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1660 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1697 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1702 prev |= polarity << 2;
1706 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1742 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1779 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1784 prev |= enable << 1;
1788 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1824 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1861 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1866 prev |= polarity << 0;
1870 handle->
debug_print(
"bmm150: write config 3 failed.\n");
1906 handle->
debug_print(
"bmm150: read config 3 failed.\n");
1940 prev = (uint8_t)threshold;
1944 handle->
debug_print(
"bmm150: write low threshold failed.\n");
1980 handle->
debug_print(
"bmm150: read low threshold failed.\n");
1984 *threshold = (int8_t)(prev);
2014 prev = (uint8_t)threshold;
2018 handle->
debug_print(
"bmm150: write high threshold failed.\n");
2054 handle->
debug_print(
"bmm150: read high threshold failed.\n");
2058 *threshold = (int8_t)(prev);
2096 handle->
debug_print(
"bmm150: write repxy failed.\n");
2131 handle->
debug_print(
"bmm150: read repxy failed.\n");
2172 handle->
debug_print(
"bmm150: write repz failed.\n");
2207 handle->
debug_print(
"bmm150: read repz failed.\n");
2248 handle->
debug_print(
"bmm150: read config 1 failed.\n");
2252 mode = (prev >> 1) & 0x03;
2258 handle->
debug_print(
"bmm150: read data failed.\n");
2262 if (((buf[1] >> 7) & 0x01) != 0)
2264 temp = (int16_t)(((uint16_t)buf[1]) << 5 | (buf[0] >> 3) | (0x7 << 13));
2269 temp = (int16_t)(((uint16_t)buf[1]) << 5 | (buf[0] >> 3));
2272 if (((buf[3] >> 7) & 0x01) != 0)
2274 temp = (int16_t)(((uint16_t)buf[3]) << 5 | (buf[2] >> 3) | (0x7 << 13));
2279 temp = (int16_t)(((uint16_t)buf[3]) << 5 | (buf[2] >> 3));
2282 if (((buf[5] >> 7) & 0x01) != 0)
2284 temp = (int16_t)(((uint16_t)buf[5]) << 7 | (buf[4] >> 1) | (0x1 << 15));
2289 temp = (int16_t)(((uint16_t)buf[5]) << 7 | (buf[4] >> 1));
2292 temp = (uint16_t)(((uint16_t)buf[7]) << 6 | (buf[6] >> 2));
2293 ut[0] = a_bmm150_compensate_x(handle, raw[0], temp);
2294 ut[1] = a_bmm150_compensate_y(handle, raw[1], temp);
2295 ut[2] = a_bmm150_compensate_z(handle, raw[2], temp);
2306 handle->
debug_print(
"bmm150: read config 1 failed.\n");
2315 handle->
debug_print(
"bmm150: write config 1 failed.\n");
2321 while (timeout != 0)
2326 handle->
debug_print(
"bmm150: read rhall lsb failed.\n");
2330 if ((prev & 0x01) != 0)
2347 handle->
debug_print(
"bmm150: read data failed.\n");
2351 if (((buf[1] >> 7) & 0x01) != 0)
2353 temp = (int16_t)(((uint16_t)buf[1]) << 5 | (buf[0] >> 3) | (0x7 << 13));
2358 temp = (int16_t)(((uint16_t)buf[1]) << 5 | (buf[0] >> 3));
2361 if (((buf[3] >> 7) & 0x01) != 0)
2363 temp = (int16_t)(((uint16_t)buf[3]) << 5 | (buf[2] >> 3) | (0x7 << 13));
2368 temp = (int16_t)(((uint16_t)buf[3]) << 5 | (buf[2] >> 3));
2371 if (((buf[5] >> 7) & 0x01) != 0)
2373 temp = (int16_t)(((uint16_t)buf[5]) << 7 | (buf[4] >> 1) | (0x1 << 15));
2378 temp = (int16_t)(((uint16_t)buf[5]) << 7 | (buf[4] >> 1));
2381 temp = (uint16_t)(((uint16_t)buf[7]) << 6 | (buf[6] >> 2));
2382 ut[0] = a_bmm150_compensate_x(handle, raw[0], temp);
2383 ut[1] = a_bmm150_compensate_y(handle, raw[1], temp);
2384 ut[2] = a_bmm150_compensate_z(handle, raw[2], temp);
2417 handle->
debug_print(
"bmm150: read interrupt status failed.\n");
2507 *reg = (int8_t)(ut / 6.0f);
2534 *ut = (float)(reg) * 6.0f;
2568 handle->
debug_print(
"bmm150: iic_init is null.\n");
2574 handle->
debug_print(
"bmm150: iic_deinit is null.\n");
2580 handle->
debug_print(
"bmm150: iic_read is null.\n");
2586 handle->
debug_print(
"bmm150: iic_write is null.\n");
2592 handle->
debug_print(
"bmm150: spi_init is null.\n");
2598 handle->
debug_print(
"bmm150: spi_deinit is null.\n");
2604 handle->
debug_print(
"bmm150: spi_read is null.\n");
2610 handle->
debug_print(
"bmm150: spi_write is null.\n");
2616 handle->
debug_print(
"bmm150: delay_ms is null.\n");
2622 handle->
debug_print(
"bmm150: receive_callback is null.\n");
2631 handle->
debug_print(
"bmm150: iic init failed.\n");
2640 handle->
debug_print(
"bmm150: spi init failed.\n");
2648 handle->
debug_print(
"bmm150: read config 0 failed.\n");
2649 (void)a_bmm150_close(handle);
2657 handle->
debug_print(
"bmm150: write config 0 failed.\n");
2658 (void)a_bmm150_close(handle);
2666 handle->
debug_print(
"bmm150: read config 0 failed.\n");
2674 handle->
debug_print(
"bmm150: write config 0 failed.\n");
2683 (void)a_bmm150_close(handle);
2690 (void)a_bmm150_close(handle);
2694 if (a_bmm150_load_trim(handle) != 0)
2696 handle->
debug_print(
"bmm150: load trim failed.\n");
2697 (void)a_bmm150_close(handle);
2729 res = a_bmm150_close(handle);
2768 res = a_bmm150_iic_spi_write(handle, reg, buf, len);
2803 res = a_bmm150_iic_spi_read(handle, reg, buf, len);
#define BMM150_REG_CHIP_ID
chip register definition
#define BMM150_REG_RHALL_LSB
#define BMM150_REG_CONFIG_0
#define BMM150_REG_DATA_Z_LSB
#define BMM150_REG_DIG_Z2_LSB
#define BMM150_REG_CONFIG_1
#define BMM150_REG_DATA_Y_LSB
#define SUPPLY_VOLTAGE_MAX
#define BMM150_REG_INTERRUPT_STATUS
#define BMM150_REG_CONFIG_2
#define BMM150_REG_DIG_X1
chip trim extended register definition
#define BMM150_REG_CONFIG_3
#define BMM150_REG_DIG_Z4_LSB
#define MANUFACTURER_NAME
#define SUPPLY_VOLTAGE_MIN
#define BMM150_REG_LOW_THRESHOLD
#define CHIP_NAME
chip register definition
#define BMM150_REG_DATA_X_LSB
#define BMM150_REG_HIGH_THRESHOLD
driver bmm150 header file
uint8_t bmm150_get_channel_x(bmm150_handle_t *handle, bmm150_bool_t *enable)
get channel x status
uint8_t bmm150_get_interrupt_pin_polarity(bmm150_handle_t *handle, bmm150_interrupt_pin_polarity_t *polarity)
get interrupt pin polarity
uint8_t bmm150_soft_reset(bmm150_handle_t *handle)
soft reset
uint8_t bmm150_get_channel_z(bmm150_handle_t *handle, bmm150_bool_t *enable)
get channel z status
uint8_t bmm150_get_mode(bmm150_handle_t *handle, bmm150_mode_t *mode)
get mode
uint8_t bmm150_deinit(bmm150_handle_t *handle)
close the chip
uint8_t bmm150_get_repxy_number(bmm150_handle_t *handle, uint8_t *number)
get repxy number
uint8_t bmm150_init(bmm150_handle_t *handle)
initialize the chip
bmm150_data_rate_t
bmm150 data rate enumeration definition
uint8_t bmm150_get_spi_wire(bmm150_handle_t *handle, bmm150_spi_wire_t *wire)
get spi wire
uint8_t bmm150_get_self_test(bmm150_handle_t *handle, bmm150_bool_t *enable)
get self test status
uint8_t bmm150_set_data_ready_pin(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable data ready pin
uint8_t bmm150_get_interface(bmm150_handle_t *handle, bmm150_interface_t *interface)
get the chip interface
uint8_t bmm150_get_data_ready_pin(bmm150_handle_t *handle, bmm150_bool_t *enable)
get data ready pin status
uint8_t bmm150_set_repz_number(bmm150_handle_t *handle, uint8_t number)
set repz number
uint8_t bmm150_get_low_threshold(bmm150_handle_t *handle, int8_t *threshold)
get low threshold
uint8_t bmm150_set_interrupt_pin(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable interrupt pin
uint8_t bmm150_set_addr_pin(bmm150_handle_t *handle, bmm150_address_t addr_pin)
set the iic address pin
uint8_t bmm150_set_advanced_self_test(bmm150_handle_t *handle, bmm150_advanced_self_test_t test)
set advanced self test
uint8_t bmm150_set_data_ready_pin_polarity(bmm150_handle_t *handle, bmm150_data_ready_pin_polarity_t polarity)
set data ready pin polarity
uint8_t bmm150_get_interrupt_latch(bmm150_handle_t *handle, bmm150_bool_t *enable)
get interrupt latch status
uint8_t bmm150_set_interrupt_pin_polarity(bmm150_handle_t *handle, bmm150_interrupt_pin_polarity_t polarity)
set interrupt pin polarity
bmm150_interrupt_status_t
bmm150 interrupt status enumeration definition
uint8_t bmm150_set_interface(bmm150_handle_t *handle, bmm150_interface_t interface)
set the chip interface
bmm150_spi_wire_t
bmm150 spi wire enumeration definition
uint8_t bmm150_set_spi_wire(bmm150_handle_t *handle, bmm150_spi_wire_t wire)
set spi wire
uint8_t bmm150_get_channel_y(bmm150_handle_t *handle, bmm150_bool_t *enable)
get channel y status
uint8_t bmm150_get_self_test_y(bmm150_handle_t *handle, bmm150_bool_t *enable)
get self test y result
bmm150_interface_t
bmm150 interface enumeration definition
uint8_t bmm150_get_data_ready_status(bmm150_handle_t *handle, bmm150_bool_t *enable)
get data ready status
uint8_t bmm150_interrupt_threshold_convert_to_data(bmm150_handle_t *handle, int8_t reg, float *ut)
convert the register raw data to the interrupt threshold
uint8_t bmm150_set_high_threshold(bmm150_handle_t *handle, int8_t threshold)
set high threshold
uint8_t bmm150_get_self_test_x(bmm150_handle_t *handle, bmm150_bool_t *enable)
get self test x result
uint8_t bmm150_irq_handler(bmm150_handle_t *handle)
irq handler
uint8_t bmm150_set_channel_y(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable channel y
bmm150_bool_t
bmm150 bool enumeration definition
uint8_t bmm150_info(bmm150_info_t *info)
get chip's information
uint8_t bmm150_set_mode(bmm150_handle_t *handle, bmm150_mode_t mode)
set mode
uint8_t bmm150_get_high_threshold(bmm150_handle_t *handle, int8_t *threshold)
get high threshold
uint8_t bmm150_set_power_on(bmm150_handle_t *handle, bmm150_bool_t enable)
set power on
bmm150_advanced_self_test_t
bmm150 advanced self test enumeration definition
uint8_t bmm150_set_low_threshold(bmm150_handle_t *handle, int8_t threshold)
set low threshold
bmm150_interrupt_pin_polarity_t
bmm150 interrupt pin polarity enumeration definition
uint8_t bmm150_get_data_rate(bmm150_handle_t *handle, bmm150_data_rate_t *rate)
get data rate
uint8_t bmm150_get_interrupt_status(bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t *enable)
get interrupt status
struct bmm150_handle_s bmm150_handle_t
bmm150 handle structure definition
bmm150_mode_t
bmm150 mode enumeration definition
uint8_t bmm150_get_self_test_z(bmm150_handle_t *handle, bmm150_bool_t *enable)
get self test z result
uint8_t bmm150_set_self_test(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable self test
uint8_t bmm150_set_interrupt_latch(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable interrupt latch
uint8_t bmm150_read(bmm150_handle_t *handle, int16_t raw[3], float ut[3])
read data
bmm150_data_ready_pin_polarity_t
bmm150 data ready pin polarity enumeration definition
uint8_t bmm150_set_channel_z(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable channel z
uint8_t bmm150_get_interrupt_pin(bmm150_handle_t *handle, bmm150_bool_t *enable)
get interrupt pin status
uint8_t bmm150_get_repz_number(bmm150_handle_t *handle, uint8_t *number)
get repz number
uint8_t bmm150_get_interrupt(bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t *enable)
get interrupt status
uint8_t bmm150_set_repxy_number(bmm150_handle_t *handle, uint8_t number)
set repxy number
uint8_t bmm150_get_power_on(bmm150_handle_t *handle, bmm150_bool_t *enable)
get power on
uint8_t bmm150_get_data_ready_pin_polarity(bmm150_handle_t *handle, bmm150_data_ready_pin_polarity_t *polarity)
get data ready pin polarity
struct bmm150_info_s bmm150_info_t
bmm150 information structure definition
bmm150_address_t
bmm150 address enumeration definition
uint8_t bmm150_set_interrupt(bmm150_handle_t *handle, bmm150_interrupt_status_t status, bmm150_bool_t enable)
enable or disable interrupt
uint8_t bmm150_get_advanced_self_test(bmm150_handle_t *handle, bmm150_advanced_self_test_t *test)
get advanced self test
uint8_t bmm150_interrupt_threshold_convert_to_register(bmm150_handle_t *handle, float ut, int8_t *reg)
convert the interrupt threshold to the register raw data
uint8_t bmm150_set_data_rate(bmm150_handle_t *handle, bmm150_data_rate_t rate)
set data rate
uint8_t bmm150_get_addr_pin(bmm150_handle_t *handle, bmm150_address_t *addr_pin)
get the iic address pin
uint8_t bmm150_set_channel_x(bmm150_handle_t *handle, bmm150_bool_t enable)
enable or disable channel x
@ BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_Z
@ BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_Y
@ BMM150_INTERRUPT_STATUS_OVERFLOW
@ BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_Y
@ BMM150_INTERRUPT_STATUS_DATA_OVERRUN
@ BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_X
@ BMM150_INTERRUPT_STATUS_HIGH_THRESHOLD_X
@ BMM150_INTERRUPT_STATUS_LOW_THRESHOLD_Z
uint8_t bmm150_set_reg(bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
uint8_t bmm150_get_reg(bmm150_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t(* spi_init)(void)
void(* delay_ms)(uint32_t ms)
uint8_t(* spi_read)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* receive_callback)(uint8_t type)
uint8_t(* spi_write)(uint8_t reg, uint8_t *buf, uint16_t len)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(void)
uint8_t(* spi_deinit)(void)
uint8_t(* iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len)
uint8_t(* iic_deinit)(void)
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v