loadcell2 2.0.0.0
loadcell2.h File Reference

This file contains API for Load Cell 2 Click driver. More...

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

Go to the source code of this file.

Data Structures

struct  loadcell2_t
 Click ctx object definition. More...
 
struct  loadcell2_cfg_t
 Click configuration structure definition. More...
 
struct  loadcell2_data_t
 Click data structure definition. More...
 

Macros

#define LOADCELL2_MAP_MIKROBUS(cfg, mikrobus)
 
#define LOADCELL2_RETVAL   uint8_t
 
#define LOADCELL2_OK   0x00
 
#define LOADCELL2_INIT_ERROR   0xFF
 
#define LOADCELL2_SLAVE_ADDRESS   0x2A
 
#define LOADCELL2_REG_PU_CTRL   0x00
 
#define LOADCELL2_REG_CTRL1   0x01
 
#define LOADCELL2_REG_CTRL2   0x02
 
#define LOADCELL2_REG_OCAL1_B2   0x03
 
#define LOADCELL2_REG_OCAL1_B1   0x04
 
#define LOADCELL2_REG_OCAL1_B0   0x05
 
#define LOADCELL2_REG_GCAL1_B3   0x06
 
#define LOADCELL2_REG_GCAL1_B2   0x07
 
#define LOADCELL2_REG_GCAL1_B1   0x08
 
#define LOADCELL2_REG_GCAL1_B0   0x09
 
#define LOADCELL2_REG_OCAL2_B2   0x0A
 
#define LOADCELL2_REG_OCAL2_B1   0x0B
 
#define LOADCELL2_REG_OCAL2_B0   0x0C
 
#define LOADCELL2_REG_GCAL2_B3   0x0D
 
#define LOADCELL2_REG_GCAL2_B2   0x0E
 
#define LOADCELL2_REG_GCAL2_B0   0x0F
 
#define LOADCELL2_REG_GCAL2_B1   0x10
 
#define LOADCELL2_REG_I2C_CTRL   0x11
 
#define LOADCELL2_REG_ADC_B2   0x12
 
#define LOADCELL2_REG_ADC_B1   0x13
 
#define LOADCELL2_REG_ADC_B0   0x14
 
#define LOADCELL2_REG_ADC_REG   0x15
 
#define LOADCELL2_REG_OTP_B1   0x16
 
#define LOADCELL2_REG_OTP_B0   0x17
 
#define LOADCELL2_REG_RES_00   0x18
 
#define LOADCELL2_REG_RES_01   0x19
 
#define LOADCELL2_REG_RES_02   0x1A
 
#define LOADCELL2_REG_PGA_REG   0x1B
 
#define LOADCELL2_REG_POW_CTRL   0x1C
 
#define LOADCELL2_REG_RES_03   0x1D
 
#define LOADCELL2_REG_RES_04   0x1E
 
#define LOADCELL2_REG_REV_ID   0x1F
 
#define LOADCELL2_ERROR   0x00
 
#define LOADCELL2_SUCCESS   0x01
 
#define LOADCELL2_AVDDS   0x80
 
#define LOADCELL2_OSCS   0x40
 
#define LOADCELL2_CR   0x20
 
#define LOADCELL2_CS   0x10
 
#define LOADCELL2_PUR   0x08
 
#define LOADCELL2_PUA   0x04
 
#define LOADCELL2_PUD   0x02
 
#define LOADCELL2_RR   0x01
 
#define LOADCELL2_GAIN_VAL_x128   128
 
#define LOADCELL2_GAIN_VAL_x64   64
 
#define LOADCELL2_GAIN_VAL_x32   32
 
#define LOADCELL2_GAIN_VAL_x16   16
 
#define LOADCELL2_GAIN_VAL_x8   8
 
#define LOADCELL2_GAIN_VAL_x4   4
 
#define LOADCELL2_GAIN_VAL_x2   2
 
#define LOADCELL2_GAIN_VAL_x1   1
 
#define LOADCELL2_CONV_RATE_SPS_320   320
 
#define LOADCELL2_CONV_RATE_SPS_80   80
 
#define LOADCELL2_CONV_RATE_SPS_40   40
 
#define LOADCELL2_CONV_RATE_SPS_20   20
 
#define LOADCELL2_CONV_RATE_SPS_10   10
 
#define LOADCELL2_DATA_NO_DATA   0
 
#define LOADCELL2_DATA_OK   1
 
#define LOADCELL2_GET_RESULT_ERROR   0
 
#define LOADCELL2_GET_RESULT_OK   1
 
#define LOADCELL2_WEIGHT_100G   100
 
#define LOADCELL2_WEIGHT_500G   500
 
#define LOADCELL2_WEIGHT_1000G   1000
 
#define LOADCELL2_WEIGHT_5000G   5000
 
#define LOADCELL2_WEIGHT_10000G   10000
 
#define LOADCELL2_DEFAULT_WEIGHT_SCALE_COEFFICIENT   0.088495575221
 

Functions

void loadcell2_cfg_setup (loadcell2_cfg_t *cfg)
 Config Object Initialization function.
 
LOADCELL2_RETVAL loadcell2_init (loadcell2_t *ctx, loadcell2_cfg_t *cfg)
 Initialization function.
 
void loadcell2_default_cfg (loadcell2_t *ctx)
 Click Default Configuration function.
 
void loadcell2_generic_write (loadcell2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic write function.
 
void loadcell2_generic_read (loadcell2_t *ctx, uint8_t reg, uint8_t *data_buf, uint8_t len)
 Generic read function.
 
uint8_t loadcell2_check_data_ready (loadcell2_t *ctx)
 Check data ready function.
 
void loadcell2_reset (loadcell2_t *ctx)
 Reset function.
 
LOADCELL2_RETVAL loadcell2_power_on (loadcell2_t *ctx)
 Power On function.
 
void loadcell2_set_ldo_voltage (loadcell2_t *ctx)
 Set LDO Voltage function.
 
void loadcell2_set_gain (loadcell2_t *ctx, uint8_t gain_val)
 Set gain function.
 
void loadcell2_set_sample_rate (loadcell2_t *ctx, uint8_t rate_sps)
 Set sample rate function.
 
void loadcell2_turn_off_clk_chp (loadcell2_t *ctx)
 Turn Off clk chp function.
 
void loadcell2_enable_dec_cap (loadcell2_t *ctx)
 Enables PGA output function.
 
void loadcell2_calibrate_afe (loadcell2_t *ctx)
 Calibrate analog front end of system function.
 
uint32_t loadcell2_get_result (loadcell2_t *ctx)
 Get results function.
 
void loadcell2_tare (loadcell2_t *ctx, loadcell2_data_t *cell_data)
 Tare function.
 
uint8_t loadcell2_calibration (loadcell2_t *ctx, uint16_t cal_val, loadcell2_data_t *cell_data)
 Calibration function.
 
float loadcell2_get_weight (loadcell2_t *ctx, loadcell2_data_t *cell_data)
 Get weight function.
 
uint8_t loadcell2_check_drdy (loadcell2_t *ctx)
 Check data ready function.
 

Detailed Description

This file contains API for Load Cell 2 Click driver.