LibDriver MAG3110
Loading...
Searching...
No Matches
driver_mag3110.h File Reference

driver mag3110 header file More...

#include <stdio.h>
#include <stdint.h>
#include <string.h>
Include dependency graph for driver_mag3110.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  mag3110_handle_s
 mag3110 handle structure definition More...
struct  mag3110_info_s
 mag3110 information structure definition More...

Macros

#define DRIVER_MAG3110_LINK_INIT(HANDLE, STRUCTURE)
 initialize mag3110_handle_t structure
#define DRIVER_MAG3110_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_MAG3110_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_MAG3110_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_MAG3110_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_MAG3110_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_MAG3110_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct mag3110_handle_s mag3110_handle_t
 mag3110 handle structure definition
typedef struct mag3110_info_s mag3110_info_t
 mag3110 information structure definition

Enumerations

enum  mag3110_bool_t { MAG3110_BOOL_FALSE = 0x00 , MAG3110_BOOL_TRUE = 0x01 }
 mag3110 bool enumeration definition More...
enum  mag3110_status_t {
  MAG3110_STATUS_ZYX_OVERWRITE = (1 << 7) , MAG3110_STATUS_Z_OVERWRITE = (1 << 6) , MAG3110_STATUS_Y_OVERWRITE = (1 << 5) , MAG3110_STATUS_X_OVERWRITE = (1 << 4) ,
  MAG3110_STATUS_ZYX_READY = (1 << 3) , MAG3110_STATUS_Z_READY = (1 << 2) , MAG3110_STATUS_Y_READY = (1 << 1) , MAG3110_STATUS_X_READY = (1 << 0)
}
 mag3110 status enumeration definition More...
enum  mag3110_mode_status_t { MAG3110_MODE_STATUS_STANDBY = 0x00 , MAG3110_MODE_STATUS_ACTIVE_RAW = 0x01 , MAG3110_MODE_STATUS_ACTIVE_NON_RAW = 0x02 }
 mag3110 mode status enumeration definition More...
enum  mag3110_mode_t { MAG3110_MODE_STANDBY = 0x00 , MAG3110_MODE_ACTIVE = 0x01 }
 mag3110 mode enumeration definition More...
enum  mag3110_rate_over_sample_t {
  MAG3110_RATE_80HZ_OVER_SAMPLE_16 = 0x00 , MAG3110_RATE_40HZ_OVER_SAMPLE_32 = 0x01 , MAG3110_RATE_20HZ_OVER_SAMPLE_64 = 0x02 , MAG3110_RATE_10HZ_OVER_SAMPLE_128 = 0x03 ,
  MAG3110_RATE_40HZ_OVER_SAMPLE_16 = 0x04 , MAG3110_RATE_20HZ_OVER_SAMPLE_32 = 0x05 , MAG3110_RATE_10HZ_OVER_SAMPLE_64 = 0x06 , MAG3110_RATE_5HZ_OVER_SAMPLE_128 = 0x07 ,
  MAG3110_RATE_20HZ_OVER_SAMPLE_16 = 0x08 , MAG3110_RATE_10HZ_OVER_SAMPLE_32 = 0x09 , MAG3110_RATE_5HZ_OVER_SAMPLE_64 = 0x0A , MAG3110_RATE_2P5HZ_OVER_SAMPLE_128 = 0x0B ,
  MAG3110_RATE_10HZ_OVER_SAMPLE_16 = 0x0C , MAG3110_RATE_5HZ_OVER_SAMPLE_32 = 0x0D , MAG3110_RATE_2P5HZ_OVER_SAMPLE_64 = 0x0E , MAG3110_RATE_1P25HZ_OVER_SAMPLE_128 = 0x0F ,
  MAG3110_RATE_5HZ_OVER_SAMPLE_16 = 0x10 , MAG3110_RATE_2P5HZ_OVER_SAMPLE_32 = 0x11 , MAG3110_RATE_1P25HZ_OVER_SAMPLE_64 = 0x12 , MAG3110_RATE_0P63HZ_OVER_SAMPLE_128 = 0x13 ,
  MAG3110_RATE_2P5HZ_OVER_SAMPLE_16 = 0x14 , MAG3110_RATE_1P25HZ_OVER_SAMPLE_32 = 0x15 , MAG3110_RATE_0P63HZ_OVER_SAMPLE_64 = 0x16 , MAG3110_RATE_0P31HZ_OVER_SAMPLE_128 = 0x17 ,
  MAG3110_RATE_1P25HZ_OVER_SAMPLE_16 = 0x18 , MAG3110_RATE_0P63HZ_OVER_SAMPLE_32 = 0x19 , MAG3110_RATE_0P31HZ_OVER_SAMPLE_64 = 0x1A , MAG3110_RATE_0P16HZ_OVER_SAMPLE_128 = 0x1B ,
  MAG3110_RATE_0P63HZ_OVER_SAMPLE_16 = 0x1C , MAG3110_RATE_0P31HZ_OVER_SAMPLE_32 = 0x1D , MAG3110_RATE_0P16HZ_OVER_SAMPLE_64 = 0x1E , MAG3110_RATE_0P08HZ_OVER_SAMPLE_128 = 0x1F
}
 mag3110 rate over sample enumeration definition More...

Functions

uint8_t mag3110_info (mag3110_info_t *info)
 get chip's information
uint8_t mag3110_init (mag3110_handle_t *handle)
 initialize the chip
uint8_t mag3110_deinit (mag3110_handle_t *handle)
 close the chip
uint8_t mag3110_read (mag3110_handle_t *handle, int16_t raw[3], float ut[3])
 read data
uint8_t mag3110_reset (mag3110_handle_t *handle)
 reset
uint8_t mag3110_read_die_temperature (mag3110_handle_t *handle, int8_t *raw, float *degree)
 read die temperature
uint8_t mag3110_get_data_ready_status (mag3110_handle_t *handle, uint8_t *status)
 get data ready status
uint8_t mag3110_get_mode_status (mag3110_handle_t *handle, mag3110_mode_status_t *mode)
 get mode status
uint8_t mag3110_set_offset_x (mag3110_handle_t *handle, uint16_t offset)
 set offset x
uint8_t mag3110_get_offset_x (mag3110_handle_t *handle, uint16_t *offset)
 get offset x
uint8_t mag3110_set_offset_y (mag3110_handle_t *handle, uint16_t offset)
 set offset y
uint8_t mag3110_get_offset_y (mag3110_handle_t *handle, uint16_t *offset)
 get offset y
uint8_t mag3110_set_offset_z (mag3110_handle_t *handle, uint16_t offset)
 set offset z
uint8_t mag3110_get_offset_z (mag3110_handle_t *handle, uint16_t *offset)
 get offset z
uint8_t mag3110_set_rate_over_sample (mag3110_handle_t *handle, mag3110_rate_over_sample_t rate_over_sample)
 set rate over sample
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_set_fast_read_mode (mag3110_handle_t *handle, mag3110_bool_t enable)
 enable or disable fast read 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_trigger_mode (mag3110_handle_t *handle, mag3110_bool_t enable)
 enable or disable trigger mode
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_mode (mag3110_handle_t *handle, mag3110_mode_t *mode)
 get mode
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_set_disable_offset_correction (mag3110_handle_t *handle, mag3110_bool_t enable)
 enable or disable offset correction
uint8_t mag3110_get_disable_offset_correction (mag3110_handle_t *handle, mag3110_bool_t *enable)
 get offset correction status
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_set_reg (mag3110_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t mag3110_get_reg (mag3110_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register

Detailed Description

driver mag3110 header file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2025-08-18

history

Date Version Author Description
2025/08/18 1.0 Shifeng Li first upload

Definition in file driver_mag3110.h.