LibDriver HMC5883L
Loading...
Searching...
No Matches
hmc5883l base driver function

hmc5883l base driver modules More...

Collaboration diagram for hmc5883l base driver function:

Data Structures

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

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

Detailed Description

hmc5883l base driver modules

Typedef Documentation

◆ hmc5883l_handle_t

hmc5883l handle structure definition

◆ hmc5883l_info_t

hmc5883l information structure definition

Enumeration Type Documentation

◆ hmc5883l_average_sample_t

hmc5883l average sample enumeration definition

Enumerator
HMC5883L_AVERAGE_SAMPLE_1 

average sample 1

HMC5883L_AVERAGE_SAMPLE_2 

average sample 2

HMC5883L_AVERAGE_SAMPLE_4 

average sample 4

HMC5883L_AVERAGE_SAMPLE_8 

average sample 8

Definition at line 63 of file driver_hmc5883l.h.

◆ hmc5883l_data_output_rate_t

hmc5883l data output rate enumeration definition

Enumerator
HMC5883L_DATA_OUTPUT_RATE_0P75 

0.75Hz output rate

HMC5883L_DATA_OUTPUT_RATE_1P5 

1.5Hz output rate

HMC5883L_DATA_OUTPUT_RATE_3 

3Hz output rate

HMC5883L_DATA_OUTPUT_RATE_7P5 

7.5Hz output rate

HMC5883L_DATA_OUTPUT_RATE_15 

15Hz output rate

HMC5883L_DATA_OUTPUT_RATE_30 

30Hz output rate

HMC5883L_DATA_OUTPUT_RATE_75 

75Hz output rate

Definition at line 74 of file driver_hmc5883l.h.

◆ hmc5883l_gain_t

hmc5883l gain enumeration definition

Enumerator
HMC5883L_GAIN_1370 

gain 1370

HMC5883L_GAIN_1090 

gain 1090

HMC5883L_GAIN_820 

gain 820

HMC5883L_GAIN_660 

gain 660

HMC5883L_GAIN_440 

gain 440

HMC5883L_GAIN_390 

gain 390

HMC5883L_GAIN_330 

gain 330

HMC5883L_GAIN_230 

gain 230

Definition at line 98 of file driver_hmc5883l.h.

◆ hmc5883l_mode_t

hmc5883l mode enumeration definition

Enumerator
HMC5883L_MODE_NORMAL 

normal mode

HMC5883L_MODE_POSITIVE_BIAS 

positive bias mode

HMC5883L_MODE_NEGATIVE_BIAS 

negative bias mode

Definition at line 88 of file driver_hmc5883l.h.

Function Documentation

◆ hmc5883l_continuous_read()

uint8_t hmc5883l_continuous_read ( hmc5883l_handle_t * handle,
int16_t raw[3],
float m_gauss[3] )

read data continuously

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*rawpointer to a raw data buffer
[out]*m_gausspointer to a converted data buffer
Returns
status code
  • 0 success
  • 1 continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 939 of file driver_hmc5883l.c.

◆ hmc5883l_deinit()

uint8_t hmc5883l_deinit ( hmc5883l_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 power down failed
Note
none

Definition at line 292 of file driver_hmc5883l.c.

◆ hmc5883l_disable_high_speed_iic()

uint8_t hmc5883l_disable_high_speed_iic ( hmc5883l_handle_t * handle)

disable the high speed iic

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 disable high speed iic failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 679 of file driver_hmc5883l.c.

◆ hmc5883l_enable_high_speed_iic()

uint8_t hmc5883l_enable_high_speed_iic ( hmc5883l_handle_t * handle)

enable the high speed iic

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 enable high speed iic failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 643 of file driver_hmc5883l.c.

◆ hmc5883l_get_average_sample()

uint8_t hmc5883l_get_average_sample ( hmc5883l_handle_t * handle,
hmc5883l_average_sample_t * average_sample )

get the average sample rate

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*average_samplepointer to an average sample rate buffer
Returns
status code
  • 0 success
  • 1 get average sample failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 382 of file driver_hmc5883l.c.

◆ hmc5883l_get_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

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*data_ratepointer to a data output rate buffer
Returns
status code
  • 0 success
  • 1 get data output rate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 457 of file driver_hmc5883l.c.

◆ hmc5883l_get_gain()

uint8_t hmc5883l_get_gain ( hmc5883l_handle_t * handle,
hmc5883l_gain_t * gain )

get the chip gain

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*gainpointer to a chip gain buffer
Returns
status code
  • 0 success
  • 1 get gain failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 607 of file driver_hmc5883l.c.

◆ hmc5883l_get_mode()

uint8_t hmc5883l_get_mode ( hmc5883l_handle_t * handle,
hmc5883l_mode_t * mode )

get the chip mode

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*modepointer to a chip mode buffer
Returns
status code
  • 0 success
  • 1 get mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 532 of file driver_hmc5883l.c.

◆ hmc5883l_info()

uint8_t hmc5883l_info ( hmc5883l_info_t * info)

get chip's information

Parameters
[out]*infopointer to an hmc5883l info structure
Returns
status code
  • 0 success
  • 2 handle is NULL
Note
none

Definition at line 1121 of file driver_hmc5883l.c.

◆ hmc5883l_init()

uint8_t hmc5883l_init ( hmc5883l_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
Note
none

Definition at line 178 of file driver_hmc5883l.c.

◆ hmc5883l_set_average_sample()

uint8_t hmc5883l_set_average_sample ( hmc5883l_handle_t * handle,
hmc5883l_average_sample_t average_sample )

set the average sample rate

Parameters
[in]*handlepointer to an hmc5883l handle structure
[in]average_sampleaverage sample rate
Returns
status code
  • 0 success
  • 1 set average sample failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 344 of file driver_hmc5883l.c.

◆ hmc5883l_set_data_output_rate()

uint8_t hmc5883l_set_data_output_rate ( hmc5883l_handle_t * handle,
hmc5883l_data_output_rate_t data_rate )

set the data output rate

Parameters
[in]*handlepointer to an hmc5883l handle structure
[in]data_ratedata output rate
Returns
status code
  • 0 success
  • 1 set data output rate failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 419 of file driver_hmc5883l.c.

◆ hmc5883l_set_gain()

uint8_t hmc5883l_set_gain ( hmc5883l_handle_t * handle,
hmc5883l_gain_t gain )

set the chip gain

Parameters
[in]*handlepointer to an hmc5883l handle structure
[in]gainchip gain
Returns
status code
  • 0 success
  • 1 set gain failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 569 of file driver_hmc5883l.c.

◆ hmc5883l_set_mode()

uint8_t hmc5883l_set_mode ( hmc5883l_handle_t * handle,
hmc5883l_mode_t mode )

set the chip mode

Parameters
[in]*handlepointer to an hmc5883l handle structure
[in]modechip mode
Returns
status code
  • 0 success
  • 1 set mode failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 494 of file driver_hmc5883l.c.

◆ hmc5883l_single_read()

uint8_t hmc5883l_single_read ( hmc5883l_handle_t * handle,
int16_t raw[3],
float m_gauss[3] )

read data once

Parameters
[in]*handlepointer to an hmc5883l handle structure
[out]*rawpointer to a raw data buffer
[out]*m_gausspointer to a converted data buffer
Returns
status code
  • 0 success
  • 1 single read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 717 of file driver_hmc5883l.c.

◆ hmc5883l_start_continuous_read()

uint8_t hmc5883l_start_continuous_read ( hmc5883l_handle_t * handle)

start reading data

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 start continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 864 of file driver_hmc5883l.c.

◆ hmc5883l_stop_continuous_read()

uint8_t hmc5883l_stop_continuous_read ( hmc5883l_handle_t * handle)

stop reading data

Parameters
[in]*handlepointer to an hmc5883l handle structure
Returns
status code
  • 0 success
  • 1 stop continuous read failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 900 of file driver_hmc5883l.c.