compass5 2.0.0.0
compass5.h File Reference

This file contains API for Compass 5 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  compass5_t
 Compass 5 Click context object. More...
 
struct  compass5_cfg_t
 Compass 5 Click configuration object. More...
 

Macros

#define COMPASS5_DEVICE_ID_NUM   0X0C
 Compass 5 description register.
 
#define COMPASS5_COMPANI_ID_NUM   0X48
 
#define COMPASS5_COMPANI_ID   0x00
 
#define COMPASS5_DEVICE_ID   0x01
 
#define COMPASS5_DATA_STATUS_1   0x10
 Compass 5 register map for status.
 
#define COMPASS5_X_AXIS_DATA_L   0x11
 Compass 5 register map for X, Y, Z axis.
 
#define COMPASS5_X_AXIS_DATA_H   0x12
 
#define COMPASS5_Y_AXIS_DATA_L   0x13
 
#define COMPASS5_Y_AXIS_DATA_H   0x14
 
#define COMPASS5_Z_AXIS_DATA_L   0x15
 
#define COMPASS5_Z_AXIS_DATA_H   0x16
 
#define COMPASS5_DUMMY_TMPS   0x17
 Compass 5 register map for DUMMY and STATUS.
 
#define COMPASS5_DATA_STATUS_2   0x18
 
#define COMPASS5_DUMMY_CNTL1   0x30
 Compass 5 register map for DUMMY and CONTROL SETTINGS.
 
#define COMPASS5_CONTROL_2_SETTINGS   0x31
 
#define COMPASS5_CONTROL_3_SETTINGS   0x32
 
#define COMPASS5_TEST_TS1   0x33
 
#define COMPASS5_TEST_TS2   0x34
 
#define COMPASS5_MODE_POWER_DOWN   0x00
 Compass 5 description setting operation mode.
 
#define COMPASS5_MODE_SINGLE_MEASUREMENT   0x01
 
#define COMPASS5_MODE_CON_MEASUREMENT_10HZ   0x02
 
#define COMPASS5_MODE_CON_MEASUREMENT_20HZ   0x04
 
#define COMPASS5_MODE_CON_MEASUREMENT_50HZ   0x06
 
#define COMPASS5_MODE_CON_MEASUREMENT_100HZ   0x08
 
#define COMPASS5_MODE_SELF_TEST   0x10
 
#define COMPASS5_SRST_BIT   0x01
 Compass 5 registers for setting.
 
#define COMPASS5_HOFL_BIT   0x08
 
#define COMPASS5_DOR_BIT   0x02
 
#define COMPASS5_DRDY_BIT   0x01
 
#define COMPASS5_DATA_NO_READY   0x00
 Compass 5 registers settings for data status.
 
#define COMPASS5_DATA_READY   0x01
 
#define COMPASS5_BIT_MASK_BIT0   0x01
 Compass 5 registers settings bit mask.
 
#define COMPASS5_SET_DEV_ADDR   0x0C
 Compass 5 device address setting.
 
#define COMPASS5_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.
 

Enumerations

enum  compass5_return_value_t { COMPASS5_OK = 0 , COMPASS5_ERROR = -1 }
 Compass 5 Click return value data. More...
 

Functions

void compass5_cfg_setup (compass5_cfg_t *cfg)
 Compass 5 configuration object setup function.
 
err_t compass5_init (compass5_t *ctx, compass5_cfg_t *cfg)
 Compass 5 initialization function.
 
err_t compass5_generic_write (compass5_t *ctx, uint8_t reg, uint8_t *tx_buf, uint8_t tx_len)
 Compass 5 I2C writing function.
 
err_t compass5_generic_read (compass5_t *ctx, uint8_t reg, uint8_t *rx_buf, uint8_t rx_len)
 Compass 5 I2C reading function.
 
void compass5_write_byte (compass5_t *ctx, uint8_t reg, uint8_t tx_data)
 Compass 5 write byte function.
 
uint8_t compass5_read_byte (compass5_t *ctx, uint8_t reg)
 Compass 5 read 1 byte function.
 
void compass5_sw_reset (compass5_t *ctx)
 Compass 5 software reset function.
 
void compass5_get_id (compass5_t *ctx, uint8_t *company_id, uint8_t *device_id)
 Compass 5 get ID function.
 
uint8_t compass5_check_data_ready (compass5_t *ctx)
 Compass 5 check data ready function.
 
uint8_t compass5_check_data_overrun (compass5_t *ctx)
 Compass 5 check data overrun function.
 
uint8_t compass5_set_operation_mode (compass5_t *ctx, uint8_t op_mode)
 Compass 5 set operation mode function.
 
uint8_t compass5_get_operation_mode (compass5_t *ctx)
 Compass 5 get operation mode function.
 
void compass5_measurement_axis (compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 5 full measurement axis function.
 
void compass5_get_mag_data (compass5_t *ctx, int16_t *axis_x, int16_t *axis_y, int16_t *axis_z)
 Compass 5 full measurement axis function.
 

Detailed Description

This file contains API for Compass 5 Click Driver.

Enumeration Type Documentation

◆ compass5_return_value_t

Compass 5 Click return value data.

Predefined enum values for driver return values.

Enumerator
COMPASS5_OK 
COMPASS5_ERROR