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.
Macros | |
#define | AK8975_MEAS_TIME_MS 9 |
#define | RawFromBuf(_buf, _idx) ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8))) |
#define | Int16FromRaw(_raw) ( (_raw & 0x1FFF) > 0xFFF ? (_raw & 0x1FFF) - 0x2000 : (_raw & 0x0FFF) ) |
Functions | |
static float | get_ajusted_value (const int16_t val, const uint8_t axis) |
void | ak8975_init (struct Ak8975 *ak, struct i2c_periph *i2c_p, uint8_t addr) |
void | ak8975_configure (struct Ak8975 *ak) |
void | ak8975_read (struct Ak8975 *ak) |
void | ak8975_event (struct Ak8975 *ak) |
Variables | |
static float | calibration_values [3] = { 0, 0, 0 } |
Driver for the AKM AK8975 magnetometer.
Definition in file ak8975.c.
#define Int16FromRaw | ( | _raw | ) | ( (_raw & 0x1FFF) > 0xFFF ? (_raw & 0x1FFF) - 0x2000 : (_raw & 0x0FFF) ) |
#define RawFromBuf | ( | _buf, | |
_idx | |||
) | ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8))) |
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().
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().
Definition at line 38 of file ak8975.c.
References calibration_values, H, and val.
|
static |
Definition at line 36 of file ak8975.c.
Referenced by ak8975_configure(), and get_ajusted_value().