37#ifndef DRIVER_BMM150_H
38#define DRIVER_BMM150_H
173 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
174 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
177 uint8_t (*
spi_read)(uint8_t reg, uint8_t *buf, uint16_t len);
178 uint8_t (*
spi_write)(uint8_t reg, uint8_t *buf, uint16_t len);
230#define DRIVER_BMM150_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
238#define DRIVER_BMM150_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
246#define DRIVER_BMM150_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
254#define DRIVER_BMM150_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
262#define DRIVER_BMM150_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
270#define DRIVER_BMM150_LINK_SPI_INIT(HANDLE, FUC) (HANDLE)->spi_init = FUC
278#define DRIVER_BMM150_LINK_SPI_DEINIT(HANDLE, FUC) (HANDLE)->spi_deinit = FUC
286#define DRIVER_BMM150_LINK_SPI_READ(HANDLE, FUC) (HANDLE)->spi_read = FUC
294#define DRIVER_BMM150_LINK_SPI_WRITE(HANDLE, FUC) (HANDLE)->spi_write = FUC
302#define DRIVER_BMM150_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
310#define DRIVER_BMM150_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
318#define DRIVER_BMM150_LINK_RECEIVE_CALLBACK(HANDLE, FUC) (HANDLE)->receive_callback = FUC
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
@ BMM150_ADVANCED_SELF_TEST_NORMAL
@ BMM150_ADVANCED_SELF_TEST_NEGATIVE
@ BMM150_ADVANCED_SELF_TEST_POSITIVE
@ BMM150_INTERRUPT_PIN_POLARITY_LOW
@ BMM150_INTERRUPT_PIN_POLARITY_HIGH
@ BMM150_DATA_READY_PIN_POLARITY_HIGH
@ BMM150_DATA_READY_PIN_POLARITY_LOW
@ BMM150_ADDRESS_CSB_SDO_01
@ BMM150_ADDRESS_CSB_SDO_11
@ BMM150_ADDRESS_CSB_SDO_00
@ BMM150_ADDRESS_CSB_SDO_10
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
bmm150 handle structure definition
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)
bmm150 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v