Loading...
Searching...
No Matches
#include <stdbool.h>
#include <stdint.h>
#include "periph/gpio.h"
#include "periph/i2c.h"
+ Include dependency graph for hmc5883l.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hmc5883l_data_t
 Magnetic field values in milli-Gauss (mGs) More...
 
struct  hmc5883l_raw_data_t
 Raw data set as two complements. More...
 
struct  hmc5883l_params_t
 HMC5883L device initialization parameters. More...
 
struct  hmc5883l_t
 HMC5883L sensor device data structure type. More...
 

Typedefs

typedef void(* hmc5883l_drdy_int_cb_t) (void *)
 HMC5883L DRDY interrupt callback function type.
 

Enumerations

enum  hmc5883l_error_codes_t {
  HMC5883L_OK = 0 , HMC5883L_ERROR_I2C = -1 , HMC5883L_ERROR_WRONG_ID = -2 , HMC5883L_ERROR_NO_DATA = -3 ,
  HMC5883L_ERROR_RAW_DATA = -4 , HMC5883L_ERROR_COMMON = -5
}
 Definition of error codes. More...
 
enum  hmc5883l_dor_t {
  HMC5883L_DOR_0_75 = 0x00 , HMC5883L_DOR_1_5 = 0x04 , HMC5883L_DOR_3 = 0x08 , HMC5883L_DOR_7_5 = 0x0c ,
  HMC5883L_DOR_15 = 0x10 , HMC5883L_DOR_30 = 0x14 , HMC5883L_DOR_75 = 0x18
}
 Data output rates (DOR) More...
 
enum  hmc5883l_meas_mode_t { HMC5883L_MEAS_MODE_NORMAL = 0x00 , HMC5883L_MEAS_MODE_BIAS_POS = 0x01 , HMC5883L_MEAS_MODE_BIAS_NEG = 0x02 }
 Measurement modes. More...
 
enum  hmc5883l_meas_avg_t { HMC5883L_MEAS_AVG_NONE = 0x00 , HMC5883L_MEAS_AVG_2 = 0x20 , HMC5883L_MEAS_AVG_4 = 0x40 , HMC5883L_MEAS_AVG_8 = 0x60 }
 Measurement avaraging (number of samples are averaged for output) More...
 
enum  hmc5883l_op_mode_t { HMC5883L_OP_MODE_CONTINUOUS = 0x00 , HMC5883L_OP_MODE_SINGLE = 0x01 , HMC5883L_OP_MODE_IDLE = 0x02 }
 Operation modes. More...
 
enum  hmc5883l_gain_t {
  HMC5883L_GAIN_1370 = 0x00 , HMC5883L_GAIN_1090 = 0x20 , HMC5883L_GAIN_820 = 0x40 , HMC5883L_GAIN_660 = 0x60 ,
  HMC5883L_GAIN_440 = 0x80 , HMC5883L_GAIN_390 = 0xa0 , HMC5883L_GAIN_330 = 0xc0 , HMC5883L_GAIN_230 = 0xe0
}
 Gain (determines the sensitivity and the range) More...
 

Functions

int hmc5883l_init (hmc5883l_t *dev, const hmc5883l_params_t *params)
 Initialize the HMC5883L sensor device.
 
int hmc5883l_init_int (hmc5883l_t *dev, hmc5883l_drdy_int_cb_t cb, void *arg)
 Initialize and activate the DRDY interrupt of HMC5883L sensor device.
 
int hmc5883l_data_ready (const hmc5883l_t *dev)
 Data-ready status function.
 
int hmc5883l_read (const hmc5883l_t *dev, hmc5883l_data_t *data)
 Read one sample of magnetic field values in milli-Gauss (mGs)
 
int hmc5883l_read_raw (const hmc5883l_t *dev, hmc5883l_raw_data_t *raw)
 Read one sample of raw sensor data as 16 bit two's complements.
 
int hmc5883l_power_down (hmc5883l_t *dev)
 Power down the sensor.
 
int hmc5883l_power_up (hmc5883l_t *dev)
 Power up the sensor.