LibDriver QMC5883L
Loading...
Searching...
No Matches
qmc5883l base driver function

qmc5883l base driver modules More...

Collaboration diagram for qmc5883l base driver function:

Data Structures

struct  qmc5883l_handle_s
 qmc5883l handle structure definition More...
struct  qmc5883l_info_s
 qmc5883l information structure definition More...

Typedefs

typedef struct qmc5883l_handle_s qmc5883l_handle_t
 qmc5883l handle structure definition
typedef struct qmc5883l_info_s qmc5883l_info_t
 qmc5883l information structure definition

Enumerations

enum  qmc5883l_bool_t { QMC5883L_BOOL_FALSE = 0x00 , QMC5883L_BOOL_TRUE = 0x01 }
 qmc5883l bool enumeration definition More...
enum  qmc5883l_status_t { QMC5883L_STATUS_DOR = (1 << 2) , QMC5883L_STATUS_OVL = (1 << 1) , QMC5883L_STATUS_DRDY = (1 << 0) }
 qmc5883l status enumeration definition More...
enum  qmc5883l_mode_t { QMC5883L_MODE_STANDBY = 0x00 , QMC5883L_MODE_CONTINUOUS = 0x01 }
 qmc5883l mode enumeration definition More...
enum  qmc5883l_output_rate_t { QMC5883L_OUTPUT_RATE_10HZ = 0x00 , QMC5883L_OUTPUT_RATE_50HZ = 0x01 , QMC5883L_OUTPUT_RATE_100HZ = 0x02 , QMC5883L_OUTPUT_RATE_200HZ = 0x03 }
 qmc5883l output rate enumeration definition More...
enum  qmc5883l_full_scale_t { QMC5883L_FULL_SCALE_2GAUSS = 0x00 , QMC5883L_FULL_SCALE_8GAUSS = 0x01 }
 qmc5883l full scale enumeration definition More...
enum  qmc5883l_over_sample_t { QMC5883L_OVER_SAMPLE_512 = 0x00 , QMC5883L_OVER_SAMPLE_256 = 0x01 , QMC5883L_OVER_SAMPLE_128 = 0x02 , QMC5883L_OVER_SAMPLE_64 = 0x03 }
 qmc5883l over sample enumeration definition More...

Functions

uint8_t qmc5883l_info (qmc5883l_info_t *info)
 get chip's information
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_read (qmc5883l_handle_t *handle, int16_t raw[3], float m_gauss[3])
 read data
uint8_t qmc5883l_read_temperature (qmc5883l_handle_t *handle, int16_t *raw, float *deg)
 read temperature
uint8_t qmc5883l_get_status (qmc5883l_handle_t *handle, uint8_t *status)
 get status
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

Detailed Description

qmc5883l base driver modules

Typedef Documentation

◆ qmc5883l_handle_t

qmc5883l handle structure definition

◆ qmc5883l_info_t

qmc5883l information structure definition

Enumeration Type Documentation

◆ qmc5883l_bool_t

qmc5883l bool enumeration definition

Enumerator
QMC5883L_BOOL_FALSE 

false

QMC5883L_BOOL_TRUE 

true

Definition at line 62 of file driver_qmc5883l.h.

◆ qmc5883l_full_scale_t

qmc5883l full scale enumeration definition

Enumerator
QMC5883L_FULL_SCALE_2GAUSS 

2gauss

QMC5883L_FULL_SCALE_8GAUSS 

8gauss

Definition at line 101 of file driver_qmc5883l.h.

◆ qmc5883l_mode_t

qmc5883l mode enumeration definition

Enumerator
QMC5883L_MODE_STANDBY 

standby mode

QMC5883L_MODE_CONTINUOUS 

continuous mode

Definition at line 81 of file driver_qmc5883l.h.

◆ qmc5883l_output_rate_t

qmc5883l output rate enumeration definition

Enumerator
QMC5883L_OUTPUT_RATE_10HZ 

10Hz

QMC5883L_OUTPUT_RATE_50HZ 

50Hz

QMC5883L_OUTPUT_RATE_100HZ 

100Hz

QMC5883L_OUTPUT_RATE_200HZ 

200Hz

Definition at line 90 of file driver_qmc5883l.h.

◆ qmc5883l_over_sample_t

qmc5883l over sample enumeration definition

Enumerator
QMC5883L_OVER_SAMPLE_512 

512

QMC5883L_OVER_SAMPLE_256 

256

QMC5883L_OVER_SAMPLE_128 

128

QMC5883L_OVER_SAMPLE_64 

64

Definition at line 110 of file driver_qmc5883l.h.

◆ qmc5883l_status_t

qmc5883l status enumeration definition

Enumerator
QMC5883L_STATUS_DOR 

data skip

QMC5883L_STATUS_OVL 

out of range

QMC5883L_STATUS_DRDY 

data ready

Definition at line 71 of file driver_qmc5883l.h.

Function Documentation

◆ qmc5883l_deinit()

uint8_t qmc5883l_deinit ( qmc5883l_handle_t * handle)

close the chip

Parameters
[in]*handlepointer to a qmc5883l handle structure
Returns
status code
  • 0 success
  • 1 iic deinit failed
  • 2 handle is NULL
  • 3 handle is not initialized
  • 4 soft reset failed
Note
none

Definition at line 185 of file driver_qmc5883l.c.

◆ qmc5883l_get_full_scale()

uint8_t qmc5883l_get_full_scale ( qmc5883l_handle_t * handle,
qmc5883l_full_scale_t * scale )

get the full scale

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*scalepointer to a full scale buffer
Returns
status code
  • 0 success
  • 1 get full scale failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 523 of file driver_qmc5883l.c.

◆ qmc5883l_get_interrupt()

uint8_t qmc5883l_get_interrupt ( qmc5883l_handle_t * handle,
qmc5883l_bool_t * enable )

get interrupt status

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get interrupt failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 687 of file driver_qmc5883l.c.

◆ qmc5883l_get_mode()

uint8_t qmc5883l_get_mode ( qmc5883l_handle_t * handle,
qmc5883l_mode_t * mode )

get the chip mode

Parameters
[in]*handlepointer to a qmc5883l 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 359 of file driver_qmc5883l.c.

◆ qmc5883l_get_output_rate()

uint8_t qmc5883l_get_output_rate ( qmc5883l_handle_t * handle,
qmc5883l_output_rate_t * rate )

get the output rate

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

Definition at line 441 of file driver_qmc5883l.c.

◆ qmc5883l_get_over_sample()

uint8_t qmc5883l_get_over_sample ( qmc5883l_handle_t * handle,
qmc5883l_over_sample_t * sample )

get the over sample

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*samplepointer to an over sample buffer
Returns
status code
  • 0 success
  • 1 get over sample failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 605 of file driver_qmc5883l.c.

◆ qmc5883l_get_period()

uint8_t qmc5883l_get_period ( qmc5883l_handle_t * handle,
uint8_t * fbr )

get period

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*fbrpointer to a param buffer
Returns
status code
  • 0 success
  • 1 get period failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 888 of file driver_qmc5883l.c.

◆ qmc5883l_get_pointer_roll_over()

uint8_t qmc5883l_get_pointer_roll_over ( qmc5883l_handle_t * handle,
qmc5883l_bool_t * enable )

get pointer roll over status

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*enablepointer to a bool value buffer
Returns
status code
  • 0 success
  • 1 get pointer roll over failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 769 of file driver_qmc5883l.c.

◆ qmc5883l_get_status()

uint8_t qmc5883l_get_status ( qmc5883l_handle_t * handle,
uint8_t * status )

get status

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

Definition at line 238 of file driver_qmc5883l.c.

◆ qmc5883l_info()

uint8_t qmc5883l_info ( qmc5883l_info_t * info)

get chip's information

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

Definition at line 1072 of file driver_qmc5883l.c.

◆ qmc5883l_init()

uint8_t qmc5883l_init ( qmc5883l_handle_t * handle)

initialize the chip

Parameters
[in]*handlepointer to a qmc5883l handle structure
Returns
status code
  • 0 success
  • 1 iic initialization failed
  • 2 handle is NULL
  • 3 linked functions is NULL
  • 4 id is invalid
  • 4 soft reset failed
Note
none

Definition at line 85 of file driver_qmc5883l.c.

◆ qmc5883l_read()

uint8_t qmc5883l_read ( qmc5883l_handle_t * handle,
int16_t raw[3],
float m_gauss[3] )

read data

Parameters
[in]*handlepointer to a qmc5883l 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 924 of file driver_qmc5883l.c.

◆ qmc5883l_read_temperature()

uint8_t qmc5883l_read_temperature ( qmc5883l_handle_t * handle,
int16_t * raw,
float * deg )

read temperature

Parameters
[in]*handlepointer to a qmc5883l handle structure
[out]*rawpointer to a raw data buffer
[out]*degpointer to a converted data buffer
Returns
status code
  • 0 success
  • 1 read temperature failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
temperature sensor gain is factory-calibrated, but its offset has not been compensated, only relative temperature value is accurate.

Definition at line 276 of file driver_qmc5883l.c.

◆ qmc5883l_set_full_scale()

uint8_t qmc5883l_set_full_scale ( qmc5883l_handle_t * handle,
qmc5883l_full_scale_t scale )

set the full scale

Parameters
[in]*handlepointer to a qmc5883l handle structure
[in]scaleset full scale
Returns
status code
  • 0 success
  • 1 set full scale failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 478 of file driver_qmc5883l.c.

◆ qmc5883l_set_interrupt()

uint8_t qmc5883l_set_interrupt ( qmc5883l_handle_t * handle,
qmc5883l_bool_t enable )

enable or disable interrupt

Parameters
[in]*handlepointer to a qmc5883l handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set interrupt failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 642 of file driver_qmc5883l.c.

◆ qmc5883l_set_mode()

uint8_t qmc5883l_set_mode ( qmc5883l_handle_t * handle,
qmc5883l_mode_t mode )

set the chip mode

Parameters
[in]*handlepointer to a qmc5883l 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 314 of file driver_qmc5883l.c.

◆ qmc5883l_set_output_rate()

uint8_t qmc5883l_set_output_rate ( qmc5883l_handle_t * handle,
qmc5883l_output_rate_t rate )

set the output rate

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

Definition at line 396 of file driver_qmc5883l.c.

◆ qmc5883l_set_over_sample()

uint8_t qmc5883l_set_over_sample ( qmc5883l_handle_t * handle,
qmc5883l_over_sample_t sample )

set the over sample

Parameters
[in]*handlepointer to a qmc5883l handle structure
[in]sampleover sample
Returns
status code
  • 0 success
  • 1 set over sample failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 560 of file driver_qmc5883l.c.

◆ qmc5883l_set_period()

uint8_t qmc5883l_set_period ( qmc5883l_handle_t * handle,
uint8_t fbr )

set period

Parameters
[in]*handlepointer to a qmc5883l handle structure
[in]fbrset param
Returns
status code
  • 0 success
  • 1 set period failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 851 of file driver_qmc5883l.c.

◆ qmc5883l_set_pointer_roll_over()

uint8_t qmc5883l_set_pointer_roll_over ( qmc5883l_handle_t * handle,
qmc5883l_bool_t enable )

enable or disable pointer roll over

Parameters
[in]*handlepointer to a qmc5883l handle structure
[in]enablebool value
Returns
status code
  • 0 success
  • 1 set pointer roll over failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 724 of file driver_qmc5883l.c.

◆ qmc5883l_soft_reset()

uint8_t qmc5883l_soft_reset ( qmc5883l_handle_t * handle)

soft reset

Parameters
[in]*handlepointer to a qmc5883l handle structure
Returns
status code
  • 0 success
  • 1 soft reset failed
  • 2 handle is NULL
  • 3 handle is not initialized
Note
none

Definition at line 805 of file driver_qmc5883l.c.