![]() |
LibDriver MAG3110
|
driver mag3110 source file More...
#include "driver_mag3110.h"Go to the source code of this file.
Macros | |
| #define | CHIP_NAME "NXP MAG3110" |
| chip information definition | |
| #define | MANUFACTURER_NAME "NXP" |
| #define | SUPPLY_VOLTAGE_MIN 1.95f |
| #define | SUPPLY_VOLTAGE_MAX 3.6f |
| #define | MAX_CURRENT 0.9f |
| #define | TEMPERATURE_MIN -40.0f |
| #define | TEMPERATURE_MAX 85.0f |
| #define | DRIVER_VERSION 1000 |
| #define | MAG3110_ADDRESS (0x0E << 1) |
| iic address definition | |
| #define | MAG3110_REG_DR_STATUS 0x00 |
| chip register definition | |
| #define | MAG3110_REG_OUT_X_MSB 0x01 |
| #define | MAG3110_REG_OUT_X_LSB 0x02 |
| #define | MAG3110_REG_OUT_Y_MSB 0x03 |
| #define | MAG3110_REG_OUT_Y_LSB 0x04 |
| #define | MAG3110_REG_OUT_Z_MSB 0x05 |
| #define | MAG3110_REG_OUT_Z_LSB 0x06 |
| #define | MAG3110_REG_WHO_AM_I 0x07 |
| #define | MAG3110_REG_SYSMOD 0x08 |
| #define | MAG3110_REG_OFF_X_MSB 0x09 |
| #define | MAG3110_REG_OFF_X_LSB 0x0A |
| #define | MAG3110_REG_OFF_Y_MSB 0x0B |
| #define | MAG3110_REG_OFF_Y_LSB 0x0C |
| #define | MAG3110_REG_OFF_Z_MSB 0x0D |
| #define | MAG3110_REG_OFF_Z_LSB 0x0E |
| #define | MAG3110_REG_DIE_TEMP 0x0F |
| #define | MAG3110_REG_CTRL_REG1 0x10 |
| #define | MAG3110_REG_CTRL_REG2 0x11 |
Functions | |
| 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_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_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_read_die_temperature (mag3110_handle_t *handle, int8_t *raw, float *degree) |
| read die temperature | |
| 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_reset (mag3110_handle_t *handle) |
| reset | |
| 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_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 | |
| uint8_t | mag3110_info (mag3110_info_t *info) |
| get chip's information | |
driver mag3110 source 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.
| Date | Version | Author | Description |
|---|---|---|---|
| 2025/08/18 | 1.0 | Shifeng Li | first upload |
Definition in file driver_mag3110.c.
| #define CHIP_NAME "NXP MAG3110" |
| #define DRIVER_VERSION 1000 |
driver version
Definition at line 49 of file driver_mag3110.c.
| #define MAG3110_ADDRESS (0x0E << 1) |
| #define MAG3110_REG_CTRL_REG1 0x10 |
ctrl reg1 register
Definition at line 75 of file driver_mag3110.c.
| #define MAG3110_REG_CTRL_REG2 0x11 |
ctrl reg2 register
Definition at line 76 of file driver_mag3110.c.
| #define MAG3110_REG_DIE_TEMP 0x0F |
die temp register
Definition at line 74 of file driver_mag3110.c.
| #define MAG3110_REG_DR_STATUS 0x00 |
| #define MAG3110_REG_OFF_X_LSB 0x0A |
off x lsb register
Definition at line 69 of file driver_mag3110.c.
| #define MAG3110_REG_OFF_X_MSB 0x09 |
off x msb register
Definition at line 68 of file driver_mag3110.c.
| #define MAG3110_REG_OFF_Y_LSB 0x0C |
off y lsb register
Definition at line 71 of file driver_mag3110.c.
| #define MAG3110_REG_OFF_Y_MSB 0x0B |
off y msb register
Definition at line 70 of file driver_mag3110.c.
| #define MAG3110_REG_OFF_Z_LSB 0x0E |
off z lsb register
Definition at line 73 of file driver_mag3110.c.
| #define MAG3110_REG_OFF_Z_MSB 0x0D |
off z msb register
Definition at line 72 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_X_LSB 0x02 |
out x lsb register
Definition at line 61 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_X_MSB 0x01 |
out x msb register
Definition at line 60 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_Y_LSB 0x04 |
out y lsb register
Definition at line 63 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_Y_MSB 0x03 |
out y msb register
Definition at line 62 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_Z_LSB 0x06 |
out z lsb register
Definition at line 65 of file driver_mag3110.c.
| #define MAG3110_REG_OUT_Z_MSB 0x05 |
out z msb register
Definition at line 64 of file driver_mag3110.c.
| #define MAG3110_REG_SYSMOD 0x08 |
sysmod register
Definition at line 67 of file driver_mag3110.c.
| #define MAG3110_REG_WHO_AM_I 0x07 |
who am i register
Definition at line 66 of file driver_mag3110.c.
| #define MANUFACTURER_NAME "NXP" |
manufacturer name
Definition at line 43 of file driver_mag3110.c.
| #define MAX_CURRENT 0.9f |
chip max current
Definition at line 46 of file driver_mag3110.c.
| #define SUPPLY_VOLTAGE_MAX 3.6f |
chip max supply voltage
Definition at line 45 of file driver_mag3110.c.
| #define SUPPLY_VOLTAGE_MIN 1.95f |
chip min supply voltage
Definition at line 44 of file driver_mag3110.c.
| #define TEMPERATURE_MAX 85.0f |
chip max operating temperature
Definition at line 48 of file driver_mag3110.c.
| #define TEMPERATURE_MIN -40.0f |
chip min operating temperature
Definition at line 47 of file driver_mag3110.c.