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

This file contains API for Current 12 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  current12_t
 Current 12 Click context object. More...
 
struct  current12_cfg_t
 Current 12 Click configuration object. More...
 
struct  current12_measure_cfg_t
 Current 12 Click configuration register object. More...
 

Macros

#define CURRENT12_REG_CONFIGURATION   0x00
 Current 12 description register. More...
 
#define CURRENT12_REG_SHUNT_VOLTAGE   0x01
 
#define CURRENT12_REG_LOAD_VOLTAGE   0x02
 
#define CURRENT12_REG_DC_POWER   0x03
 
#define CURRENT12_REG_CURRENT   0x04
 
#define CURRENT12_REG_TEMPERATURE   0x05
 
#define CURRENT12_REG_MASK   0x06
 
#define CURRENT12_REG_FLAG   0x07
 
#define CURRENT12_REG_RSHUNT   0x08
 
#define CURRENT12_REG_SOL   0x09
 
#define CURRENT12_REG_SUL   0x0A
 
#define CURRENT12_REG_LOL   0x0B
 
#define CURRENT12_REG_LUL   0x0C
 
#define CURRENT12_REG_POL   0x0D
 
#define CURRENT12_REG_TOL   0x0E
 
#define CURRENT12_REG_MANUFACTURING_ID   0xFE
 
#define CURRENT12_REG_DIE_ID   0xFF
 
#define CURRENT12_CFG_RST_DISABLE   0x00
 Current 12 description configuration setting. More...
 
#define CURRENT12_CFG_RST_ENABLE   0x01
 
#define CURRENT12_CFG_RST_BITMASK   0x01
 
#define CURRENT12_CFG_CT_128_US   0x00
 
#define CURRENT12_CFG_CT_256_US   0x01
 
#define CURRENT12_CFG_CT_512_US   0x02
 
#define CURRENT12_CFG_CT_1024_US   0x03
 
#define CURRENT12_CFG_CT_2048_US   0x04
 
#define CURRENT12_CFG_CT_4096_US   0x05
 
#define CURRENT12_CFG_CT_8192_US   0x06
 
#define CURRENT12_CFG_CT_16384_US   0x07
 
#define CURRENT12_CFG_CT_32768_US   0x08
 
#define CURRENT12_CFG_CT_BITMASK   0x0F
 
#define CURRENT12_CFG_TEMP_DISABLE   0x00
 
#define CURRENT12_CFG_TEMP_ENABLE   0x01
 
#define CURRENT12_CFG_TEMP_BITMASK   0x01
 
#define CURRENT12_CFG_OP_MODE_SHUTDOWN   0x00
 
#define CURRENT12_CFG_OP_MODE_SV_TRG   0x01
 
#define CURRENT12_CFG_OP_MODE_LV_TRG   0x02
 
#define CURRENT12_CFG_OP_MODE_SLV_TRG   0x03
 
#define CURRENT12_CFG_OP_MODE_IDLE_MODE   0x04
 
#define CURRENT12_CFG_OP_MODE_SV_CONT   0x05
 
#define CURRENT12_CFG_OP_MODE_LV_CONT   0x06
 
#define CURRENT12_CFG_OP_MODE_SLV_CONT   0x07
 
#define CURRENT12_CFG_OP_MODE_BITMASK   0x07
 
#define CURRENT12_DEVICE_ID   0x0006u
 Current 12 manufacturing ID data value. More...
 
#define CURRENT12_RSHUNT_5_MOHM   5.0f
 Current 12 default RSHUNT value. More...
 
#define CURRENT12_RSHUNT_MAX   655.35f
 
#define CURRENT12_CALC_SHUNT_VTG_MV   0.025f
 Current 12 calculation data values. More...
 
#define CURRENT12_CALC_LOAD_VTG_V   0.002f
 
#define CURRENT12_CALC_DC_POWER_W   0.025f
 
#define CURRENT12_CALC_CURRENT_MA   0.5f
 
#define CURRENT12_CALC_TEMP_C   0.5f
 
#define CURRENT12_TEMP_ERROR_BITMASK   0x8000u
 Current 12 temperature error data bitmask. More...
 
#define CURRENT12_DEVICE_ADDRESS_0   0x40
 Current 12 device address setting. More...
 
#define CURRENT12_DEVICE_ADDRESS_1   0x41
 
#define CURRENT12_DEVICE_ADDRESS_2   0x42
 
#define CURRENT12_DEVICE_ADDRESS_3   0x43
 
#define CURRENT12_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping. More...
 

Enumerations

enum  current12_return_value_t { CURRENT12_OK = 0, CURRENT12_ERROR = -1 }
 Current 12 Click return value data. More...
 

Functions

void current12_cfg_setup (current12_cfg_t *cfg)
 Current 12 configuration object setup function. More...
 
err_t current12_init (current12_t *ctx, current12_cfg_t *cfg)
 Current 12 initialization function. More...
 
err_t current12_default_cfg (current12_t *ctx)
 Current 12 default configuration function. More...
 
err_t current12_generic_write (current12_t *ctx, uint8_t reg, uint8_t *data_in, uint8_t len)
 Current 12 I2C writing function. More...
 
err_t current12_generic_read (current12_t *ctx, uint8_t reg, uint8_t *data_out, uint8_t len)
 Current 12 I2C reading function. More...
 
err_t current12_write_word (current12_t *ctx, uint8_t reg, uint16_t data_in)
 Current 12 word data writing function. More...
 
err_t current12_read_word (current12_t *ctx, uint8_t reg, uint16_t *data_out)
 Current 12 word data reading function. More...
 
err_t current12_set_measure_cfg (current12_t *ctx, current12_measure_cfg_t measure_cfg)
 Current 12 set measurement configuration function. More...
 
err_t current12_get_shunt_voltage (current12_t *ctx, float *shunt_voltage)
 Current 12 get shunt voltage function. More...
 
err_t current12_get_load_voltage (current12_t *ctx, float *load_voltage)
 Current 12 get load voltage function. More...
 
err_t current12_get_dc_power (current12_t *ctx, float *dc_power)
 Current 12 get DC power function. More...
 
err_t current12_get_current (current12_t *ctx, float *current)
 Current 12 get current function. More...
 
err_t current12_get_temperature (current12_t *ctx, float *temperature)
 Current 12 get temperature function. More...
 
err_t current12_set_rshunt (current12_t *ctx, float rshunt_mohm)
 Current 12 set RSHUNT function. More...
 
err_t current12_get_device_id (current12_t *ctx, uint16_t *device_id)
 Current 12 get device ID function. More...
 
uint8_t current12_get_alert (current12_t *ctx)
 Current 12 get interrupt function. More...
 

Detailed Description

This file contains API for Current 12 Click Driver.

Enumeration Type Documentation

◆ current12_return_value_t

Current 12 Click return value data.

Predefined enum values for driver return values.

Enumerator
CURRENT12_OK 
CURRENT12_ERROR