Macros | Functions | Variables
drv_hmc5883l.c File Reference
#include <breezystm32.h>
#include <math.h>
Include dependency graph for drv_hmc5883l.c:

Go to the source code of this file.

Macros

#define HMC58X3_ADDR   0x1E
 
#define HMC58X3_CRA   0x00
 
#define HMC58X3_CRA_AVG_2_MEAS   0x20
 
#define HMC58X3_CRA_AVG_4_MEAS   0x40
 
#define HMC58X3_CRA_AVG_8_MEAS   0x60
 
#define HMC58X3_CRA_DO_0_75   0x00
 
#define HMC58X3_CRA_DO_15   0x10
 
#define HMC58X3_CRA_DO_1_5   0x04
 
#define HMC58X3_CRA_DO_3   0x08
 
#define HMC58X3_CRA_DO_30   0x14
 
#define HMC58X3_CRA_DO_75   0x18
 
#define HMC58X3_CRA_DO_7_5   0x0C
 
#define HMC58X3_CRA_MEAS_MODE_NEG_BIAS   0x02
 
#define HMC58X3_CRA_MEAS_MODE_NORMAL   0x00
 
#define HMC58X3_CRA_MEAS_MODE_POS_BIAS   0x01
 
#define HMC58X3_CRA_NO_AVG   0x00
 
#define HMC58X3_CRB   0x01
 
#define HMC58X3_CRB_GN_1090   0x20
 
#define HMC58X3_CRB_GN_1370   0x00
 
#define HMC58X3_CRB_GN_230   0xE0
 
#define HMC58X3_CRB_GN_330   0xC0
 
#define HMC58X3_CRB_GN_390   0xA0
 
#define HMC58X3_CRB_GN_440   0x80
 
#define HMC58X3_CRB_GN_660   0x60
 
#define HMC58X3_CRB_GN_820   0x40
 
#define HMC58X3_DATA   0x03
 
#define HMC58X3_ID1   0x0A
 
#define HMC58X3_ID2   0x0B
 
#define HMC58X3_ID3   0x0C
 
#define HMC58X3_MODE   0x02
 
#define HMC58X3_MODE_CONTINUOUS   0x00
 
#define HMC58X3_MODE_HS   0x80
 
#define HMC58X3_MODE_IDLE   0x02
 
#define HMC58X3_MODE_SINGLE   0x01
 
#define HMC58X3_SR_LOCK   0x02
 
#define HMC58X3_SR_RDY   0x01
 
#define HMC58X3_STATUS   0x09
 
#define HMC58X3_TIMEOUT   30000
 

Functions

void hmc5883l_async_read (float *mag_data)
 
bool hmc5883l_present ()
 
void hmc5883l_request_async_update ()
 
bool hmc5883lInit ()
 
static void read_cb (uint8_t result)
 

Variables

static uint8_t cmd
 
static volatile float data_ [3]
 
static uint8_t i2c_buf_ [6]
 
static uint32_t last_update_ms_
 
static bool mag_present_
 
static uint32_t next_update_ms_
 

Macro Definition Documentation

#define HMC58X3_ADDR   0x1E

Definition at line 28 of file drv_hmc5883l.c.

#define HMC58X3_CRA   0x00

Definition at line 29 of file drv_hmc5883l.c.

#define HMC58X3_CRA_AVG_2_MEAS   0x20

Definition at line 39 of file drv_hmc5883l.c.

#define HMC58X3_CRA_AVG_4_MEAS   0x40

Definition at line 40 of file drv_hmc5883l.c.

#define HMC58X3_CRA_AVG_8_MEAS   0x60

Definition at line 41 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_0_75   0x00

Definition at line 43 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_15   0x10

Definition at line 47 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_1_5   0x04

Definition at line 44 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_3   0x08

Definition at line 45 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_30   0x14

Definition at line 48 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_75   0x18

Definition at line 49 of file drv_hmc5883l.c.

#define HMC58X3_CRA_DO_7_5   0x0C

Definition at line 46 of file drv_hmc5883l.c.

#define HMC58X3_CRA_MEAS_MODE_NEG_BIAS   0x02

Definition at line 53 of file drv_hmc5883l.c.

#define HMC58X3_CRA_MEAS_MODE_NORMAL   0x00

Definition at line 51 of file drv_hmc5883l.c.

#define HMC58X3_CRA_MEAS_MODE_POS_BIAS   0x01

Definition at line 52 of file drv_hmc5883l.c.

#define HMC58X3_CRA_NO_AVG   0x00

Definition at line 38 of file drv_hmc5883l.c.

#define HMC58X3_CRB   0x01

Definition at line 30 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_1090   0x20

Definition at line 56 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_1370   0x00

Definition at line 55 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_230   0xE0

Definition at line 62 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_330   0xC0

Definition at line 61 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_390   0xA0

Definition at line 60 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_440   0x80

Definition at line 59 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_660   0x60

Definition at line 58 of file drv_hmc5883l.c.

#define HMC58X3_CRB_GN_820   0x40

Definition at line 57 of file drv_hmc5883l.c.

#define HMC58X3_DATA   0x03

Definition at line 32 of file drv_hmc5883l.c.

#define HMC58X3_ID1   0x0A

Definition at line 34 of file drv_hmc5883l.c.

#define HMC58X3_ID2   0x0B

Definition at line 35 of file drv_hmc5883l.c.

#define HMC58X3_ID3   0x0C

Definition at line 36 of file drv_hmc5883l.c.

#define HMC58X3_MODE   0x02

Definition at line 31 of file drv_hmc5883l.c.

#define HMC58X3_MODE_CONTINUOUS   0x00

Definition at line 65 of file drv_hmc5883l.c.

#define HMC58X3_MODE_HS   0x80

Definition at line 64 of file drv_hmc5883l.c.

#define HMC58X3_MODE_IDLE   0x02

Definition at line 67 of file drv_hmc5883l.c.

#define HMC58X3_MODE_SINGLE   0x01

Definition at line 66 of file drv_hmc5883l.c.

#define HMC58X3_SR_LOCK   0x02

Definition at line 69 of file drv_hmc5883l.c.

#define HMC58X3_SR_RDY   0x01

Definition at line 70 of file drv_hmc5883l.c.

#define HMC58X3_STATUS   0x09

Definition at line 33 of file drv_hmc5883l.c.

#define HMC58X3_TIMEOUT   30000

Definition at line 72 of file drv_hmc5883l.c.

Function Documentation

void hmc5883l_async_read ( float *  mag_data)

Definition at line 138 of file drv_hmc5883l.c.

bool hmc5883l_present ( )

Definition at line 111 of file drv_hmc5883l.c.

void hmc5883l_request_async_update ( )

Definition at line 118 of file drv_hmc5883l.c.

bool hmc5883lInit ( )

Definition at line 83 of file drv_hmc5883l.c.

void read_cb ( uint8_t  result)
static

Definition at line 127 of file drv_hmc5883l.c.

Variable Documentation

uint8_t cmd
static

Definition at line 79 of file drv_hmc5883l.c.

volatile float data_[3]
static

Definition at line 75 of file drv_hmc5883l.c.

uint8_t i2c_buf_[6]
static

Definition at line 74 of file drv_hmc5883l.c.

uint32_t last_update_ms_
static

Definition at line 76 of file drv_hmc5883l.c.

bool mag_present_
static

Definition at line 78 of file drv_hmc5883l.c.

uint32_t next_update_ms_
static

Definition at line 77 of file drv_hmc5883l.c.



rosflight_firmware
Author(s): Daniel Koch , James Jackson
autogenerated on Thu Apr 15 2021 05:07:50