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

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

+ Include dependency graph for qmc5883l.c:

Go to the source code of this file.

Macros

#define QMC5883L_REG_DATXL   0x00
 
#define QMC5883L_REG_DATXM   0x01
 
#define QMC5883L_REG_DATYL   0x02
 
#define QMC5883L_REG_DATYM   0x03
 
#define QMC5883L_REG_DATZL   0x04
 
#define QMC5883L_REG_DATZM   0x05
 
#define QMC5883L_REG_STATUS   0x06
 
#define QMC5883L_REG_TEMPM   0x07
 
#define QMC5883L_REG_TEMPL   0x08
 
#define QMC5883L_REG_CONTROL_1   0x09 /* settings for MODE */
 
#define QMC5883L_REG_CONTROL_2   0x0A /* settings for INT_ENB */
 
#define QMC5883L_REG_RESET_PERIOD   0x0B
 
#define QMC5883L_REG_IDC   0x0C /* OEM reserved */
 
#define QMC5883L_REG_IDD   0x0D /* OEM reserved */
 
#define QMC5883L_MODE_STBY   0x00
 
#define QMC5883L_MODE_CONT   0x01
 
#define QMC5883L_RNG_2G   0x00
 
#define QMC5883L_RNG_8G   0x10
 
#define QMC5883L_OSR_512   0x00 /* Use 512 if powerusage of chip is not an issue */
 
#define QMC5883L_OSR_256   0x40
 
#define QMC5883L_OSR_128   0x80
 
#define QMC5883L_OSR_64   0xC0
 
#define Int16FromBuf(_buf, _idx)   ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))
 

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_read (struct Qmc5883l *mag)
 
void qmc5883l_event (struct Qmc5883l *mag)
 

Detailed Description

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

Definition in file qmc5883l.c.

Macro Definition Documentation

◆ Int16FromBuf

#define Int16FromBuf (   _buf,
  _idx 
)    ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))

Definition at line 151 of file qmc5883l.c.

◆ QMC5883L_MODE_CONT

#define QMC5883L_MODE_CONT   0x01

Definition at line 54 of file qmc5883l.c.

◆ QMC5883L_MODE_STBY

#define QMC5883L_MODE_STBY   0x00

Definition at line 53 of file qmc5883l.c.

◆ QMC5883L_OSR_128

#define QMC5883L_OSR_128   0x80

Definition at line 63 of file qmc5883l.c.

◆ QMC5883L_OSR_256

#define QMC5883L_OSR_256   0x40

Definition at line 62 of file qmc5883l.c.

◆ QMC5883L_OSR_512

#define QMC5883L_OSR_512   0x00 /* Use 512 if powerusage of chip is not an issue */

Definition at line 61 of file qmc5883l.c.

◆ QMC5883L_OSR_64

#define QMC5883L_OSR_64   0xC0

Definition at line 64 of file qmc5883l.c.

◆ QMC5883L_REG_CONTROL_1

#define QMC5883L_REG_CONTROL_1   0x09 /* settings for MODE */

Definition at line 45 of file qmc5883l.c.

◆ QMC5883L_REG_CONTROL_2

#define QMC5883L_REG_CONTROL_2   0x0A /* settings for INT_ENB */

Definition at line 46 of file qmc5883l.c.

◆ QMC5883L_REG_DATXL

#define QMC5883L_REG_DATXL   0x00

Definition at line 30 of file qmc5883l.c.

◆ QMC5883L_REG_DATXM

#define QMC5883L_REG_DATXM   0x01

Definition at line 31 of file qmc5883l.c.

◆ QMC5883L_REG_DATYL

#define QMC5883L_REG_DATYL   0x02

Definition at line 32 of file qmc5883l.c.

◆ QMC5883L_REG_DATYM

#define QMC5883L_REG_DATYM   0x03

Definition at line 33 of file qmc5883l.c.

◆ QMC5883L_REG_DATZL

#define QMC5883L_REG_DATZL   0x04

Definition at line 34 of file qmc5883l.c.

◆ QMC5883L_REG_DATZM

#define QMC5883L_REG_DATZM   0x05

Definition at line 35 of file qmc5883l.c.

◆ QMC5883L_REG_IDC

#define QMC5883L_REG_IDC   0x0C /* OEM reserved */

Definition at line 49 of file qmc5883l.c.

◆ QMC5883L_REG_IDD

#define QMC5883L_REG_IDD   0x0D /* OEM reserved */

Definition at line 50 of file qmc5883l.c.

◆ QMC5883L_REG_RESET_PERIOD

#define QMC5883L_REG_RESET_PERIOD   0x0B

Definition at line 47 of file qmc5883l.c.

◆ QMC5883L_REG_STATUS

#define QMC5883L_REG_STATUS   0x06

Definition at line 38 of file qmc5883l.c.

◆ QMC5883L_REG_TEMPL

#define QMC5883L_REG_TEMPL   0x08

Definition at line 42 of file qmc5883l.c.

◆ QMC5883L_REG_TEMPM

#define QMC5883L_REG_TEMPM   0x07

Definition at line 41 of file qmc5883l.c.

◆ QMC5883L_RNG_2G

#define QMC5883L_RNG_2G   0x00

Definition at line 57 of file qmc5883l.c.

◆ QMC5883L_RNG_8G

#define QMC5883L_RNG_8G   0x10

Definition at line 58 of file qmc5883l.c.

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_read()

void qmc5883l_read ( struct Qmc5883l mag)