30 #define QMC5883L_REG_DATXL 0x00
31 #define QMC5883L_REG_DATXM 0x01
32 #define QMC5883L_REG_DATYL 0x02
33 #define QMC5883L_REG_DATYM 0x03
34 #define QMC5883L_REG_DATZL 0x04
35 #define QMC5883L_REG_DATZM 0x05
38 #define QMC5883L_REG_STATUS 0x06
41 #define QMC5883L_REG_TEMPM 0x07
42 #define QMC5883L_REG_TEMPL 0x08
45 #define QMC5883L_REG_CONTROL_1 0x09
46 #define QMC5883L_REG_CONTROL_2 0x0A
47 #define QMC5883L_REG_RESET_PERIOD 0x0B
49 #define QMC5883L_REG_IDC 0x0C
50 #define QMC5883L_REG_IDD 0x0D
53 #define QMC5883L_MODE_STBY 0x00
54 #define QMC5883L_MODE_CONT 0x01
57 #define QMC5883L_RNG_2G 0x00
58 #define QMC5883L_RNG_8G 0x10
61 #define QMC5883L_OSR_512 0x00
62 #define QMC5883L_OSR_256 0x40
63 #define QMC5883L_OSR_128 0x80
64 #define QMC5883L_OSR_64 0xC0
151 #define Int16FromBuf(_buf,_idx) ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))
170 if (mag->
data.vect.x >= 4096 || mag->
data.vect.y >= 4096 || mag->
data.vect.z >= 4096) {
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
enum I2CTransactionStatus status
Transaction status.
uint8_t slave_addr
Slave address.
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
bool i2c_transceive(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len_w, uint16_t len_r)
Submit a write/read transaction.
@ I2CTransSuccess
transaction successfully finished by I2C driver
@ I2CTransFailed
transaction failed
@ I2CTransDone
transaction set to done by user level
void qmc5883l_event(struct Qmc5883l *mag)
#define QMC5883L_REG_DATZM
void qmc5883l_read(struct Qmc5883l *mag)
#define QMC5883L_MODE_CONT
#define QMC5883L_REG_CONTROL_1
#define QMC5883L_REG_STATUS
#define QMC5883L_REG_DATZL
#define QMC5883L_REG_DATXM
#define QMC5883L_REG_DATYM
#define QMC5883L_REG_DATXL
#define QMC5883L_REG_DATYL
void qmc5883l_configure(struct Qmc5883l *mag)
#define QMC5883L_REG_RESET_PERIOD
void qmc5883l_init(struct Qmc5883l *mag, struct i2c_periph *i2c_p, uint8_t addr, uint8_t data_rate)
#define Int16FromBuf(_buf, _idx)
QST QMC5883L 3-axis magnetometer driver interface (I2C).
volatile bool data_available
data ready flag
@ QMC5883L_CONF_TMRC_DONE
struct i2c_periph * i2c_p
peripheral used for communcation
enum Qmc5883lStatus status
init status
bool initialized
config done flag
union Qmc5883l::@350 data
struct i2c_transaction i2c_trans
i2c transaction
uint8_t data_rate
sensor data rate
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.