dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages

Deals with the hardware interface to the magnetometers. More...

Files

file  pios_hmc5883.c
 HMC5883 Magnetic Sensor Functions from AHRS.
 

Data Structures

struct  pios_hmc5883_cfg
 
struct  pios_hmc5883_data
 

Macros

#define PIOS_HMC5883_I2C_ADDR   0x1E
 
#define PIOS_HMC5883_I2C_READ_ADDR   0x3D
 
#define PIOS_HMC5883_I2C_WRITE_ADDR   0x3C
 
#define PIOS_HMC5883_CONFIG_REG_A   (uint8_t)0x00
 
#define PIOS_HMC5883_CONFIG_REG_B   (uint8_t)0x01
 
#define PIOS_HMC5883_MODE_REG   (uint8_t)0x02
 
#define PIOS_HMC5883_DATAOUT_XMSB_REG   0x03
 
#define PIOS_HMC5883_DATAOUT_XLSB_REG   0x04
 
#define PIOS_HMC5883_DATAOUT_ZMSB_REG   0x05
 
#define PIOS_HMC5883_DATAOUT_ZLSB_REG   0x06
 
#define PIOS_HMC5883_DATAOUT_YMSB_REG   0x07
 
#define PIOS_HMC5883_DATAOUT_YLSB_REG   0x08
 
#define PIOS_HMC5883_DATAOUT_STATUS_REG   0x09
 
#define PIOS_HMC5883_DATAOUT_IDA_REG   0x0A
 
#define PIOS_HMC5883_DATAOUT_IDB_REG   0x0B
 
#define PIOS_HMC5883_DATAOUT_IDC_REG   0x0C
 
#define PIOS_HMC5883_ODR_0_75   0x00
 
#define PIOS_HMC5883_ODR_1_5   0x04
 
#define PIOS_HMC5883_ODR_3   0x08
 
#define PIOS_HMC5883_ODR_7_5   0x0C
 
#define PIOS_HMC5883_ODR_15   0x10
 
#define PIOS_HMC5883_ODR_30   0x14
 
#define PIOS_HMC5883_ODR_75   0x18
 
#define PIOS_HMC5883_MEASCONF_NORMAL   0x00
 
#define PIOS_HMC5883_MEASCONF_BIAS_POS   0x01
 
#define PIOS_HMC5883_MEASCONF_BIAS_NEG   0x02
 
#define PIOS_HMC5883_GAIN_0_88   0x00
 
#define PIOS_HMC5883_GAIN_1_3   0x20
 
#define PIOS_HMC5883_GAIN_1_9   0x40
 
#define PIOS_HMC5883_GAIN_2_5   0x60
 
#define PIOS_HMC5883_GAIN_4_0   0x80
 
#define PIOS_HMC5883_GAIN_4_7   0xA0
 
#define PIOS_HMC5883_GAIN_5_6   0xC0
 
#define PIOS_HMC5883_GAIN_8_1   0xE0
 
#define PIOS_HMC5883_MODE_CONTINUOUS   0x00
 
#define PIOS_HMC5883_MODE_SINGLE   0x01
 
#define PIOS_HMC5883_MODE_IDLE   0x02
 
#define PIOS_HMC5883_MODE_SLEEP   0x03
 

Enumerations

enum  pios_hmc5883_sensitivity {
  PIOS_HMC5883_Sensitivity_0_88Ga = 1370, PIOS_HMC5883_Sensitivity_1_3Ga = 1090, PIOS_HMC5883_Sensitivity_1_9Ga = 820, PIOS_HMC5883_Sensitivity_2_5Ga = 660,
  PIOS_HMC5883_Sensitivity_4_0Ga = 440, PIOS_HMC5883_Sensitivity_4_7Ga = 390, PIOS_HMC5883_Sensitivity_5_6Ga = 330, PIOS_HMC5883_Sensitivity_8_1Ga = 230
}
 
enum  pios_hmc5883_orientation {
  PIOS_HMC5883_TOP_0DEG, PIOS_HMC5883_TOP_90DEG, PIOS_HMC5883_TOP_180DEG, PIOS_HMC5883_TOP_270DEG,
  PIOS_HMC5883_BOTTOM_0DEG, PIOS_HMC5883_BOTTOM_90DEG, PIOS_HMC5883_BOTTOM_180DEG, PIOS_HMC5883_BOTTOM_270DEG
}
 

Functions

int32_t PIOS_HMC5883_Init (pios_i2c_t i2c_id, const struct pios_hmc5883_cfg *cfg)
 
int32_t PIOS_HMC5883_Test (void)
 
int32_t PIOS_HMC5883_SetOrientation (enum pios_hmc5883_orientation orientation)
 
bool PIOS_HMC5883_IRQHandler ()
 

Detailed Description

Deals with the hardware interface to the magnetometers.

Macro Definition Documentation

#define PIOS_HMC5883_CONFIG_REG_A   (uint8_t)0x00

Definition at line 41 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_CONFIG_REG_B   (uint8_t)0x01

Definition at line 42 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_IDA_REG   0x0A

Definition at line 51 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_IDB_REG   0x0B

Definition at line 52 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_IDC_REG   0x0C

Definition at line 53 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_STATUS_REG   0x09

Definition at line 50 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_XLSB_REG   0x04

Definition at line 45 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_XMSB_REG   0x03

Definition at line 44 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_YLSB_REG   0x08

Definition at line 49 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_YMSB_REG   0x07

Definition at line 48 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_ZLSB_REG   0x06

Definition at line 47 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_DATAOUT_ZMSB_REG   0x05

Definition at line 46 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_0_88   0x00

Definition at line 70 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_1_3   0x20

Definition at line 71 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_1_9   0x40

Definition at line 72 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_2_5   0x60

Definition at line 73 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_4_0   0x80

Definition at line 74 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_4_7   0xA0

Definition at line 75 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_5_6   0xC0

Definition at line 76 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_GAIN_8_1   0xE0

Definition at line 77 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_I2C_ADDR   0x1E

Definition at line 38 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_I2C_READ_ADDR   0x3D

Definition at line 39 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_I2C_WRITE_ADDR   0x3C

Definition at line 40 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MEASCONF_BIAS_NEG   0x02

Definition at line 67 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MEASCONF_BIAS_POS   0x01

Definition at line 66 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MEASCONF_NORMAL   0x00

Definition at line 65 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MODE_CONTINUOUS   0x00

Definition at line 80 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MODE_IDLE   0x02

Definition at line 82 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MODE_REG   (uint8_t)0x02

Definition at line 43 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MODE_SINGLE   0x01

Definition at line 81 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_MODE_SLEEP   0x03

Definition at line 83 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_0_75   0x00

Definition at line 56 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_15   0x10

Definition at line 60 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_1_5   0x04

Definition at line 57 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_3   0x08

Definition at line 58 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_30   0x14

Definition at line 61 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_75   0x18

Definition at line 62 of file pios_hmc5883_priv.h.

#define PIOS_HMC5883_ODR_7_5   0x0C

Definition at line 59 of file pios_hmc5883_priv.h.

Enumeration Type Documentation

Enumerator
PIOS_HMC5883_TOP_0DEG 
PIOS_HMC5883_TOP_90DEG 
PIOS_HMC5883_TOP_180DEG 
PIOS_HMC5883_TOP_270DEG 
PIOS_HMC5883_BOTTOM_0DEG 
PIOS_HMC5883_BOTTOM_90DEG 
PIOS_HMC5883_BOTTOM_180DEG 
PIOS_HMC5883_BOTTOM_270DEG 

Definition at line 97 of file pios_hmc5883_priv.h.

Enumerator
PIOS_HMC5883_Sensitivity_0_88Ga 
PIOS_HMC5883_Sensitivity_1_3Ga 
PIOS_HMC5883_Sensitivity_1_9Ga 
PIOS_HMC5883_Sensitivity_2_5Ga 
PIOS_HMC5883_Sensitivity_4_0Ga 
PIOS_HMC5883_Sensitivity_4_7Ga 
PIOS_HMC5883_Sensitivity_5_6Ga 
PIOS_HMC5883_Sensitivity_8_1Ga 

Definition at line 86 of file pios_hmc5883_priv.h.

Function Documentation

int32_t PIOS_HMC5883_Init ( pios_i2c_t  i2c_id,
const struct pios_hmc5883_cfg cfg 
)
bool PIOS_HMC5883_IRQHandler ( )
int32_t PIOS_HMC5883_SetOrientation ( enum pios_hmc5883_orientation  orientation)
int32_t PIOS_HMC5883_Test ( void  )