Paparazzi UAS  v6.0_unstable-20-gfdbd467-dirty
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
hmc58xx.h File Reference
#include "std.h"
#include "mcu_periph/i2c.h"
#include "math/pprz_algebra_int.h"
#include "peripherals/hmc58xx_regs.h"
+ Include dependency graph for hmc58xx.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  Hmc58xxConfig
struct  Hmc58xx


enum  Hmc58xxConfStatus {
 config status states More...
enum  Hmc58xxType { HMC_TYPE_5843, HMC_TYPE_5883 }


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...

Data Structure Documentation

struct Hmc58xxConfig

Definition at line 39 of file hmc58xx.h.

Data Fields
uint8_t gain Gain configuration (1 -> +- 1 Gauss)
uint8_t meas Measurement configuration.
uint8_t mode Measurement mode.
uint8_t rate Data Output Rate Bits(6 -> 50Hz with HMC5843, 75Hz with HMC5883)
struct Hmc58xx

Definition at line 60 of file hmc58xx.h.

+ Collaboration diagram for 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

Definition at line 66 of file hmc58xx.h.

Data Fields
int16_t value[3] data values accessible by channel index
struct Int16Vect3 vect data vector in mag coordinate system

Enumeration Type Documentation

config status states


Definition at line 47 of file hmc58xx.h.


Definition at line 55 of file hmc58xx.h.

Function Documentation

void hmc58xx_init ( struct Hmc58xx hmc,
struct i2c_periph i2c_p,
uint8_t  addr 

Initialize Hmc58xx struct and set default config options.

hmcHmc58xx struct
i2c_pI2C periperal to use
addrI2C 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_drotek2_init(), imu_gl1_init(), imu_krooz_init(), imu_mpu_hmc_init(), imu_navstik_init(), imu_ppzuav_init(), imu_px4fmu_init(), and mag_hmc58xx_module_init().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void hmc58xx_periodic ( struct Hmc58xx hmc)

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_gl1_periodic(), imu_mpu_hmc_periodic(), imu_navstik_periodic(), imu_ppzuav_periodic(), imu_px4fmu_periodic(), and mag_hmc58xx_module_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void hmc58xx_read ( struct Hmc58xx hmc)
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().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: