37#ifndef DRIVER_MAG3110_H
38#define DRIVER_MAG3110_H
148 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
149 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
188#define DRIVER_MAG3110_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
196#define DRIVER_MAG3110_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
204#define DRIVER_MAG3110_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
212#define DRIVER_MAG3110_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
220#define DRIVER_MAG3110_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
228#define DRIVER_MAG3110_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
236#define DRIVER_MAG3110_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t mag3110_set_rate_over_sample(mag3110_handle_t *handle, mag3110_rate_over_sample_t rate_over_sample)
set rate over sample
mag3110_status_t
mag3110 status enumeration definition
uint8_t mag3110_info(mag3110_info_t *info)
get chip's information
uint8_t mag3110_get_data_ready_status(mag3110_handle_t *handle, uint8_t *status)
get data ready status
uint8_t mag3110_set_trigger_mode(mag3110_handle_t *handle, mag3110_bool_t enable)
enable or disable trigger mode
uint8_t mag3110_get_offset_z(mag3110_handle_t *handle, uint16_t *offset)
get offset z
struct mag3110_handle_s mag3110_handle_t
mag3110 handle structure definition
uint8_t mag3110_get_trigger_mode(mag3110_handle_t *handle, mag3110_bool_t *enable)
get trigger mode status
uint8_t mag3110_set_mode(mag3110_handle_t *handle, mag3110_mode_t mode)
set mode
uint8_t mag3110_get_fast_read_mode(mag3110_handle_t *handle, mag3110_bool_t *enable)
get fast read mode status
uint8_t mag3110_set_disable_offset_correction(mag3110_handle_t *handle, mag3110_bool_t enable)
enable or disable offset correction
mag3110_bool_t
mag3110 bool enumeration definition
uint8_t mag3110_deinit(mag3110_handle_t *handle)
close the chip
uint8_t mag3110_init(mag3110_handle_t *handle)
initialize the chip
uint8_t mag3110_set_offset_y(mag3110_handle_t *handle, uint16_t offset)
set offset y
uint8_t mag3110_set_offset_x(mag3110_handle_t *handle, uint16_t offset)
set offset x
struct mag3110_info_s mag3110_info_t
mag3110 information structure definition
uint8_t mag3110_get_offset_y(mag3110_handle_t *handle, uint16_t *offset)
get offset y
uint8_t mag3110_get_rate_over_sample(mag3110_handle_t *handle, mag3110_rate_over_sample_t *rate_over_sample)
get rate over sample
uint8_t mag3110_get_offset_x(mag3110_handle_t *handle, uint16_t *offset)
get offset x
uint8_t mag3110_get_mode_status(mag3110_handle_t *handle, mag3110_mode_status_t *mode)
get mode status
mag3110_rate_over_sample_t
mag3110 rate over sample enumeration definition
uint8_t mag3110_set_automatic_magnetic_sensor_reset(mag3110_handle_t *handle, mag3110_bool_t enable)
enable or disable automatic magnetic sensor reset
uint8_t mag3110_read(mag3110_handle_t *handle, int16_t raw[3], float ut[3])
read data
uint8_t mag3110_set_fast_read_mode(mag3110_handle_t *handle, mag3110_bool_t enable)
enable or disable fast read mode
uint8_t mag3110_offset_convert_to_register(mag3110_handle_t *handle, float ut, uint16_t *reg)
convert the offset to the register raw data
uint8_t mag3110_offset_convert_to_data(mag3110_handle_t *handle, uint16_t reg, float *ut)
convert the register raw data to the offset threshold
uint8_t mag3110_get_mode(mag3110_handle_t *handle, mag3110_mode_t *mode)
get mode
uint8_t mag3110_reset(mag3110_handle_t *handle)
reset
uint8_t mag3110_get_disable_offset_correction(mag3110_handle_t *handle, mag3110_bool_t *enable)
get offset correction status
uint8_t mag3110_read_die_temperature(mag3110_handle_t *handle, int8_t *raw, float *degree)
read die temperature
uint8_t mag3110_set_offset_z(mag3110_handle_t *handle, uint16_t offset)
set offset z
mag3110_mode_status_t
mag3110 mode status enumeration definition
mag3110_mode_t
mag3110 mode enumeration definition
@ MAG3110_STATUS_Z_OVERWRITE
@ MAG3110_STATUS_ZYX_READY
@ MAG3110_STATUS_ZYX_OVERWRITE
@ MAG3110_STATUS_X_OVERWRITE
@ MAG3110_STATUS_Y_OVERWRITE
@ MAG3110_RATE_5HZ_OVER_SAMPLE_16
@ MAG3110_RATE_2P5HZ_OVER_SAMPLE_32
@ MAG3110_RATE_2P5HZ_OVER_SAMPLE_16
@ MAG3110_RATE_10HZ_OVER_SAMPLE_64
@ MAG3110_RATE_20HZ_OVER_SAMPLE_32
@ MAG3110_RATE_1P25HZ_OVER_SAMPLE_16
@ MAG3110_RATE_0P08HZ_OVER_SAMPLE_128
@ MAG3110_RATE_1P25HZ_OVER_SAMPLE_64
@ MAG3110_RATE_0P63HZ_OVER_SAMPLE_128
@ MAG3110_RATE_0P31HZ_OVER_SAMPLE_32
@ MAG3110_RATE_10HZ_OVER_SAMPLE_16
@ MAG3110_RATE_0P16HZ_OVER_SAMPLE_64
@ MAG3110_RATE_2P5HZ_OVER_SAMPLE_128
@ MAG3110_RATE_10HZ_OVER_SAMPLE_32
@ MAG3110_RATE_0P63HZ_OVER_SAMPLE_64
@ MAG3110_RATE_1P25HZ_OVER_SAMPLE_32
@ MAG3110_RATE_20HZ_OVER_SAMPLE_64
@ MAG3110_RATE_2P5HZ_OVER_SAMPLE_64
@ MAG3110_RATE_1P25HZ_OVER_SAMPLE_128
@ MAG3110_RATE_0P31HZ_OVER_SAMPLE_128
@ MAG3110_RATE_20HZ_OVER_SAMPLE_16
@ MAG3110_RATE_0P63HZ_OVER_SAMPLE_32
@ MAG3110_RATE_0P63HZ_OVER_SAMPLE_16
@ MAG3110_RATE_5HZ_OVER_SAMPLE_128
@ MAG3110_RATE_5HZ_OVER_SAMPLE_32
@ MAG3110_RATE_40HZ_OVER_SAMPLE_32
@ MAG3110_RATE_10HZ_OVER_SAMPLE_128
@ MAG3110_RATE_5HZ_OVER_SAMPLE_64
@ MAG3110_RATE_40HZ_OVER_SAMPLE_16
@ MAG3110_RATE_0P16HZ_OVER_SAMPLE_128
@ MAG3110_RATE_0P31HZ_OVER_SAMPLE_64
@ MAG3110_RATE_80HZ_OVER_SAMPLE_16
@ MAG3110_MODE_STATUS_ACTIVE_RAW
@ MAG3110_MODE_STATUS_ACTIVE_NON_RAW
@ MAG3110_MODE_STATUS_STANDBY
uint8_t mag3110_get_reg(mag3110_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t mag3110_set_reg(mag3110_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
mag3110 handle structure definition
void(* delay_ms)(uint32_t ms)
void(* debug_print)(const char *const fmt,...)
uint8_t(* iic_init)(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)
mag3110 information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v