Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
QST QMC5883L 3-axis magnetometer driver interface (I2C). More...
#include "peripherals/qmc5883l.h"
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) |
QST QMC5883L 3-axis magnetometer driver interface (I2C).
Definition in file qmc5883l.c.
#define Int16FromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8))) |
Definition at line 151 of file qmc5883l.c.
#define QMC5883L_MODE_CONT 0x01 |
Definition at line 54 of file qmc5883l.c.
#define QMC5883L_MODE_STBY 0x00 |
Definition at line 53 of file qmc5883l.c.
#define QMC5883L_OSR_128 0x80 |
Definition at line 63 of file qmc5883l.c.
#define QMC5883L_OSR_256 0x40 |
Definition at line 62 of file qmc5883l.c.
#define QMC5883L_OSR_512 0x00 /* Use 512 if powerusage of chip is not an issue */ |
Definition at line 61 of file qmc5883l.c.
#define QMC5883L_OSR_64 0xC0 |
Definition at line 64 of file qmc5883l.c.
#define QMC5883L_REG_CONTROL_1 0x09 /* settings for MODE */ |
Definition at line 45 of file qmc5883l.c.
#define QMC5883L_REG_CONTROL_2 0x0A /* settings for INT_ENB */ |
Definition at line 46 of file qmc5883l.c.
#define QMC5883L_REG_DATXL 0x00 |
Definition at line 30 of file qmc5883l.c.
#define QMC5883L_REG_DATXM 0x01 |
Definition at line 31 of file qmc5883l.c.
#define QMC5883L_REG_DATYL 0x02 |
Definition at line 32 of file qmc5883l.c.
#define QMC5883L_REG_DATYM 0x03 |
Definition at line 33 of file qmc5883l.c.
#define QMC5883L_REG_DATZL 0x04 |
Definition at line 34 of file qmc5883l.c.
#define QMC5883L_REG_DATZM 0x05 |
Definition at line 35 of file qmc5883l.c.
#define QMC5883L_REG_IDC 0x0C /* OEM reserved */ |
Definition at line 49 of file qmc5883l.c.
#define QMC5883L_REG_IDD 0x0D /* OEM reserved */ |
Definition at line 50 of file qmc5883l.c.
#define QMC5883L_REG_RESET_PERIOD 0x0B |
Definition at line 47 of file qmc5883l.c.
#define QMC5883L_REG_STATUS 0x06 |
Definition at line 38 of file qmc5883l.c.
#define QMC5883L_REG_TEMPL 0x08 |
Definition at line 42 of file qmc5883l.c.
#define QMC5883L_REG_TEMPM 0x07 |
Definition at line 41 of file qmc5883l.c.
#define QMC5883L_RNG_2G 0x00 |
Definition at line 57 of file qmc5883l.c.
#define QMC5883L_RNG_8G 0x10 |
Definition at line 58 of file qmc5883l.c.
void qmc5883l_configure | ( | struct Qmc5883l * | mag | ) |
Definition at line 80 of file qmc5883l.c.
References i2c_transaction::buf, Qmc5883l::i2c_p, Qmc5883l::i2c_trans, i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, Qmc5883l::initialized, QMC5883L_CONF_CCM_DONE, QMC5883L_CONF_CCR_DONE, QMC5883L_CONF_TMRC_DONE, QMC5883L_CONF_UNINIT, QMC5883L_MODE_CONT, QMC5883L_ODR_200, QMC5883L_OSR_512, QMC5883L_REG_CONTROL_1, QMC5883L_REG_RESET_PERIOD, QMC5883L_RNG_8G, QMC5883L_STATUS_IDLE, i2c_transaction::slave_addr, i2c_transaction::status, and Qmc5883l::status.
Referenced by qmc5883l_periodic().
void qmc5883l_event | ( | struct Qmc5883l * | mag | ) |
Definition at line 154 of file qmc5883l.c.
References i2c_transaction::buf, Qmc5883l::data, Qmc5883l::data_available, Qmc5883l::i2c_trans, I2CTransDone, I2CTransFailed, I2CTransSuccess, Qmc5883l::initialized, Int16FromBuf, QMC5883L_STATUS_IDLE, QMC5883L_STATUS_MEAS, i2c_transaction::status, and Qmc5883l::status.
Referenced by mag_qmc5883l_module_event().
void qmc5883l_init | ( | struct Qmc5883l * | mag, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr, | ||
uint8_t | data_rate | ||
) |
Definition at line 66 of file qmc5883l.c.
References Qmc5883l::data_available, Qmc5883l::data_rate, Qmc5883l::i2c_p, Qmc5883l::i2c_trans, I2CTransDone, Qmc5883l::initialized, QMC5883L_CONF_UNINIT, i2c_transaction::slave_addr, i2c_transaction::status, and Qmc5883l::status.
Referenced by mag_qmc5883l_module_init().
void qmc5883l_read | ( | struct Qmc5883l * | mag | ) |
Definition at line 126 of file qmc5883l.c.
References i2c_transaction::buf, Qmc5883l::i2c_p, Qmc5883l::i2c_trans, i2c_transceive(), QMC5883L_REG_DATXL, QMC5883L_REG_DATXM, QMC5883L_REG_DATYL, QMC5883L_REG_DATYM, QMC5883L_REG_DATZL, QMC5883L_REG_DATZM, QMC5883L_REG_STATUS, QMC5883L_STATUS_IDLE, QMC5883L_STATUS_MEAS, i2c_transaction::slave_addr, and Qmc5883l::status.
Referenced by qmc5883l_periodic().