Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
QST QMC5883L 3-axis magnetometer driver interface (I2C). More...
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... | |
QST QMC5883L 3-axis magnetometer driver interface (I2C).
Definition in file qmc5883l.h.
struct Qmc5883l |
Definition at line 60 of file qmc5883l.h.
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 |
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 |
#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.
#define QMC5883L_ODR_10 0x00 |
Definition at line 42 of file qmc5883l.h.
#define QMC5883L_ODR_100 0x08 |
Definition at line 44 of file qmc5883l.h.
#define QMC5883L_ODR_200 0x0C |
Definition at line 45 of file qmc5883l.h.
#define QMC5883L_ODR_50 0x04 |
Definition at line 43 of file qmc5883l.h.
#define QMC5883L_ODR_DEFAULT QMC5883L_ODR_200 |
Definition at line 48 of file qmc5883l.h.
enum 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.
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().
|
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().
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().