compass8  2.1.0.0
Data Structures | Macros | Enumerations | Functions
compass8.h File Reference

This file contains API for Compass 8 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  compass8_t
 Compass 8 Click context object. More...
 
struct  compass8_cfg_t
 Compass 8 Click configuration object. More...
 
struct  compass8_axes_t
 Compass 8 Click axes magnetic flux density data. More...
 

Macros

#define COMPASS8_REG_WIA1   0x00
 Compass 8 description register. More...
 
#define COMPASS8_REG_WIA2   0x01
 
#define COMPASS8_REG_RSV1   0x02
 
#define COMPASS8_REG_RSV2   0x03
 
#define COMPASS8_REG_ST1   0x10
 
#define COMPASS8_REG_HXH   0x11
 
#define COMPASS8_REG_HXL   0x12
 
#define COMPASS8_REG_HYH   0x13
 
#define COMPASS8_REG_HYL   0x14
 
#define COMPASS8_REG_HZH   0x15
 
#define COMPASS8_REG_HZL   0x16
 
#define COMPASS8_REG_TMPS   0x17
 
#define COMPASS8_REG_ST2   0x18
 
#define COMPASS8_REG_CNTL1   0x30
 
#define COMPASS8_REG_CNTL2   0x31
 
#define COMPASS8_REG_CNTL3   0x32
 
#define COMPASS8_REG_TS1   0x33
 
#define COMPASS8_REG_TS2   0x34
 
#define COMPASS8_ST1_DATA_NORMAL   0x00
 Compass 8 status 1 register bitmask. More...
 
#define COMPASS8_ST1_DATA_READY   0x01
 
#define COMPASS8_ST1_DOR_NORMAL   0x00
 
#define COMPASS8_ST1_DOR_OVR   0x02
 
#define COMPASS8_CNTL1_WM_STEP_1   0x00
 Compass 8 control 1 register bitmask. More...
 
#define COMPASS8_CNTL1_WM_STEP_2   0x01
 
#define COMPASS8_CNTL1_WM_STEP_3   0x02
 
#define COMPASS8_CNTL1_ITS_OFF   0x00
 
#define COMPASS8_CNTL1_ITS_LOW   0x20
 
#define COMPASS8_CNTL1_ITS_HIGH   0x40
 
#define COMPASS8_CNTL1_ITS_HIGH1   0x60
 
#define COMPASS8_CNTL2_MODE_PD   0x00
 Compass 8 control 2 register bitmask. More...
 
#define COMPASS8_CNTL2_MODE_SNGL   0x01
 
#define COMPASS8_CNTL2_MODE_CONT1   0x02
 
#define COMPASS8_CNTL2_MODE_CONT2   0x04
 
#define COMPASS8_CNTL2_MODE_CONT3   0x05
 
#define COMPASS8_CNTL2_MODE_CONT4   0x08
 
#define COMPASS8_CNTL2_MODE_CONT5   0x0E
 
#define COMPASS8_CNTL2_MODE_BITMASK   0x0F
 
#define COMPASS8_CNTL2_MODE_ST   0x10
 
#define COMPASS8_CNTL2_IBIP_DIS   0x00
 
#define COMPASS8_CNTL2_IBIP_EN   0x20
 
#define COMPASS8_CNTL2_SDR_DIS   0x00
 
#define COMPASS8_CNTL2_SDR_EN   0x40
 
#define COMPASS8_CNTL2_FIFO_DIS   0x00
 
#define COMPASS8_CNTL2_FIFO_EN   0x80
 
#define COMPASS8_CNTL3_SRST_NORMAL   0x00
 Compass 8 control 3 register bitmask. More...
 
#define COMPASS8_CNTL3_SRST_RESET   0x01
 
#define COMPASS8_COMPANY_ID   0x48
 Compass 8 device information data. More...
 
#define COMPASS8_DEVICE_ID   0x0E
 
#define COMPASS8_MAG_AXIS_SENS   0.125f
 Compass 8 magnetic flux density calculation data. More...
 
#define COMPASS8_DEVICE_ADDRESS   0x0E
 Compass 8 device address setting. More...
 
#define COMPASS8_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  compass8_return_value_t { COMPASS8_OK = 0, COMPASS8_ERROR = -1 }
 Compass 8 Click return value data. More...
 

Functions

void compass8_cfg_setup (compass8_cfg_t *cfg)
 Compass 8 configuration object setup function. More...
 
err_t compass8_init (compass8_t *ctx, compass8_cfg_t *cfg)
 Compass 8 initialization function. More...
 
err_t compass8_default_cfg (compass8_t *ctx)
 Compass 8 default configuration function. More...
 
void compass8_device_enable (compass8_t *ctx)
 Compass 8 device enable function. More...
 
void compass8_device_disable (compass8_t *ctx)
 Compass 8 device disable function. More...
 
err_t compass8_generic_write (compass8_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Compass 8 I2C writing function. More...
 
err_t compass8_generic_read (compass8_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Compass 8 I2C reading function. More...
 
err_t compass8_get_company_id (compass8_t *ctx, uint8_t *company_id)
 Compass 8 get company ID function. More...
 
err_t compass8_get_device_id (compass8_t *ctx, uint8_t *device_id)
 Compass 8 get device ID function. More...
 
err_t compass8_wait_data_ready (compass8_t *ctx)
 Compass 8 wait data ready function. More...
 
err_t compass8_get_raw_data (compass8_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 8 get mag raw data function. More...
 
err_t compass8_get_magnetic_data (compass8_t *ctx, compass8_axes_t *axis)
 Compass 8 get magnetic data function. More...
 
err_t compass8_set_operation_mode (compass8_t *ctx, uint8_t op_mode)
 Compass 8 set operation mode function. More...
 
err_t compass8_get_operation_mode (compass8_t *ctx, uint8_t *op_mode)
 Compass 8 get operation mode function. More...
 
err_t compass8_set_control (compass8_t *ctx, uint8_t ctrl_reg, uint8_t data_in)
 Compass 8 set control function. More...
 
err_t compass8_sw_reset (compass8_t *ctx)
 Compass 8 soft reset function. More...
 

Detailed Description

This file contains API for Compass 8 Click Driver.

Enumeration Type Documentation

◆ compass8_return_value_t

Compass 8 Click return value data.

Predefined enum values for driver return values.

Enumerator
COMPASS8_OK 
COMPASS8_ERROR