compass3 2.0.0.0
compass3.h File Reference

This file contains API for Compass 3 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  compass3_t
 Click ctx object definition. More...
 
struct  compass3_cfg_t
 Click configuration structure definition. More...
 

Macros

#define COMPASS3_MAP_MIKROBUS(cfg, mikrobus)
 
#define COMPASS3_RETVAL   uint8_t
 
#define COMPASS3_OK   0x00
 
#define COMPASS3_INIT_ERROR   0xFF
 
#define COMPASS3_SLAVE_ADR   0x30
 
#define COMPASS3_XOUT_LSB   0x00
 
#define COMPASS3_XOUT_MSB   0x01
 
#define COMPASS3_YOUT_LSB   0x02
 
#define COMPASS3_YOUT_MSB   0x03
 
#define COMPASS3_ZOUT_LSB   0x04
 
#define COMPASS3_ZOUT_MSB   0x05
 
#define COMPASS3_TEMP   0x06
 
#define COMPASS3_STAT   0x07
 
#define COMPASS3_INTERNAL_CTRL_0   0x08
 
#define COMPASS3_INTERNAL_CTRL_1   0x09
 
#define COMPASS3_INTERNAL_CTRL_2   0x0A
 
#define COMPASS3_X_TRSH   0x0B
 
#define COMPASS3_Y_TRSH   0x0C
 
#define COMPASS3_Z_TRSH   0x0D
 
#define COMPASS3_DEVICE_ID   0x2F
 
#define COMPASS3_MEAS_M_DONE   0x01
 
#define COMPASS3_MEAS_T_DONE   0x02
 
#define COMPASS3_MOTION_DCT   0x04
 
#define COMPASS3_PUMP_ON   0x08
 
#define COMPASS3_OTP_RD_DONE   0x10
 
#define COMPASS3_TEST_PIN_SEL   0x80
 
#define COMPASS3_OTP_RD   0x40
 
#define COMPASS3_RSRVD   0x20
 
#define COMPASS3_RESET   0x10
 
#define COMPASS3_SET   0x08
 
#define COMPASS3_START_MD_T   0x04
 
#define COMPASS3_TM_T   0x02
 
#define COMPASS3_TM_M   0x01
 
#define COMPASS3_SW_RST   0x80
 
#define COMPASS3_OTP_BL_SEL1   0x40
 
#define COMPASS3_OTP_BL_SEL0   0x20
 
#define COMPASS3_Z_INH   0x10
 
#define COMPASS3_Y_INH   0x08
 
#define COMPASS3_X_INH   0x04
 
#define COMPASS3_BW_ODR_600   0x03
 
#define COMPASS3_BW_ODR_400   0x02
 
#define COMPASS3_BW_ODR_200   0x01
 
#define COMPASS3_BW_ODR_100   0x00
 
#define COMPASS3_ULP_SEL   0x80
 
#define COMPASS3_INT_MEAS_DONE_EN   0x40
 
#define COMPASS3_INT_MDT_EN   0x20
 
#define COMPASS3_Force_VDDL_STBY   0x10
 
#define COMPASS3_CM_FREQ_0_015625HZ   0x0A
 
#define COMPASS3_CM_FREQ_0_03125HZ   0x09
 
#define COMPASS3_CM_FREQ_0_0625HZ   0x08
 
#define COMPASS3_CM_FREQ_0_125HZ   0x07
 
#define COMPASS3_CM_FREQ_0_25HZ   0x06
 
#define COMPASS3_CM_FREQ_0_5HZ   0x05
 
#define COMPASS3_CM_FREQ_1HZ   0x04
 
#define COMPASS3_CM_FREQ_2_2HZ   0x03
 
#define COMPASS3_CM_FREQ_5HZ   0x02
 
#define COMPASS3_CM_FREQ_14HZ   0x01
 
#define COMPASS3_CM_FREQ_CONT   0x00
 
#define COMPASS3_DYNAMIC_RANGE   16
 
#define COMPASS3_MAG_LSB_VALUE   0.25
 
#define COMPASS3_TEMP_LSB_VALUE   0.7
 
#define COMPASS3_MAG_RANGE_VALUE   8000
 
#define COMPASS3_TEMP_RANGE_VALUE   75
 
#define COMPASS3_RESOLUTION   65536
 
#define COMPASS3_INTERRUPT   0x01
 
#define COMPASS3_NO_INTERRUPT   0x00
 
#define COMPASS3_DEVICE_ID_NUM   0x0C
 

Functions

void compass3_cfg_setup (compass3_cfg_t *cfg)
 Config Object Initialization function.
 
COMPASS3_RETVAL compass3_init (compass3_t *ctx, compass3_cfg_t *cfg)
 Initialization function.
 
void compass3_default_cfg (compass3_t *ctx)
 Click Default Configuration function.
 
void compass3_generic_write (compass3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void compass3_generic_read (compass3_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
void compass3_full_measurement (compass3_t *ctx, float *x_val, float *y_val, float *z_val)
 Full measurement function.
 
float compass3_read_temp (compass3_t *ctx)
 Read temperature function.
 
uint8_t compass3_check_int (compass3_t *ctx)
 Check interrupt function.
 

Detailed Description

This file contains API for Compass 3 Click driver.