Paparazzi UAS
v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
|
#include "std.h"
#include "mcu_periph/i2c.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/hmc58xx_regs.h"
Go to the source code of this file.
Data Structures | |
struct | Hmc58xxConfig |
struct | Hmc58xx |
union | Hmc58xx.data |
Enumerations | |
enum | Hmc58xxConfStatus { HMC_CONF_UNINIT, HMC_CONF_CRA, HMC_CONF_CRB, HMC_CONF_MODE, HMC_CONF_DONE } |
config status states More... | |
enum | Hmc58xxType { HMC_TYPE_5843, HMC_TYPE_5883 } |
Functions | |
void | hmc58xx_init (struct Hmc58xx *hmc, struct i2c_periph *i2c_p, uint8_t addr) |
Initialize Hmc58xx struct and set default config options. More... | |
void | hmc58xx_start_configure (struct Hmc58xx *hmc) |
void | hmc58xx_read (struct Hmc58xx *hmc) |
void | hmc58xx_event (struct Hmc58xx *hmc) |
static void | hmc58xx_periodic (struct Hmc58xx *hmc) |
convenience function: read or start configuration if not already initialized More... | |
struct Hmc58xxConfig |
struct Hmc58xx |
Data Fields | ||
---|---|---|
uint16_t | adc_overflow_cnt | counts number of ADC measurement under/overflows |
struct Hmc58xxConfig | config | |
union Hmc58xx | data | |
volatile bool | data_available | data ready flag |
struct i2c_periph * | i2c_p | |
struct i2c_transaction | i2c_trans | |
enum Hmc58xxConfStatus | init_status | init status |
bool | initialized | config done flag |
enum Hmc58xxType | type |
union Hmc58xx.data |
Data Fields | ||
---|---|---|
int16_t | value[3] | data values accessible by channel index |
struct Int16Vect3 | vect | data vector in mag coordinate system |
enum Hmc58xxConfStatus |
enum Hmc58xxType |
void hmc58xx_event | ( | struct Hmc58xx * | hmc | ) |
Definition at line 152 of file hmc58xx.c.
References Hmc58xx::adc_overflow_cnt, i2c_transaction::buf, Hmc58xx::data, Hmc58xx::data_available, hmc58xx_send_config(), HMC_CONF_UNINIT, HMC_TYPE_5843, Hmc58xx::i2c_trans, I2CTransDone, I2CTransFailed, I2CTransSuccess, Hmc58xx::init_status, Hmc58xx::initialized, Int16FromBuf, i2c_transaction::status, and Hmc58xx::type.
Referenced by imu_aspirin_event(), imu_aspirin_i2c_event(), imu_drotek2_event(), imu_gl1_event(), imu_hbmini_event(), imu_krooz_event(), imu_mpu_hmc_event(), imu_navgo_event(), imu_navstik_event(), imu_ppzuav_event(), imu_px4fmu_event(), and mag_hmc58xx_module_event().
void hmc58xx_init | ( | struct Hmc58xx * | hmc, |
struct i2c_periph * | i2c_p, | ||
uint8_t | addr | ||
) |
Initialize Hmc58xx struct and set default config options.
hmc | Hmc58xx struct |
i2c_p | I2C periperal to use |
addr | I2C address of HMC58xx |
Definition at line 75 of file hmc58xx.c.
References Hmc58xx::adc_overflow_cnt, Hmc58xx::config, hmc58xx_set_default_config(), HMC_CONF_UNINIT, HMC_TYPE_5883, Hmc58xx::i2c_p, Hmc58xx::i2c_trans, I2CTransDone, Hmc58xx::init_status, Hmc58xx::initialized, i2c_transaction::slave_addr, i2c_transaction::status, and Hmc58xx::type.
Referenced by imu_aspirin_i2c_init(), imu_aspirin_init(), imu_b2_init(), imu_drotek2_init(), imu_gl1_init(), imu_hbmini_init(), imu_krooz_init(), imu_mpu_hmc_init(), imu_navgo_init(), imu_navstik_init(), imu_ppzuav_init(), imu_px4fmu_init(), and mag_hmc58xx_module_init().
|
inlinestatic |
convenience function: read or start configuration if not already initialized
Definition at line 85 of file hmc58xx.h.
References hmc58xx_read(), hmc58xx_start_configure(), and Hmc58xx::initialized.
Referenced by imu_aspirin_i2c_periodic(), imu_aspirin_periodic(), imu_b2_periodic(), imu_gl1_periodic(), imu_hbmini_periodic(), imu_mpu_hmc_periodic(), imu_navgo_periodic(), imu_navstik_periodic(), imu_ppzuav_periodic(), imu_px4fmu_periodic(), and mag_hmc58xx_module_periodic().
void hmc58xx_read | ( | struct Hmc58xx * | hmc | ) |
Definition at line 139 of file hmc58xx.c.
References i2c_transaction::buf, HMC58XX_REG_DATXM, Hmc58xx::i2c_p, i2c_submit(), Hmc58xx::i2c_trans, I2CTransDone, I2CTransTxRx, Hmc58xx::initialized, i2c_transaction::len_r, i2c_transaction::len_w, i2c_transaction::status, and i2c_transaction::type.
Referenced by hmc58xx_periodic(), imu_drotek2_periodic(), and imu_krooz_event().
void hmc58xx_start_configure | ( | struct Hmc58xx * | hmc | ) |
Definition at line 126 of file hmc58xx.c.
References get_sys_time_float(), hmc58xx_send_config(), HMC58XX_STARTUP_DELAY, HMC_CONF_UNINIT, Hmc58xx::i2c_trans, I2CTransDone, I2CTransSuccess, Hmc58xx::init_status, and i2c_transaction::status.
Referenced by hmc58xx_periodic(), imu_drotek2_configure_mag_slave(), and imu_krooz_periodic().