|
Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
Go to the documentation of this file.
31 #define AK8975_MEAS_TIME_MS 9
40 const float H = (float)
val;
42 const float Hadj = corr_factor *
H;
96 ((((
float)(ak->
i2c_trans.
buf[i]) - 128.0f)*0.5f)/128.0f)+1.0f;
128 #define RawFromBuf(_buf,_idx) ((int16_t)(_buf[_idx] | (_buf[_idx+1] << 8)))
130 #define Int16FromRaw(_raw) ( (_raw & 0x1FFF) > 0xFFF ? (_raw & 0x1FFF) - 0x2000 : (_raw & 0x0FFF) )
struct i2c_transaction i2c_trans
i2c transaction used for communication with the ak8936
volatile uint8_t buf[I2C_BUF_LEN]
Transaction buffer With I2C_BUF_LEN number of bytes.
static struct FloatVect3 H
void ak8975_init(struct Ak8975 *ak, struct i2c_periph *i2c_p, uint8_t addr)
void ak8975_event(struct Ak8975 *ak)
@ I2CTransFailed
transaction failed
uint32_t last_meas_time
last measurement time in ms
#define AK8975_REG_ST1_ADDR
static float calibration_values[3]
#define Int16FromRaw(_raw)
@ I2CTransSuccess
transaction successfully finished by I2C driver
#define AK8975_MODE_FUSE_ACCESS
bool i2c_transmit(struct i2c_periph *p, struct i2c_transaction *t, uint8_t s_addr, uint8_t len)
Submit a write only transaction.
@ AK_DISABLE_ACCESS_CALIBRATION
#define AK8975_MODE_POWER_DOWN
void ak8975_read(struct Ak8975 *ak)
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.
#define RawFromBuf(_buf, _idx)
Architecture independent timing functions.
uint32_t get_sys_time_msec(void)
Get the time in milliseconds since startup.
enum I2CTransactionStatus status
Transaction status.
#define AK8975_MODE_SINGLE_MEAS
enum Ak8975ConfStatus init_status
init status
uint8_t slave_addr
Slave address.
static float get_ajusted_value(const int16_t val, const uint8_t axis)
bool initialized
config done flag
#define AK8975_MEAS_TIME_MS
void ak8975_configure(struct Ak8975 *ak)
#define AK8975_REG_CNTL_ADDR
@ I2CTransDone
transaction set to done by user level
enum Ak8975Status status
main status
volatile bool data_available
data ready flag
struct i2c_periph * i2c_p
peripheral used for communcation