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

driver hmc5883l header file More...

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

Go to the source code of this file.

Data Structures

struct  hmc5883l_handle_s
 hmc5883l handle structure definition More...
struct  hmc5883l_info_s
 hmc5883l information structure definition More...

Macros

#define DRIVER_HMC5883L_LINK_INIT(HANDLE, STRUCTURE)
 initialize hmc5883l_handle_t structure
#define DRIVER_HMC5883L_LINK_IIC_INIT(HANDLE, FUC)
 link iic_init function
#define DRIVER_HMC5883L_LINK_IIC_DEINIT(HANDLE, FUC)
 link iic_deinit function
#define DRIVER_HMC5883L_LINK_IIC_READ(HANDLE, FUC)
 link iic_read function
#define DRIVER_HMC5883L_LINK_IIC_WRITE(HANDLE, FUC)
 link iic_write function
#define DRIVER_HMC5883L_LINK_DELAY_MS(HANDLE, FUC)
 link delay_ms function
#define DRIVER_HMC5883L_LINK_DEBUG_PRINT(HANDLE, FUC)
 link debug_print function

Typedefs

typedef struct hmc5883l_handle_s hmc5883l_handle_t
 hmc5883l handle structure definition
typedef struct hmc5883l_info_s hmc5883l_info_t
 hmc5883l information structure definition

Enumerations

enum  hmc5883l_average_sample_t { HMC5883L_AVERAGE_SAMPLE_1 = 0x00 , HMC5883L_AVERAGE_SAMPLE_2 = 0x01 , HMC5883L_AVERAGE_SAMPLE_4 = 0x02 , HMC5883L_AVERAGE_SAMPLE_8 = 0x03 }
 hmc5883l average sample enumeration definition More...
enum  hmc5883l_data_output_rate_t {
  HMC5883L_DATA_OUTPUT_RATE_0P75 = 0x00 , HMC5883L_DATA_OUTPUT_RATE_1P5 = 0x01 , HMC5883L_DATA_OUTPUT_RATE_3 = 0x02 , HMC5883L_DATA_OUTPUT_RATE_7P5 = 0x03 ,
  HMC5883L_DATA_OUTPUT_RATE_15 = 0x04 , HMC5883L_DATA_OUTPUT_RATE_30 = 0x05 , HMC5883L_DATA_OUTPUT_RATE_75 = 0x06
}
 hmc5883l data output rate enumeration definition More...
enum  hmc5883l_mode_t { HMC5883L_MODE_NORMAL = 0x00 , HMC5883L_MODE_POSITIVE_BIAS = 0x01 , HMC5883L_MODE_NEGATIVE_BIAS = 0x02 }
 hmc5883l mode enumeration definition More...
enum  hmc5883l_gain_t {
  HMC5883L_GAIN_1370 = 0x00 , HMC5883L_GAIN_1090 = 0x01 , HMC5883L_GAIN_820 = 0x02 , HMC5883L_GAIN_660 = 0x03 ,
  HMC5883L_GAIN_440 = 0x04 , HMC5883L_GAIN_390 = 0x05 , HMC5883L_GAIN_330 = 0x06 , HMC5883L_GAIN_230 = 0x07
}
 hmc5883l gain enumeration definition More...

Functions

uint8_t hmc5883l_info (hmc5883l_info_t *info)
 get chip's information
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_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_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_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

Detailed Description

driver hmc5883l 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
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.h.