LibDriver HMC5883L
Loading...
Searching...
No Matches
driver_hmc5883l.c File Reference

driver hmc5883l source file More...

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

Go to the source code of this file.

Macros

#define CHIP_NAME   "Honeywell HMC5883L"
 chip information definition
#define MANUFACTURER_NAME   "Honeywell"
#define SUPPLY_VOLTAGE_MIN   2.16f
#define SUPPLY_VOLTAGE_MAX   3.6f
#define MAX_CURRENT   0.1f
#define TEMPERATURE_MIN   -30.0f
#define TEMPERATURE_MAX   85.0f
#define DRIVER_VERSION   2000
#define HMC5883L_ADDRESS   0x3C
 iic address definition
#define HMC5883L_REG_CRA   0x00
 chip register definition
#define HMC5883L_REG_CRB   0x01
#define HMC5883L_REG_MODE   0x02
#define HMC5883L_REG_OUTXM   0x03
#define HMC5883L_REG_OUTXL   0x04
#define HMC5883L_REG_OUTYM   0x07
#define HMC5883L_REG_OUTYL   0x08
#define HMC5883L_REG_OUTZM   0x05
#define HMC5883L_REG_OUTZL   0x06
#define HMC5883L_REG_STATUS   0x09
#define HMC5883L_REG_IDA   0x0A
#define HMC5883L_REG_IDB   0x0B
#define HMC5883L_REG_IDC   0x0C

Functions

uint8_t hmc5883l_init (hmc5883l_handle_t *handle)
 initialize the chip
uint8_t hmc5883l_deinit (hmc5883l_handle_t *handle)
 close the chip
uint8_t hmc5883l_set_average_sample (hmc5883l_handle_t *handle, hmc5883l_average_sample_t average_sample)
 set the average sample rate
uint8_t hmc5883l_get_average_sample (hmc5883l_handle_t *handle, hmc5883l_average_sample_t *average_sample)
 get the average sample rate
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_get_data_output_rate (hmc5883l_handle_t *handle, hmc5883l_data_output_rate_t *data_rate)
 get the data output rate
uint8_t hmc5883l_set_mode (hmc5883l_handle_t *handle, hmc5883l_mode_t mode)
 set the chip mode
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_get_gain (hmc5883l_handle_t *handle, hmc5883l_gain_t *gain)
 get the chip gain
uint8_t hmc5883l_enable_high_speed_iic (hmc5883l_handle_t *handle)
 enable the high speed iic
uint8_t hmc5883l_disable_high_speed_iic (hmc5883l_handle_t *handle)
 disable the high speed iic
uint8_t hmc5883l_single_read (hmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
 read data once
uint8_t hmc5883l_start_continuous_read (hmc5883l_handle_t *handle)
 start reading data
uint8_t hmc5883l_stop_continuous_read (hmc5883l_handle_t *handle)
 stop reading data
uint8_t hmc5883l_continuous_read (hmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
 read data continuously
uint8_t hmc5883l_set_reg (hmc5883l_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
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_info (hmc5883l_info_t *info)
 get chip's information

Detailed Description

driver hmc5883l 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
2.0.0
Author
Shifeng Li
Date
2021-03-20

history

Date Version Author Description
2021/03/20 2.0 Shifeng Li format the code
2020/12/02 1.0 Shifeng Li first upload

Definition in file driver_hmc5883l.c.

Macro Definition Documentation

◆ CHIP_NAME

#define CHIP_NAME   "Honeywell HMC5883L"

chip information definition

chip name

Definition at line 43 of file driver_hmc5883l.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   2000

driver version

Definition at line 50 of file driver_hmc5883l.c.

◆ HMC5883L_ADDRESS

#define HMC5883L_ADDRESS   0x3C

iic address definition

iic address

Definition at line 55 of file driver_hmc5883l.c.

◆ HMC5883L_REG_CRA

#define HMC5883L_REG_CRA   0x00

chip register definition

cra register

Definition at line 60 of file driver_hmc5883l.c.

◆ HMC5883L_REG_CRB

#define HMC5883L_REG_CRB   0x01

crb register

Definition at line 61 of file driver_hmc5883l.c.

◆ HMC5883L_REG_IDA

#define HMC5883L_REG_IDA   0x0A

ida register

Definition at line 70 of file driver_hmc5883l.c.

◆ HMC5883L_REG_IDB

#define HMC5883L_REG_IDB   0x0B

idb register

Definition at line 71 of file driver_hmc5883l.c.

◆ HMC5883L_REG_IDC

#define HMC5883L_REG_IDC   0x0C

idc register

Definition at line 72 of file driver_hmc5883l.c.

◆ HMC5883L_REG_MODE

#define HMC5883L_REG_MODE   0x02

mode register

Definition at line 62 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTXL

#define HMC5883L_REG_OUTXL   0x04

outxl register

Definition at line 64 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTXM

#define HMC5883L_REG_OUTXM   0x03

outxm register

Definition at line 63 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTYL

#define HMC5883L_REG_OUTYL   0x08

outyl register

Definition at line 66 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTYM

#define HMC5883L_REG_OUTYM   0x07

outym register

Definition at line 65 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTZL

#define HMC5883L_REG_OUTZL   0x06

outzl register

Definition at line 68 of file driver_hmc5883l.c.

◆ HMC5883L_REG_OUTZM

#define HMC5883L_REG_OUTZM   0x05

outzm register

Definition at line 67 of file driver_hmc5883l.c.

◆ HMC5883L_REG_STATUS

#define HMC5883L_REG_STATUS   0x09

status register

Definition at line 69 of file driver_hmc5883l.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "Honeywell"

manufacturer name

Definition at line 44 of file driver_hmc5883l.c.

◆ MAX_CURRENT

#define MAX_CURRENT   0.1f

chip max current

Definition at line 47 of file driver_hmc5883l.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   3.6f

chip max supply voltage

Definition at line 46 of file driver_hmc5883l.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   2.16f

chip min supply voltage

Definition at line 45 of file driver_hmc5883l.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   85.0f

chip max operating temperature

Definition at line 49 of file driver_hmc5883l.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -30.0f

chip min operating temperature

Definition at line 48 of file driver_hmc5883l.c.