31 #ifndef PIOS_HMC5983_H
32 #define PIOS_HMC5983_H
37 #define PIOS_HMC5983_I2C_ADDR 0x1E
38 #define PIOS_HMC5983_I2C_READ_ADDR 0x3D
39 #define PIOS_HMC5983_I2C_WRITE_ADDR 0x3C
40 #define PIOS_HMC5983_CONFIG_REG_A (uint8_t)0x00
41 #define PIOS_HMC5983_CONFIG_REG_B (uint8_t)0x01
42 #define PIOS_HMC5983_MODE_REG (uint8_t)0x02
43 #define PIOS_HMC5983_DATAOUT_XMSB_REG 0x03
44 #define PIOS_HMC5983_DATAOUT_XLSB_REG 0x04
45 #define PIOS_HMC5983_DATAOUT_ZMSB_REG 0x05
46 #define PIOS_HMC5983_DATAOUT_ZLSB_REG 0x06
47 #define PIOS_HMC5983_DATAOUT_YMSB_REG 0x07
48 #define PIOS_HMC5983_DATAOUT_YLSB_REG 0x08
49 #define PIOS_HMC5983_DATAOUT_STATUS_REG 0x09
50 #define PIOS_HMC5983_DATAOUT_IDA_REG 0x0A
51 #define PIOS_HMC5983_DATAOUT_IDB_REG 0x0B
52 #define PIOS_HMC5983_DATAOUT_IDC_REG 0x0C
53 #define PIOS_HMC5983_DATAOUT_TEMPMSB_REG 0x31
54 #define PIOS_HMC5983_DATAOUT_TEMPLSB_REG 0x32
57 #define PIOS_HMC5983_ODR_0_75 0x00
58 #define PIOS_HMC5983_ODR_1_5 0x04
59 #define PIOS_HMC5983_ODR_3 0x08
60 #define PIOS_HMC5983_ODR_7_5 0x0C
61 #define PIOS_HMC5983_ODR_15 0x10
62 #define PIOS_HMC5983_ODR_30 0x14
63 #define PIOS_HMC5983_ODR_75 0x18
64 #define PIOS_HMC5983_ODR_220 0x1c
67 #define PIOS_HMC5983_MEASCONF_NORMAL 0x00
68 #define PIOS_HMC5983_MEASCONF_BIAS_POS 0x01
69 #define PIOS_HMC5983_MEASCONF_BIAS_NEG 0x02
72 #define PIOS_HMC5983_GAIN_0_88 0x00
73 #define PIOS_HMC5983_GAIN_1_3 0x20
74 #define PIOS_HMC5983_GAIN_1_9 0x40
75 #define PIOS_HMC5983_GAIN_2_5 0x60
76 #define PIOS_HMC5983_GAIN_4_0 0x80
77 #define PIOS_HMC5983_GAIN_4_7 0xA0
78 #define PIOS_HMC5983_GAIN_5_6 0xC0
79 #define PIOS_HMC5983_GAIN_8_1 0xE0
82 #define PIOS_HMC5983_MODE_CONTINUOUS 0x00
83 #define PIOS_HMC5983_MODE_SINGLE 0x01
84 #define PIOS_HMC5983_MODE_IDLE 0x02
85 #define PIOS_HMC5983_MODE_SLEEP 0x03
88 #define PIOS_HMC5983_Sensitivity_0_88Ga 1370 // LSB/Ga
89 #define PIOS_HMC5983_Sensitivity_1_3Ga 1090 // LSB/Ga
90 #define PIOS_HMC5983_Sensitivity_1_9Ga 820 // LSB/Ga
91 #define PIOS_HMC5983_Sensitivity_2_5Ga 660 // LSB/Ga
92 #define PIOS_HMC5983_Sensitivity_4_0Ga 440 // LSB/Ga
93 #define PIOS_HMC5983_Sensitivity_4_7Ga 390 // LSB/Ga
94 #define PIOS_HMC5983_Sensitivity_5_6Ga 330 // LSB/Ga
95 #define PIOS_HMC5983_Sensitivity_8_1Ga 230 // LSB/Ga --> NOT RECOMMENDED
97 #define PIOS_HMC5983_AVERAGING_1 0x00
98 #define PIOS_HMC5983_AVERAGING_2 0x20
99 #define PIOS_HMC5983_AVERAGING_4 0x40
100 #define PIOS_HMC5983_AVERAGING_8 0x60
102 #define PIOS_HMC5983_READ_MODE 0xC0
103 #define PIOS_HMC5983_ENABLE_TEMP_SENSOR 0x80
134 #if defined(PIOS_INCLUDE_HMC5983_I2C)
135 int32_t PIOS_HMC5983_I2C_Init(
pios_i2c_t i2c_id,
137 extern int32_t PIOS_HMC5983_Test(
void);
Main PiOS header to include all the compiled in PiOS options.
static struct flyingpicmd_cfg_fa cfg
enum pios_hmc5983_orientation Orientation
const struct pios_exti_cfg * exti_cfg
struct pios_i2c_adapter * pios_i2c_t
bool PIOS_HMC5983_IRQHandler(void)
int32_t PIOS_HMC5983_Init(pios_spi_t spi_id, uint32_t slave_num, const struct pios_hmc5983_cfg *cfg)