Paparazzi UAS  v5.8.2_stable-0-g6260b7c
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
 
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...
 

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_t data_available data ready flag
struct i2c_periph * i2c_p
struct i2c_transaction i2c_trans
enum Hmc58xxConfStatus init_status init status
bool_t initialized config done flag
enum Hmc58xxType type
union Hmc58xx.data

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

Enumerator
HMC_CONF_UNINIT 
HMC_CONF_CRA 
HMC_CONF_CRB 
HMC_CONF_MODE 
HMC_CONF_DONE 

Definition at line 47 of file hmc58xx.h.

Enumerator
HMC_TYPE_5843 
HMC_TYPE_5883 

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.

Parameters
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, FALSE, 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_impl_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)
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_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_periodic().

+ Here is the call graph for this function:

+ Here is the caller graph for this function: