Paparazzi UAS  v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
qmc5883l.h File Reference

QST QMC5883L 3-axis magnetometer driver interface (I2C). More...

#include "std.h"
#include "mcu_periph/i2c.h"
#include "math/pprz_algebra_int.h"
+ Include dependency graph for qmc5883l.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Qmc5883l
 
union  Qmc5883l.data
 

Macros

#define QMC5883L_ADDR0   (0b00001101 << 1)
 The default I2C 7bit address is 0D: 0001101. More...
 
#define QMC5883L_ODR_10   0x00
 
#define QMC5883L_ODR_50   0x04
 
#define QMC5883L_ODR_100   0x08
 
#define QMC5883L_ODR_200   0x0C
 
#define QMC5883L_ODR_DEFAULT   QMC5883L_ODR_200
 

Enumerations

enum  Qmc5883lStatus {
  QMC5883L_CONF_UNINIT , QMC5883L_CONF_CCR_DONE , QMC5883L_CONF_TMRC_DONE , QMC5883L_CONF_CCM_DONE ,
  QMC5883L_STATUS_IDLE , QMC5883L_STATUS_MEAS
}
 

Functions

void qmc5883l_init (struct Qmc5883l *mag, struct i2c_periph *i2c_p, uint8_t addr, uint8_t data_rate)
 
void qmc5883l_configure (struct Qmc5883l *mag)
 
void qmc5883l_event (struct Qmc5883l *mag)
 
void qmc5883l_read (struct Qmc5883l *mag)
 
static void qmc5883l_periodic (struct Qmc5883l *mag)
 convenience function: read or start configuration if not already initialized More...
 

Detailed Description

QST QMC5883L 3-axis magnetometer driver interface (I2C).

Definition in file qmc5883l.h.


Data Structure Documentation

◆ Qmc5883l

struct Qmc5883l

Definition at line 60 of file qmc5883l.h.

+ Collaboration diagram for Qmc5883l:
Data Fields
union Qmc5883l data
volatile bool data_available data ready flag
uint8_t data_rate sensor data rate
struct i2c_periph * i2c_p peripheral used for communcation
struct i2c_transaction i2c_trans i2c transaction
bool initialized config done flag
enum Qmc5883lStatus status init status

◆ Qmc5883l.data

union Qmc5883l.data

Definition at line 67 of file qmc5883l.h.

Data Fields
int32_t value[3] data values accessible by channel index
struct Int32Vect3 vect data vector in mag coordinate system

Macro Definition Documentation

◆ QMC5883L_ADDR0

#define QMC5883L_ADDR0   (0b00001101 << 1)

The default I2C 7bit address is 0D: 0001101.

no option to change the address by e.g. bridging pins of the chip From the official datasheet "If other I2C address options are required, one must contact the chip factory" Just in cse one comes across an custom chip one can extend the ADDR option here

Definition at line 39 of file qmc5883l.h.

◆ QMC5883L_ODR_10

#define QMC5883L_ODR_10   0x00

Definition at line 42 of file qmc5883l.h.

◆ QMC5883L_ODR_100

#define QMC5883L_ODR_100   0x08

Definition at line 44 of file qmc5883l.h.

◆ QMC5883L_ODR_200

#define QMC5883L_ODR_200   0x0C

Definition at line 45 of file qmc5883l.h.

◆ QMC5883L_ODR_50

#define QMC5883L_ODR_50   0x04

Definition at line 43 of file qmc5883l.h.

◆ QMC5883L_ODR_DEFAULT

#define QMC5883L_ODR_DEFAULT   QMC5883L_ODR_200

Definition at line 48 of file qmc5883l.h.

Enumeration Type Documentation

◆ Qmc5883lStatus

Enumerator
QMC5883L_CONF_UNINIT 
QMC5883L_CONF_CCR_DONE 
QMC5883L_CONF_TMRC_DONE 
QMC5883L_CONF_CCM_DONE 
QMC5883L_STATUS_IDLE 
QMC5883L_STATUS_MEAS 

Definition at line 51 of file qmc5883l.h.

Function Documentation

◆ qmc5883l_configure()

◆ qmc5883l_event()

◆ qmc5883l_init()

void qmc5883l_init ( struct Qmc5883l mag,
struct i2c_periph i2c_p,
uint8_t  addr,
uint8_t  data_rate 
)

◆ qmc5883l_periodic()

static void qmc5883l_periodic ( struct Qmc5883l mag)
inlinestatic

convenience function: read or start configuration if not already initialized

Definition at line 79 of file qmc5883l.h.

References Qmc5883l::initialized, qmc5883l_configure(), and qmc5883l_read().

Referenced by mag_qmc5883l_module_periodic().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ qmc5883l_read()

void qmc5883l_read ( struct Qmc5883l mag)