Paparazzi UAS
v5.10_stable-5-g83a0da5-dirty
Paparazzi is a free software Unmanned Aircraft System.
|
Register and address definitions for AK8963 magnetometer. More...
#include "std.h"
#include "mcu_periph/i2c.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/ak8963_regs.h"
Go to the source code of this file.
Data Structures | |
struct | Ak8963 |
Default Ak8963 structure. More... | |
union | Ak8963.data |
Enumerations | |
enum | Ak8963ConfStatus { AK_CONF_UNINIT, AK_CONF_MODE, AK_CONF_DONE } |
Config status states. More... | |
enum | Ak8963Status { AK_STATUS_IDLE, AK_STATUS_READ, AK_STATUS_DONE } |
Normal status states. More... | |
Functions | |
void | ak8963_init (struct Ak8963 *ak, struct i2c_periph *i2c_p, uint8_t addr) |
Initialize AK8963 struct. More... | |
void | ak8963_configure (struct Ak8963 *ak) |
void | ak8963_event (struct Ak8963 *ak) |
void | ak8963_read (struct Ak8963 *ak) |
static void | ak8963_periodic (struct Ak8963 *ak) |
convenience function: read or start configuration if not already initialized More... | |
Register and address definitions for AK8963 magnetometer.
Definition in file ak8963.h.
struct Ak8963 |
Data Fields | ||
---|---|---|
union Ak8963 | data | |
volatile bool | data_available | data ready flag |
struct i2c_periph * | i2c_p | peripheral used for communcation |
struct i2c_transaction | i2c_trans | i2c transaction used for communication with the ak8936 |
enum Ak8963ConfStatus | init_status | init status |
bool | initialized | config done flag |
enum Ak8963Status | status | main status |
union Ak8963.data |
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
enum Ak8963ConfStatus |
enum Ak8963Status |
void ak8963_configure | ( | struct Ak8963 * | ak | ) |
Definition at line 46 of file ak8963.c.
References AK8963_CNTL1_CM_2, AK8963_REG_CNTL1, AK8963_REG_CNTL2, AK_CONF_MODE, AK_CONF_UNINIT, i2c_transaction::buf, Ak8963::i2c_p, Ak8963::i2c_trans, i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, Ak8963::init_status, Ak8963::initialized, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by ak8963_periodic(), and imu_mpu9250_configure_mag_slave().
void ak8963_event | ( | struct Ak8963 * | ak | ) |
Definition at line 95 of file ak8963.c.
References AK8963_REG_HXL, AK8963_REG_ST2, AK_STATUS_IDLE, AK_STATUS_READ, i2c_transaction::buf, Ak8963::data, Ak8963::data_available, Ak8963::i2c_p, Ak8963::i2c_trans, i2c_transceive(), I2CTransDone, I2CTransFailed, I2CTransSuccess, Ak8963::initialized, Int16FromBuf, i2c_transaction::slave_addr, Ak8963::status, and i2c_transaction::status.
Referenced by imu_bebop_event(), and mpu9250_i2c_event().
void ak8963_init | ( | struct Ak8963 * | ak, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Initialize AK8963 struct.
Definition at line 34 of file ak8963.c.
References AK_CONF_UNINIT, Ak8963::data_available, Ak8963::i2c_p, Ak8963::i2c_trans, I2CTransDone, Ak8963::init_status, Ak8963::initialized, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by imu_bebop_init(), and mpu9250_i2c_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 75 of file ak8963.h.
References ak8963_configure(), ak8963_read(), and Ak8963::initialized.
Referenced by imu_bebop_periodic().
void ak8963_read | ( | struct Ak8963 * | ak | ) |
Definition at line 83 of file ak8963.c.
References AK8963_REG_ST1, AK_STATUS_IDLE, i2c_transaction::buf, Ak8963::i2c_p, Ak8963::i2c_trans, i2c_transceive(), i2c_transaction::slave_addr, and Ak8963::status.
Referenced by ak8963_periodic(), and mpu9250_i2c_read().