ina3221_internal.h File Reference

Functions to convert register values of INA3221 to actual voltage values and vice versa. More...

Detailed Description

Functions to convert register values of INA3221 to actual voltage values and vice versa.

Author
Fabian Hüßler fabia.nosp@m.n.hu.nosp@m.essle.nosp@m.r@ov.nosp@m.gu.de

Definition in file ina3221_internal.h.

#include <assert.h>
#include "ina3221_defines.h"
#include "ina3221.h"
+ Include dependency graph for ina3221_internal.h:

Go to the source code of this file.

static int32_t reg_val_to_shunt_voltage_uv (int16_t reg_val)
 Convert register value to shunt voltage in uV. More...
 
static int16_t shunt_voltage_uv_to_reg_val (int32_t s_uv)
 Convert shunt voltage in uV to register value. More...
 
static int16_t reg_val_to_bus_voltage_mv (int16_t reg_val)
 Convert register value to bus voltage in mV. More...
 
static int16_t bus_voltage_mv_to_reg_val (int16_t b_mv)
 Convert bus voltage in mV to register value. More...
 
static int32_t sum_reg_val_to_shunt_voltage_uv (int16_t sum_reg_val)
 Convert register value to shunt voltage sum value in mV. More...
 
static int16_t sum_shunt_voltage_uv_to_reg_val (int32_t sum_suv)
 Convert shunt voltage sum value in uV to register value. More...
 

Function Documentation

◆ bus_voltage_mv_to_reg_val()

static int16_t bus_voltage_mv_to_reg_val ( int16_t  b_mv)
inlinestatic

Convert bus voltage in mV to register value.

Parameters
[in]b_mvBus voltage in mV
Postcondition
Output register value is in host byte order
Returns
Register value

Definition at line 88 of file ina3221_internal.h.

◆ reg_val_to_bus_voltage_mv()

static int16_t reg_val_to_bus_voltage_mv ( int16_t  reg_val)
inlinestatic

Convert register value to bus voltage in mV.

Parameters
[in]reg_valRegister value
Precondition
reg_val must be in host byte order
Returns
Shunt voltage in mV

Definition at line 72 of file ina3221_internal.h.

◆ reg_val_to_shunt_voltage_uv()

static int32_t reg_val_to_shunt_voltage_uv ( int16_t  reg_val)
inlinestatic

Convert register value to shunt voltage in uV.

Parameters
[in]reg_valRegister value
Precondition
reg_val must be in host byte order
Returns
Shunt voltage in uV

Definition at line 40 of file ina3221_internal.h.

◆ shunt_voltage_uv_to_reg_val()

static int16_t shunt_voltage_uv_to_reg_val ( int32_t  s_uv)
inlinestatic

Convert shunt voltage in uV to register value.

Parameters
[in]s_uvShunt voltage in uV
Postcondition
Output register value is in host byte order
Returns
Register value

Definition at line 56 of file ina3221_internal.h.

◆ sum_reg_val_to_shunt_voltage_uv()

static int32_t sum_reg_val_to_shunt_voltage_uv ( int16_t  sum_reg_val)
inlinestatic

Convert register value to shunt voltage sum value in mV.

Parameters
[in]sum_reg_valRegister value
Precondition
sum_reg_val must be in host byte order
Returns
Shunt voltage sum value in mV

Definition at line 105 of file ina3221_internal.h.

◆ sum_shunt_voltage_uv_to_reg_val()

static int16_t sum_shunt_voltage_uv_to_reg_val ( int32_t  sum_suv)
inlinestatic

Convert shunt voltage sum value in uV to register value.

Parameters
[in]sum_suvshunt voltage sum value in uV
Postcondition
Output register value is in host byte order
Returns
Register value

Definition at line 121 of file ina3221_internal.h.