Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
|
Driver for the AKM AK8975 magnetometer. More...
Go to the source code of this file.
Data Structures | |
struct | Ak8975 |
union | Ak8975.data |
Macros | |
#define | AK8975_I2C_SLV_ADDR (0x0C<<1) |
#define | AK8975_REG_ST1_ADDR 0x02 |
#define | AK8975_REG_CNTL_ADDR 0x0A |
#define | AK8975_REG_ASASX 0x10 |
#define | AK8975_MODE_FUSE_ACCESS 0b00001111 |
#define | AK8975_MODE_POWER_DOWN 0b00000000 |
#define | AK8975_MODE_SINGLE_MEAS 0b00000001 |
Enumerations | |
enum | Ak8975ConfStatus { AK_CONF_UNINIT , AK_REQ_CALIBRATION , AK_DISABLE_ACCESS_CALIBRATION , AK_CONF_REQUESTED } |
config status states More... | |
enum | Ak8975Status { AK_STATUS_IDLE , AK_STATUS_MEAS , AK_STATUS_READ , AK_STATUS_DONE } |
Normal status states. More... | |
Functions | |
void | ak8975_init (struct Ak8975 *ak, struct i2c_periph *i2c_p, uint8_t addr) |
void | ak8975_configure (struct Ak8975 *ak) |
void | ak8975_event (struct Ak8975 *ak) |
void | ak8975_read (struct Ak8975 *ak) |
static void | ak8975_periodic (struct Ak8975 *ak) |
convenience function: read or start configuration if not already initialized More... | |
Driver for the AKM AK8975 magnetometer.
Definition in file ak8975.h.
struct Ak8975 |
Data Fields | ||
---|---|---|
union Ak8975 | 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 Ak8975ConfStatus | init_status | init status |
bool | initialized | config done flag |
uint32_t | last_meas_time | last measurement time in ms |
enum Ak8975Status | status | main status |
union Ak8975.data |
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
enum Ak8975ConfStatus |
enum Ak8975Status |
void ak8975_configure | ( | struct Ak8975 * | ak | ) |
Definition at line 63 of file ak8975.c.
References AK8975_MODE_FUSE_ACCESS, AK8975_MODE_POWER_DOWN, AK8975_REG_ASASX, AK8975_REG_CNTL_ADDR, AK_CONF_REQUESTED, AK_CONF_UNINIT, AK_DISABLE_ACCESS_CALIBRATION, AK_REQ_CALIBRATION, i2c_transaction::buf, calibration_values, Ak8975::i2c_p, Ak8975::i2c_trans, i2c_transceive(), i2c_transmit(), I2CTransDone, I2CTransFailed, I2CTransSuccess, Ak8975::init_status, Ak8975::initialized, i2c_transaction::slave_addr, and i2c_transaction::status.
Referenced by ak8975_periodic().
void ak8975_event | ( | struct Ak8975 * | ak | ) |
Definition at line 131 of file ak8975.c.
References AK8975_MEAS_TIME_MS, AK8975_REG_ST1_ADDR, AK_STATUS_IDLE, AK_STATUS_MEAS, AK_STATUS_READ, i2c_transaction::buf, Ak8975::data, Ak8975::data_available, get_sys_time_msec(), Ak8975::i2c_p, Ak8975::i2c_trans, i2c_transceive(), I2CTransDone, I2CTransFailed, I2CTransSuccess, Ak8975::initialized, Int16FromRaw, Ak8975::last_meas_time, RawFromBuf, i2c_transaction::slave_addr, i2c_transaction::status, Ak8975::status, and val.
Referenced by imu_apogee_event().
void ak8975_init | ( | struct Ak8975 * | ak, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Definition at line 47 of file ak8975.c.
References AK_CONF_UNINIT, AK_STATUS_IDLE, Ak8975::data_available, Ak8975::i2c_p, Ak8975::i2c_trans, I2CTransDone, Ak8975::init_status, Ak8975::initialized, i2c_transaction::slave_addr, i2c_transaction::status, and Ak8975::status.
Referenced by imu_apogee_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 83 of file ak8975.h.
References ak8975_configure(), ak8975_read(), and Ak8975::initialized.
Referenced by imu_apogee_periodic().
void ak8975_read | ( | struct Ak8975 * | ak | ) |
Definition at line 113 of file ak8975.c.
References AK8975_MODE_SINGLE_MEAS, AK8975_REG_CNTL_ADDR, AK_STATUS_IDLE, AK_STATUS_MEAS, i2c_transaction::buf, get_sys_time_msec(), Ak8975::i2c_p, Ak8975::i2c_trans, i2c_transmit(), Ak8975::last_meas_time, i2c_transaction::slave_addr, and Ak8975::status.
Referenced by ak8975_periodic().