LibDriver QMC5883L
Loading...
Searching...
No Matches
driver_qmc5883l.c File Reference

driver qmc5883l source file More...

#include "driver_qmc5883l.h"
Include dependency graph for driver_qmc5883l.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "QST QMC5883L"
 chip information definition
#define MANUFACTURER_NAME   "QST"
#define SUPPLY_VOLTAGE_MIN   2.16f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   2.6f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   1000
#define QMC5883L_ADDRESS   0x1A
 iic address definition
#define QMC5883L_REG_X_LSB   0x00
 chip register definition
#define QMC5883L_REG_X_MSB   0x01
#define QMC5883L_REG_Y_LSB   0x02
#define QMC5883L_REG_Y_MSB   0x03
#define QMC5883L_REG_Z_LSB   0x04
#define QMC5883L_REG_Z_MSB   0x05
#define QMC5883L_REG_STATUS   0x06
#define QMC5883L_REG_TEMP_LSB   0x07
#define QMC5883L_REG_TEMP_MSB   0x08
#define QMC5883L_REG_CONTROL1   0x09
#define QMC5883L_REG_CONTROL2   0x0A
#define QMC5883L_REG_PERIOD   0x0B
#define QMC5883L_REG_ID   0x0D

Functions

uint8_t qmc5883l_init (qmc5883l_handle_t *handle)
 initialize the chip
uint8_t qmc5883l_deinit (qmc5883l_handle_t *handle)
 close the chip
uint8_t qmc5883l_get_status (qmc5883l_handle_t *handle, uint8_t *status)
 get status
uint8_t qmc5883l_read_temperature (qmc5883l_handle_t *handle, int16_t *raw, float *deg)
 read temperature
uint8_t qmc5883l_set_mode (qmc5883l_handle_t *handle, qmc5883l_mode_t mode)
 set the chip mode
uint8_t qmc5883l_get_mode (qmc5883l_handle_t *handle, qmc5883l_mode_t *mode)
 get the chip mode
uint8_t qmc5883l_set_output_rate (qmc5883l_handle_t *handle, qmc5883l_output_rate_t rate)
 set the output rate
uint8_t qmc5883l_get_output_rate (qmc5883l_handle_t *handle, qmc5883l_output_rate_t *rate)
 get the output rate
uint8_t qmc5883l_set_full_scale (qmc5883l_handle_t *handle, qmc5883l_full_scale_t scale)
 set the full scale
uint8_t qmc5883l_get_full_scale (qmc5883l_handle_t *handle, qmc5883l_full_scale_t *scale)
 get the full scale
uint8_t qmc5883l_set_over_sample (qmc5883l_handle_t *handle, qmc5883l_over_sample_t sample)
 set the over sample
uint8_t qmc5883l_get_over_sample (qmc5883l_handle_t *handle, qmc5883l_over_sample_t *sample)
 get the over sample
uint8_t qmc5883l_set_interrupt (qmc5883l_handle_t *handle, qmc5883l_bool_t enable)
 enable or disable interrupt
uint8_t qmc5883l_get_interrupt (qmc5883l_handle_t *handle, qmc5883l_bool_t *enable)
 get interrupt status
uint8_t qmc5883l_set_pointer_roll_over (qmc5883l_handle_t *handle, qmc5883l_bool_t enable)
 enable or disable pointer roll over
uint8_t qmc5883l_get_pointer_roll_over (qmc5883l_handle_t *handle, qmc5883l_bool_t *enable)
 get pointer roll over status
uint8_t qmc5883l_soft_reset (qmc5883l_handle_t *handle)
 soft reset
uint8_t qmc5883l_set_period (qmc5883l_handle_t *handle, uint8_t fbr)
 set period
uint8_t qmc5883l_get_period (qmc5883l_handle_t *handle, uint8_t *fbr)
 get period
uint8_t qmc5883l_read (qmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
 read data
uint8_t qmc5883l_set_reg (qmc5883l_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t qmc5883l_get_reg (qmc5883l_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t qmc5883l_info (qmc5883l_info_t *info)
 get chip's information

Detailed Description

driver qmc5883l 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.

Version
1.0.0
Author
Shifeng Li
Date
2024-07-30

history

Date Version Author Description
2024/07/30 1.0 Shifeng Li first upload

Definition in file driver_qmc5883l.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "QST QMC5883L"

chip information definition

chip name

Definition at line 42 of file driver_qmc5883l.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_qmc5883l.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "QST"

manufacturer name

Definition at line 43 of file driver_qmc5883l.c.

◆ MAX_CURRENT

#define MAX_CURRENT   2.6f

chip max current

Definition at line 46 of file driver_qmc5883l.c.

◆ QMC5883L_ADDRESS

#define QMC5883L_ADDRESS   0x1A

iic address definition

iic address

Definition at line 54 of file driver_qmc5883l.c.

◆ QMC5883L_REG_CONTROL1

#define QMC5883L_REG_CONTROL1   0x09

control 1 register

Definition at line 68 of file driver_qmc5883l.c.

◆ QMC5883L_REG_CONTROL2

#define QMC5883L_REG_CONTROL2   0x0A

control 2 register

Definition at line 69 of file driver_qmc5883l.c.

◆ QMC5883L_REG_ID

#define QMC5883L_REG_ID   0x0D

chip id register

Definition at line 71 of file driver_qmc5883l.c.

◆ QMC5883L_REG_PERIOD

#define QMC5883L_REG_PERIOD   0x0B

period register

Definition at line 70 of file driver_qmc5883l.c.

◆ QMC5883L_REG_STATUS

#define QMC5883L_REG_STATUS   0x06

status register

Definition at line 65 of file driver_qmc5883l.c.

◆ QMC5883L_REG_TEMP_LSB

#define QMC5883L_REG_TEMP_LSB   0x07

temperature data lsb register

Definition at line 66 of file driver_qmc5883l.c.

◆ QMC5883L_REG_TEMP_MSB

#define QMC5883L_REG_TEMP_MSB   0x08

temperature data msb register

Definition at line 67 of file driver_qmc5883l.c.

◆ QMC5883L_REG_X_LSB

#define QMC5883L_REG_X_LSB   0x00

chip register definition

data output x lsb register

Definition at line 59 of file driver_qmc5883l.c.

◆ QMC5883L_REG_X_MSB

#define QMC5883L_REG_X_MSB   0x01

data output x msb register

Definition at line 60 of file driver_qmc5883l.c.

◆ QMC5883L_REG_Y_LSB

#define QMC5883L_REG_Y_LSB   0x02

data output y lsb register

Definition at line 61 of file driver_qmc5883l.c.

◆ QMC5883L_REG_Y_MSB

#define QMC5883L_REG_Y_MSB   0x03

data output y msb register

Definition at line 62 of file driver_qmc5883l.c.

◆ QMC5883L_REG_Z_LSB

#define QMC5883L_REG_Z_LSB   0x04

data output z lsb register

Definition at line 63 of file driver_qmc5883l.c.

◆ QMC5883L_REG_Z_MSB

#define QMC5883L_REG_Z_MSB   0x05

data output z msb register

Definition at line 64 of file driver_qmc5883l.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 45 of file driver_qmc5883l.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.16f

chip min supply voltage

Definition at line 44 of file driver_qmc5883l.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 48 of file driver_qmc5883l.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_qmc5883l.c.