Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ Hmc58xxConfig

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)

◆ Hmc58xx

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

◆ Hmc58xxConfStatus

config status states


Definition at line 47 of file hmc58xx.h.

◆ Hmc58xxType


Definition at line 55 of file hmc58xx.h.

Function Documentation

◆ hmc58xx_event()

◆ hmc58xx_init()

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

◆ hmc58xx_periodic()

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_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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hmc58xx_read()

void hmc58xx_read ( struct Hmc58xx hmc)

◆ hmc58xx_start_configure()

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: