38#ifndef DRIVER_HMC5883L_H
39#define DRIVER_HMC5883L_H
117 uint8_t (*
iic_read)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
118 uint8_t (*
iic_write)(uint8_t addr, uint8_t reg, uint8_t *buf, uint16_t len);
157#define DRIVER_HMC5883L_LINK_INIT(HANDLE, STRUCTURE) memset(HANDLE, 0, sizeof(STRUCTURE))
165#define DRIVER_HMC5883L_LINK_IIC_INIT(HANDLE, FUC) (HANDLE)->iic_init = FUC
173#define DRIVER_HMC5883L_LINK_IIC_DEINIT(HANDLE, FUC) (HANDLE)->iic_deinit = FUC
181#define DRIVER_HMC5883L_LINK_IIC_READ(HANDLE, FUC) (HANDLE)->iic_read = FUC
189#define DRIVER_HMC5883L_LINK_IIC_WRITE(HANDLE, FUC) (HANDLE)->iic_write = FUC
197#define DRIVER_HMC5883L_LINK_DELAY_MS(HANDLE, FUC) (HANDLE)->delay_ms = FUC
205#define DRIVER_HMC5883L_LINK_DEBUG_PRINT(HANDLE, FUC) (HANDLE)->debug_print = FUC
uint8_t hmc5883l_set_mode(hmc5883l_handle_t *handle, hmc5883l_mode_t mode)
set the chip mode
hmc5883l_average_sample_t
hmc5883l average sample enumeration definition
hmc5883l_mode_t
hmc5883l mode enumeration definition
uint8_t hmc5883l_disable_high_speed_iic(hmc5883l_handle_t *handle)
disable the high speed iic
uint8_t hmc5883l_get_mode(hmc5883l_handle_t *handle, hmc5883l_mode_t *mode)
get the chip mode
uint8_t hmc5883l_set_gain(hmc5883l_handle_t *handle, hmc5883l_gain_t gain)
set the chip gain
uint8_t hmc5883l_set_average_sample(hmc5883l_handle_t *handle, hmc5883l_average_sample_t average_sample)
set the average sample rate
uint8_t hmc5883l_init(hmc5883l_handle_t *handle)
initialize the chip
uint8_t hmc5883l_continuous_read(hmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
read data continuously
uint8_t hmc5883l_set_data_output_rate(hmc5883l_handle_t *handle, hmc5883l_data_output_rate_t data_rate)
set the data output rate
uint8_t hmc5883l_info(hmc5883l_info_t *info)
get chip's information
uint8_t hmc5883l_deinit(hmc5883l_handle_t *handle)
close the chip
struct hmc5883l_handle_s hmc5883l_handle_t
hmc5883l handle structure definition
struct hmc5883l_info_s hmc5883l_info_t
hmc5883l information structure definition
hmc5883l_gain_t
hmc5883l gain enumeration definition
uint8_t hmc5883l_get_gain(hmc5883l_handle_t *handle, hmc5883l_gain_t *gain)
get the chip gain
hmc5883l_data_output_rate_t
hmc5883l data output rate enumeration definition
uint8_t hmc5883l_get_average_sample(hmc5883l_handle_t *handle, hmc5883l_average_sample_t *average_sample)
get the average sample rate
uint8_t hmc5883l_single_read(hmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
read data once
uint8_t hmc5883l_get_data_output_rate(hmc5883l_handle_t *handle, hmc5883l_data_output_rate_t *data_rate)
get the data output rate
uint8_t hmc5883l_start_continuous_read(hmc5883l_handle_t *handle)
start reading data
uint8_t hmc5883l_enable_high_speed_iic(hmc5883l_handle_t *handle)
enable the high speed iic
uint8_t hmc5883l_stop_continuous_read(hmc5883l_handle_t *handle)
stop reading data
@ HMC5883L_AVERAGE_SAMPLE_2
@ HMC5883L_AVERAGE_SAMPLE_1
@ HMC5883L_AVERAGE_SAMPLE_8
@ HMC5883L_AVERAGE_SAMPLE_4
@ HMC5883L_MODE_NEGATIVE_BIAS
@ HMC5883L_MODE_POSITIVE_BIAS
@ HMC5883L_DATA_OUTPUT_RATE_15
@ HMC5883L_DATA_OUTPUT_RATE_0P75
@ HMC5883L_DATA_OUTPUT_RATE_1P5
@ HMC5883L_DATA_OUTPUT_RATE_3
@ HMC5883L_DATA_OUTPUT_RATE_30
@ HMC5883L_DATA_OUTPUT_RATE_75
@ HMC5883L_DATA_OUTPUT_RATE_7P5
uint8_t hmc5883l_get_reg(hmc5883l_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
get the chip register
uint8_t hmc5883l_set_reg(hmc5883l_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
set the chip register
hmc5883l 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)
hmc5883l information structure definition
float supply_voltage_max_v
char manufacturer_name[32]
float supply_voltage_min_v