compass7 2.0.0.0
compass7.h File Reference

This file contains API for Compass 7 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  compass7_t
 Compass 7 Click context object. More...
 
struct  compass7_cfg_t
 Compass 7 Click configuration object. More...
 
struct  compass7_magnetic_flux_t
 Compass 7 magnetic flux data object. More...
 

Macros

#define COMPASS7_REG_XOUT0   0x00
 Compass 7 register map.
 
#define COMPASS7_REG_XOUT1   0x01
 
#define COMPASS7_REG_YOUT0   0x02
 
#define COMPASS7_REG_YOUT1   0x03
 
#define COMPASS7_REG_ZOUT0   0x04
 
#define COMPASS7_REG_ZOUT1   0x05
 
#define COMPASS7_REG_XOUT2   0x06
 
#define COMPASS7_REG_YOUT2   0x07
 
#define COMPASS7_REG_ZOUT2   0x08
 
#define COMPASS7_REG_TOUT   0x09
 
#define COMPASS7_REG_TPH0   0x0A
 
#define COMPASS7_REG_TPH1   0x0B
 
#define COMPASS7_REG_TU   0x0C
 
#define COMPASS7_REG_STATUS1   0x18
 
#define COMPASS7_REG_STATUS0   0x19
 
#define COMPASS7_REG_ODR   0x1A
 
#define COMPASS7_REG_CONTROL0   0x1B
 
#define COMPASS7_REG_CONTROL1   0x1C
 
#define COMPASS7_REG_CONTROL2   0x1D
 
#define COMPASS7_REG_ST_X_TH   0x1E
 
#define COMPASS7_REG_ST_Y_TH   0x1F
 
#define COMPASS7_REG_ST_Z_TH   0x20
 
#define COMPASS7_REG_ST_X   0x27
 
#define COMPASS7_REG_ST_Y   0x28
 
#define COMPASS7_REG_ST_Z   0x29
 
#define COMPASS7_REG_PRODUCT_ID   0x39
 
#define COMPASS7_STATUS1_MEAS_T_DONE   0x80
 Compass 7 status 1 register settings.
 
#define COMPASS7_STATUS1_MEAS_M_DONE   0x40
 
#define COMPASS7_STATUS1_SAT_SENSOR   0x20
 
#define COMPASS7_STATUS1_OTP_READ_DONE   0x10
 
#define COMPASS7_STATUS1_ST_FAIL   0x08
 
#define COMPASS7_STATUS1_MDT_FLAG_INT   0x04
 
#define COMPASS7_STATUS1_MEAS_T_DONE_INT   0x02
 
#define COMPASS7_STATUS1_MEAS_M_DONE_INT   0x01
 
#define COMPASS7_CONTROL0_CMM_FREQ_EN   0x80
 Compass 7 internal control 0 register settings.
 
#define COMPASS7_CONTROL0_AUTO_ST_EN   0x40
 
#define COMPASS7_CONTROL0_AUTO_SR_EN   0x20
 
#define COMPASS7_CONTROL0_DO_RESET   0x10
 
#define COMPASS7_CONTROL0_DO_SET   0x08
 
#define COMPASS7_CONTROL0_START_MDT   0x04
 
#define COMPASS7_CONTROL0_TAKE_MEAS_T   0x02
 
#define COMPASS7_CONTROL0_TAKE_MEAS_M   0x01
 
#define COMPASS7_CONTROL1_SW_RESET   0x80
 Compass 7 internal control 1 register settings.
 
#define COMPASS7_CONTROL1_ST_ENM   0x40
 
#define COMPASS7_CONTROL1_ST_ENP   0x20
 
#define COMPASS7_CONTROL1_Z_INHIBIT   0x10
 
#define COMPASS7_CONTROL1_Y_INHIBIT   0x08
 
#define COMPASS7_CONTROL1_X_INHIBIT   0x04
 
#define COMPASS7_CONTROL1_BW_6p6MS   0x00
 
#define COMPASS7_CONTROL1_BW_3p5MS   0x01
 
#define COMPASS7_CONTROL1_BW_2p0MS   0x02
 
#define COMPASS7_CONTROL1_BW_1p2MS   0x03
 
#define COMPASS7_CONTROL1_BW_BIT_MASK   0x03
 
#define COMPASS7_CONTROL2_HPOWER   0x80
 Compass 7 internal control 2 register settings.
 
#define COMPASS7_CONTROL2_INT_MEAS_DONE_EN   0x40
 
#define COMPASS7_CONTROL2_INT_MDT_EN   0x20
 
#define COMPASS7_CONTROL2_CMM_EN   0x10
 
#define COMPASS7_CONTROL2_EN_PRD_SET   0x08
 
#define COMPASS7_CONTROL2_PRD_SET_1_SMPL   0x00
 
#define COMPASS7_CONTROL2_PRD_SET_25_SMPL   0x01
 
#define COMPASS7_CONTROL2_PRD_SET_75_SMPL   0x02
 
#define COMPASS7_CONTROL2_PRD_SET_100_SMPL   0x03
 
#define COMPASS7_CONTROL2_PRD_SET_250_SMPL   0x04
 
#define COMPASS7_CONTROL2_PRD_SET_500_SMPL   0x05
 
#define COMPASS7_CONTROL2_PRD_SET_1000_SMPL   0x06
 
#define COMPASS7_CONTROL2_PRD_SET_2000_SMPL   0x07
 
#define COMPASS7_CONTROL2_PRD_SET_BIT_MASK   0x07
 
#define COMPASS7_ODR_DISABLE   0
 Compass 7 ODR register settings.
 
#define COMPASS7_ODR_1HZ   1
 
#define COMPASS7_ODR_2HZ   2
 
#define COMPASS7_ODR_5HZ   5
 
#define COMPASS7_ODR_10HZ   10
 
#define COMPASS7_ODR_25HZ   25
 
#define COMPASS7_ODR_50HZ   50
 
#define COMPASS7_ODR_100HZ   100
 
#define COMPASS7_MAGNETIC_OFFSET   0x080000l
 Compass 7 data calculation values.
 
#define COMPASS7_MAGNETIC_RESOLUTION   0.0625
 
#define COMPASS7_MILLIGAUSS_TO_GAUSS   0.001
 
#define COMPASS7_TEMPERATURE_OFFSET   75
 
#define COMPASS7_TEMPERATURE_RESOLUTION   0.8
 
#define COMPASS7_TIMEOUT   2000
 
#define COMPASS7_MEAS_SINGLE_T   0
 Compass 7 measurement mode settings.
 
#define COMPASS7_MEAS_SINGLE_M   1
 
#define COMPASS7_MEAS_CONTINUOUS_M_1HZ   2
 
#define COMPASS7_MEAS_CONTINUOUS_M_2HZ   3
 
#define COMPASS7_MEAS_CONTINUOUS_M_5HZ   4
 
#define COMPASS7_MEAS_CONTINUOUS_M_10HZ   5
 
#define COMPASS7_MEAS_CONTINUOUS_M_25HZ   6
 
#define COMPASS7_MEAS_CONTINUOUS_M_50HZ   7
 
#define COMPASS7_MEAS_CONTINUOUS_M_100HZ   8
 
#define COMPASS7_PRODUCT_ID   0x10
 Compass 7 product ID value.
 
#define COMPASS7_DEVICE_ADDRESS   0x30
 Compass 7 device address setting.
 
#define COMPASS7_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  compass7_return_value_t { COMPASS7_OK = 0 , COMPASS7_ERROR = -1 }
 Compass 7 Click return value data. More...
 

Functions

void compass7_cfg_setup (compass7_cfg_t *cfg)
 Compass 7 configuration object setup function.
 
err_t compass7_init (compass7_t *ctx, compass7_cfg_t *cfg)
 Compass 7 initialization function.
 
err_t compass7_default_cfg (compass7_t *ctx)
 Compass 7 default configuration function.
 
err_t compass7_generic_write (compass7_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Compass 7 I2C writing function.
 
err_t compass7_generic_read (compass7_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Compass 7 I2C reading function.
 
err_t compass7_write_register (compass7_t *ctx, uint8_t reg, uint8_t data_in)
 Compass 7 write register function.
 
err_t compass7_read_register (compass7_t *ctx, uint8_t reg, uint8_t *data_out)
 Compass 7 read register function.
 
err_t compass7_check_communication (compass7_t *ctx)
 Compass 7 check communication function.
 
err_t compass7_soft_reset (compass7_t *ctx)
 Compass 7 soft reset function.
 
err_t compass7_set_measurement_mode (compass7_t *ctx, uint8_t mode)
 Compass 7 set measurement mode function.
 
err_t compass7_get_magnetic_flux (compass7_t *ctx, compass7_magnetic_flux_t *flux)
 Compass 7 get magnetic flux function.
 
err_t compass7_get_temperature (compass7_t *ctx, float *temperature)
 Compass 7 get temperature function.
 

Detailed Description

This file contains API for Compass 7 Click Driver.

Enumeration Type Documentation

◆ compass7_return_value_t

Compass 7 Click return value data.

Predefined enum values for driver return values.

Enumerator
COMPASS7_OK 
COMPASS7_ERROR