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_hmc5983.c
 HMC5983 Magnetic Sensor Functions from AHRS.
 
file  pios_hmc5983_i2c.c
 HMC5983 Magnetic Sensor Functions from AHRS.
 
file  pios_hmc5983.h
 HMC5983 functions header.
 

Data Structures

struct  pios_hmc5983_cfg
 

Macros

#define PIOS_HMC5983_I2C_ADDR   0x1E
 
#define PIOS_HMC5983_I2C_READ_ADDR   0x3D
 
#define PIOS_HMC5983_I2C_WRITE_ADDR   0x3C
 
#define PIOS_HMC5983_CONFIG_REG_A   (uint8_t)0x00
 
#define PIOS_HMC5983_CONFIG_REG_B   (uint8_t)0x01
 
#define PIOS_HMC5983_MODE_REG   (uint8_t)0x02
 
#define PIOS_HMC5983_DATAOUT_XMSB_REG   0x03
 
#define PIOS_HMC5983_DATAOUT_XLSB_REG   0x04
 
#define PIOS_HMC5983_DATAOUT_ZMSB_REG   0x05
 
#define PIOS_HMC5983_DATAOUT_ZLSB_REG   0x06
 
#define PIOS_HMC5983_DATAOUT_YMSB_REG   0x07
 
#define PIOS_HMC5983_DATAOUT_YLSB_REG   0x08
 
#define PIOS_HMC5983_DATAOUT_STATUS_REG   0x09
 
#define PIOS_HMC5983_DATAOUT_IDA_REG   0x0A
 
#define PIOS_HMC5983_DATAOUT_IDB_REG   0x0B
 
#define PIOS_HMC5983_DATAOUT_IDC_REG   0x0C
 
#define PIOS_HMC5983_DATAOUT_TEMPMSB_REG   0x31
 
#define PIOS_HMC5983_DATAOUT_TEMPLSB_REG   0x32
 
#define PIOS_HMC5983_ODR_0_75   0x00
 
#define PIOS_HMC5983_ODR_1_5   0x04
 
#define PIOS_HMC5983_ODR_3   0x08
 
#define PIOS_HMC5983_ODR_7_5   0x0C
 
#define PIOS_HMC5983_ODR_15   0x10
 
#define PIOS_HMC5983_ODR_30   0x14
 
#define PIOS_HMC5983_ODR_75   0x18
 
#define PIOS_HMC5983_ODR_220   0x1c
 
#define PIOS_HMC5983_MEASCONF_NORMAL   0x00
 
#define PIOS_HMC5983_MEASCONF_BIAS_POS   0x01
 
#define PIOS_HMC5983_MEASCONF_BIAS_NEG   0x02
 
#define PIOS_HMC5983_GAIN_0_88   0x00
 
#define PIOS_HMC5983_GAIN_1_3   0x20
 
#define PIOS_HMC5983_GAIN_1_9   0x40
 
#define PIOS_HMC5983_GAIN_2_5   0x60
 
#define PIOS_HMC5983_GAIN_4_0   0x80
 
#define PIOS_HMC5983_GAIN_4_7   0xA0
 
#define PIOS_HMC5983_GAIN_5_6   0xC0
 
#define PIOS_HMC5983_GAIN_8_1   0xE0
 
#define PIOS_HMC5983_MODE_CONTINUOUS   0x00
 
#define PIOS_HMC5983_MODE_SINGLE   0x01
 
#define PIOS_HMC5983_MODE_IDLE   0x02
 
#define PIOS_HMC5983_MODE_SLEEP   0x03
 
#define PIOS_HMC5983_Sensitivity_0_88Ga   1370
 
#define PIOS_HMC5983_Sensitivity_1_3Ga   1090
 
#define PIOS_HMC5983_Sensitivity_1_9Ga   820
 
#define PIOS_HMC5983_Sensitivity_2_5Ga   660
 
#define PIOS_HMC5983_Sensitivity_4_0Ga   440
 
#define PIOS_HMC5983_Sensitivity_4_7Ga   390
 
#define PIOS_HMC5983_Sensitivity_5_6Ga   330
 
#define PIOS_HMC5983_Sensitivity_8_1Ga   230
 
#define PIOS_HMC5983_AVERAGING_1   0x00
 
#define PIOS_HMC5983_AVERAGING_2   0x20
 
#define PIOS_HMC5983_AVERAGING_4   0x40
 
#define PIOS_HMC5983_AVERAGING_8   0x60
 
#define PIOS_HMC5983_READ_MODE   0xC0
 
#define PIOS_HMC5983_ENABLE_TEMP_SENSOR   0x80
 

Enumerations

enum  pios_hmc5983_orientation {
  PIOS_HMC5983_TOP_0DEG, PIOS_HMC5983_TOP_90DEG, PIOS_HMC5983_TOP_180DEG, PIOS_HMC5983_TOP_270DEG,
  PIOS_HMC5983_BOTTOM_0DEG, PIOS_HMC5983_BOTTOM_90DEG, PIOS_HMC5983_BOTTOM_180DEG, PIOS_HMC5983_BOTTOM_270DEG
}
 

Functions

int32_t PIOS_HMC5983_Init (pios_spi_t spi_id, uint32_t slave_num, const struct pios_hmc5983_cfg *cfg)
 
bool PIOS_HMC5983_IRQHandler (void)
 

Detailed Description

Deals with the hardware interface to the magnetometers.

Macro Definition Documentation

#define PIOS_HMC5983_AVERAGING_1   0x00

Definition at line 97 of file pios_hmc5983.h.

#define PIOS_HMC5983_AVERAGING_2   0x20

Definition at line 98 of file pios_hmc5983.h.

#define PIOS_HMC5983_AVERAGING_4   0x40

Definition at line 99 of file pios_hmc5983.h.

#define PIOS_HMC5983_AVERAGING_8   0x60

Definition at line 100 of file pios_hmc5983.h.

#define PIOS_HMC5983_CONFIG_REG_A   (uint8_t)0x00

Definition at line 40 of file pios_hmc5983.h.

#define PIOS_HMC5983_CONFIG_REG_B   (uint8_t)0x01

Definition at line 41 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_IDA_REG   0x0A

Definition at line 50 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_IDB_REG   0x0B

Definition at line 51 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_IDC_REG   0x0C

Definition at line 52 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_STATUS_REG   0x09

Definition at line 49 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_TEMPLSB_REG   0x32

Definition at line 54 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_TEMPMSB_REG   0x31

Definition at line 53 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_XLSB_REG   0x04

Definition at line 44 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_XMSB_REG   0x03

Definition at line 43 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_YLSB_REG   0x08

Definition at line 48 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_YMSB_REG   0x07

Definition at line 47 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_ZLSB_REG   0x06

Definition at line 46 of file pios_hmc5983.h.

#define PIOS_HMC5983_DATAOUT_ZMSB_REG   0x05

Definition at line 45 of file pios_hmc5983.h.

#define PIOS_HMC5983_ENABLE_TEMP_SENSOR   0x80

Definition at line 103 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_0_88   0x00

Definition at line 72 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_1_3   0x20

Definition at line 73 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_1_9   0x40

Definition at line 74 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_2_5   0x60

Definition at line 75 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_4_0   0x80

Definition at line 76 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_4_7   0xA0

Definition at line 77 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_5_6   0xC0

Definition at line 78 of file pios_hmc5983.h.

#define PIOS_HMC5983_GAIN_8_1   0xE0

Definition at line 79 of file pios_hmc5983.h.

#define PIOS_HMC5983_I2C_ADDR   0x1E

Definition at line 37 of file pios_hmc5983.h.

#define PIOS_HMC5983_I2C_READ_ADDR   0x3D

Definition at line 38 of file pios_hmc5983.h.

#define PIOS_HMC5983_I2C_WRITE_ADDR   0x3C

Definition at line 39 of file pios_hmc5983.h.

#define PIOS_HMC5983_MEASCONF_BIAS_NEG   0x02

Definition at line 69 of file pios_hmc5983.h.

#define PIOS_HMC5983_MEASCONF_BIAS_POS   0x01

Definition at line 68 of file pios_hmc5983.h.

#define PIOS_HMC5983_MEASCONF_NORMAL   0x00

Definition at line 67 of file pios_hmc5983.h.

#define PIOS_HMC5983_MODE_CONTINUOUS   0x00

Definition at line 82 of file pios_hmc5983.h.

#define PIOS_HMC5983_MODE_IDLE   0x02

Definition at line 84 of file pios_hmc5983.h.

#define PIOS_HMC5983_MODE_REG   (uint8_t)0x02

Definition at line 42 of file pios_hmc5983.h.

#define PIOS_HMC5983_MODE_SINGLE   0x01

Definition at line 83 of file pios_hmc5983.h.

#define PIOS_HMC5983_MODE_SLEEP   0x03

Definition at line 85 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_0_75   0x00

Definition at line 57 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_15   0x10

Definition at line 61 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_1_5   0x04

Definition at line 58 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_220   0x1c

Definition at line 64 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_3   0x08

Definition at line 59 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_30   0x14

Definition at line 62 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_75   0x18

Definition at line 63 of file pios_hmc5983.h.

#define PIOS_HMC5983_ODR_7_5   0x0C

Definition at line 60 of file pios_hmc5983.h.

#define PIOS_HMC5983_READ_MODE   0xC0

Definition at line 102 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_0_88Ga   1370

Definition at line 88 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_1_3Ga   1090

Definition at line 89 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_1_9Ga   820

Definition at line 90 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_2_5Ga   660

Definition at line 91 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_4_0Ga   440

Definition at line 92 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_4_7Ga   390

Definition at line 93 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_5_6Ga   330

Definition at line 94 of file pios_hmc5983.h.

#define PIOS_HMC5983_Sensitivity_8_1Ga   230

Definition at line 95 of file pios_hmc5983.h.

Enumeration Type Documentation

Enumerator
PIOS_HMC5983_TOP_0DEG 
PIOS_HMC5983_TOP_90DEG 
PIOS_HMC5983_TOP_180DEG 
PIOS_HMC5983_TOP_270DEG 
PIOS_HMC5983_BOTTOM_0DEG 
PIOS_HMC5983_BOTTOM_90DEG 
PIOS_HMC5983_BOTTOM_180DEG 
PIOS_HMC5983_BOTTOM_270DEG 

Definition at line 105 of file pios_hmc5983.h.

Function Documentation

int32_t PIOS_HMC5983_Init ( pios_spi_t  spi_id,
uint32_t  slave_num,
const struct pios_hmc5983_cfg cfg 
)
bool PIOS_HMC5983_IRQHandler ( void  )