no-OS
Classes | Macros | Enumerations | Functions
ltc2992.h File Reference
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_i2c.h"
#include "no_os_gpio.h"
Include dependency graph for ltc2992.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ltc2992_regmap
 
struct  ltc2992_dev
 
struct  ltc2992_init_param
 

Macros

#define LTC2992_REG_CTRLA   0x00
 
#define LTC2992_REG_CTRLB   0x01
 
#define LTC2992_REG_ALERT1   0x02
 
#define LTC2992_REG_FAULT1   0x03
 
#define LTC2992_REG_NADC   0x04
 
#define LTC2992_REG_POWER1   0x05
 
#define LTC2992_REG_POWER1_MAX   0x08
 
#define LTC2992_REG_POWER1_MIN   0x0B
 
#define LTC2992_REG_POWER1_MAX_THRESH   0x0E
 
#define LTC2992_REG_POWER1_MIN_THRESH   0x11
 
#define LTC2992_REG_DSENSE1   0x14
 
#define LTC2992_REG_DSENSE1_MAX   0x16
 
#define LTC2992_REG_DSENSE1_MIN   0x18
 
#define LTC2992_REG_DSENSE1_MAX_THRESH   0x1A
 
#define LTC2992_REG_DSENSE1_MIN_THRESH   0x1C
 
#define LTC2992_REG_SENSE1   0x1E
 
#define LTC2992_REG_SENSE1_MAX   0x20
 
#define LTC2992_REG_SENSE1_MIN   0x22
 
#define LTC2992_REG_SENSE1_MAX_THRESH   0x24
 
#define LTC2992_REG_SENSE1_MIN_THRESH   0x26
 
#define LTC2992_REG_G1   0x28
 
#define LTC2992_REG_G1_MAX   0x2A
 
#define LTC2992_REG_G1_MIN   0x2C
 
#define LTC2992_REG_G1_MAX_THRESH   0x2E
 
#define LTC2992_REG_G1_MIN_THRESH   0x30
 
#define LTC2992_REG_ALERT2   0x34
 
#define LTC2992_REG_FAULT2   0x35
 
#define LTC2992_REG_G2   0x5A
 
#define LTC2992_REG_G2_MAX   0x5C
 
#define LTC2992_REG_G2_MIN   0x5E
 
#define LTC2992_REG_G2_MAX_THRESH   0x60
 
#define LTC2992_REG_G2_MIN_THRESH   0x62
 
#define LTC2992_REG_G3   0x64
 
#define LTC2992_REG_G3_MAX   0x66
 
#define LTC2992_REG_G3_MIN   0x68
 
#define LTC2992_REG_G3_MAX_THRESH   0x6A
 
#define LTC2992_REG_G3_MIN_THRESH   0x6C
 
#define LTC2992_REG_G4   0x6E
 
#define LTC2992_REG_G4_MAX   0x70
 
#define LTC2992_REG_G4_MIN   0x72
 
#define LTC2992_REG_G4_MAX_THRESH   0x74
 
#define LTC2992_REG_G4_MIN_THRESH   0x76
 
#define LTC2992_REG_ISUM   0x78
 
#define LTC2992_REG_ISUM_MAX   0x7A
 
#define LTC2992_REG_ISUM_MIN   0x7C
 
#define LTC2992_REG_ISUM_MAX_THRESH   0x7E
 
#define LTC2992_REG_ISUM_MIN_THRESH   0x80
 
#define LTC2992_REG_PSUM   0x82
 
#define LTC2992_REG_PSUM_MAX   0x85
 
#define LTC2992_REG_PSUM_MIN   0x88
 
#define LTC2992_REG_PSUM_MAX_THRESH   0x8B
 
#define LTC2992_REG_PSUM_MIN_THRESH   0x8E
 
#define LTC2992_REG_ALERT3   0x91
 
#define LTC2992_REG_FAULT3   0x92
 
#define LTC2992_REG_GPIO_STATUS   0x95
 
#define LTC2992_REG_GPIO_IO_CTRL   0x96
 
#define LTC2992_REG_GPIO4_CTRL   0x97
 
#define LTC2992_REG_MFR_SPECIAL_ID   0xE7
 
#define LTC2992_REG_POWER(x)   (LTC2992_REG_POWER1 + ((x) * 0x32))
 
#define LTC2992_REG_POWER_MAX(x)   (LTC2992_REG_POWER1_MAX + ((x) * 0x32))
 
#define LTC2992_REG_POWER_MIN(x)   (LTC2992_REG_POWER1_MIN + ((x) * 0x32))
 
#define LTC2992_REG_POWER_MAX_THRESH(x)   (LTC2992_REG_POWER1_MAX_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_POWER_MIN_THRESH(x)   (LTC2992_REG_POWER1_MIN_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE(x)   (LTC2992_REG_DSENSE1 + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE_MAX(x)   (LTC2992_REG_DSENSE1_MAX + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE_MIN(x)   (LTC2992_REG_DSENSE1_MIN + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE_MAX_THRESH(x)   (LTC2992_REG_DSENSE1_MAX_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE_MIN_THRESH(x)   (LTC2992_REG_DSENSE1_MIN_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_SENSE(x)   (LTC2992_REG_SENSE1 + ((x) * 0x32))
 
#define LTC2992_REG_SENSE_MAX(x)   (LTC2992_REG_SENSE1_MAX + ((x) * 0x32))
 
#define LTC2992_REG_SENSE_MIN(x)   (LTC2992_REG_SENSE1_MIN + ((x) * 0x32))
 
#define LTC2992_REG_SENSE_MAX_THRESH(x)   (LTC2992_REG_SENSE1_MAX_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_SENSE_MIN_THRESH(x)   (LTC2992_REG_SENSE1_MIN_THRESH + ((x) * 0x32))
 
#define LTC2992_REG_POWER_FAULT(x)   (LTC2992_REG_FAULT1 + ((x) * 0x32))
 
#define LTC2992_REG_SENSE_FAULT(x)   (LTC2992_REG_FAULT1 + ((x) * 0x32))
 
#define LTC2992_REG_DSENSE_FAULT(x)   (LTC2992_REG_FAULT1 + ((x) * 0x32))
 
#define LTC2992_OFFSET_CAL_MSK   NO_OS_BIT(7)
 
#define LTC2992_MEASURE_MODE_MSK   NO_OS_GENMASK(6,5)
 
#define LTC2992_VSEL_CON_MSK   NO_OS_GENMASK(4,3)
 
#define LTC2992_VSEL_SNAP_MSK   NO_OS_GENMASK(2,0)
 
#define LTC2992_POWER_ALERT_MSK   NO_OS_GENMASK(7,6)
 
#define LTC2992_DSENSE_ALERT_MSK   NO_OS_GENMASK(5,4)
 
#define LTC2992_SENSE_ALERT_MSK   NO_OS_GENMASK(3,2)
 
#define LTC2992_ISUM_ALERT_MSK   NO_OS_GENMASK(3,2)
 
#define LTC2992_PSUM_ALERT_MSK   NO_OS_GENMASK(1,0)
 
#define LTC2992_POWER_FAULT_MSK   NO_OS_GENMASK(7,6)
 
#define LTC2992_DSENSE_FAULT_MSK   NO_OS_GENMASK(5,4)
 
#define LTC2992_SENSE_FAULT_MSK   NO_OS_GENMASK(3,2)
 
#define LTC2992_ISUM_FAULT_MSK   NO_OS_GENMASK(3,2)
 
#define LTC2992_PSUM_FAULT_MSK   NO_OS_GENMASK(1,0)
 
#define LTC2992_12B_SENSE_VAL_MSK   NO_OS_GENMASK(15,4)
 
#define LTC2992_12B_POWER_VAL_MSK   NO_OS_GENMASK(23,0)
 
#define LTC2992_8B_SENSE_VAL_MSK   NO_OS_GENMASK(15,8)
 
#define LTC2992_8B_POWER_VAL_MSK   NO_OS_GENMASK(23,8)
 
#define LTC2992_G1_FAULT_ALERT_MSK   0x03
 
#define LTC2992_G2_FAULT_ALERT_MSK   0x03
 
#define LTC2992_G3_FAULT_ALERT_MSK   0xC0
 
#define LTC2992_G4_FAULT_ALERT_MSK   0x30
 
#define LTC2992_ALERT_CLR_BIT   NO_OS_BIT(7)
 
#define LTC2992_READ_CTRL_BIT   NO_OS_BIT(5)
 
#define LTC2992_STUCK_BUS_TIMEOUT_BIT   NO_OS_BIT(4)
 
#define LTC2992_PEAK_RST_BIT   NO_OS_BIT(3)
 
#define LTC2992_RESET_BIT   NO_OS_BIT(0)
 
#define LTC2992_G4_ALERT_PIN_BIT   NO_OS_BIT(7)
 
#define LTC2992_G1_CTRL_BIT   NO_OS_BIT(7)
 
#define LTC2992_G2_CTRL_BIT   NO_OS_BIT(6)
 
#define LTC2992_G3_CTRL_BIT   NO_OS_BIT(0)
 
#define LTC2992_G4_CTRL_BIT   NO_OS_BIT(6)
 
#define LTC2992_MFR_ID_VALUE   0x62
 
#define LTC2992_RESOLUTION_POS   7
 

Enumerations

enum  ltc2992_adr_state {
  LTC2992_ADR_HIGH,
  LTC2992_ADR_LOW,
  LTC2992_ADR_NC
}
 
enum  ltc2992_gpio {
  LTC2992_GPIO1,
  LTC2992_GPIO2,
  LTC2992_GPIO3,
  LTC2992_GPIO4
}
 
enum  ltc2992_gpio_output {
  LTC2992_GPIO_OUTPUT_HI_Z,
  LTC2992_GPIO_OUTPUT_PULL_LOW
}
 
enum  ltc2992_sense {
  LTC2992_SENSE1,
  LTC2992_SENSE2
}
 
enum  ltc2992_channel {
  LTC2992_VOLTAGE,
  LTC2992_VSHUNT,
  LTC2992_CURRENT,
  LTC2992_POWER,
  LTC2992_ISUM,
  LTC2992_PSUM
}
 
enum  ltc2992_calibration {
  LTC2992_CALIBRATE_ALWAYS,
  LTC2992_CALIBRATE_ON_DEMAND
}
 
enum  ltc2992_measure_mode {
  LTC2992_MODE_CONTINUOUS,
  LTC2992_MODE_SNAPSHOT,
  LTC2992_MODE_SINGLE_CYCLE,
  LTC2992_MODE_SHUTDOWN
}
 
enum  ltc2992_continuous_vsel {
  LTC2992_CONT_VSEL_ALL,
  LTC2992_CONT_VSEL_SENSE_ONLY,
  LTC2992_CONT_VSEL_GPIO1_GPIO2,
  LTC2992_CONT_VSEL_GPIOS_ONLY
}
 
enum  ltc2992_snapshot_vsel {
  LTC2992_SNAP_VSEL_SENSE1,
  LTC2992_SNAP_VSEL_SENSE2,
  LTC2992_SNAP_VSEL_GPIO1,
  LTC2992_SNAP_VSEL_GPIO2,
  LTC2992_SNAP_VSEL_GPIO3,
  LTC2992_SNAP_VSEL_GPIO4,
  LTC2992_SNAP_VSEL_SENSE1_SENSE2,
  LTC2992_SNAP_VSEL_GPIO1_GPIO2
}
 
enum  ltc2992_resolution {
  LTC2992_RESOLUTION_12_BIT,
  LTC2992_RESOLUTION_8_BIT
}
 
enum  ltc2992_alert_value {
  LTC2992_ALERT_DISABLE_ALL,
  LTC2992_ALERT_ENABLE_UV,
  LTC2992_ALERT_ENABLE_OV,
  LTC2992_ALERT_ENABLE_ALL
}
 
enum  ltc2992_fault_status {
  LTC2992_FAULT_NONE,
  LTC2992_FAULT_UNDERVALUE,
  LTC2992_FAULT_OVERVALUE,
  LTC2992_FAULT_ALL
}
 

Functions

int ltc2992_addr_gen (struct ltc2992_init_param *init_param, enum ltc2992_adr_state a0, enum ltc2992_adr_state a1)
 Generate device I2C address based on ADR pin states. More...
 
int ltc2992_init (struct ltc2992_dev **device, struct ltc2992_init_param *init_param)
 Initialize communication peripheral for the device. More...
 
int ltc2992_remove (struct ltc2992_dev *dev)
 Free resources allocated to the device. More...
 
int ltc2992_read_reg (struct ltc2992_dev *dev, uint8_t addr, uint32_t *data, uint8_t num_bytes)
 Read raw data from device register. More...
 
int ltc2992_write_reg (struct ltc2992_dev *dev, uint8_t addr, uint32_t value, uint8_t num_bytes)
 Write raw data to device register. More...
 
int ltc2992_update_reg (struct ltc2992_dev *dev, uint8_t addr, uint8_t mask, uint8_t val)
 Update register value in the device. More...
 
int ltc2992_get_voltage (struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *voltage_data)
 Read bus voltage in a sense channel. More...
 
int ltc2992_get_vshunt (struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *vshunt_data)
 Read shunt voltage in a sense channel. More...
 
int ltc2992_get_current (struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *current_data)
 Read bus current along a sense channel. More...
 
int ltc2992_get_power (struct ltc2992_dev *dev, enum ltc2992_sense sense, uint32_t *power_data)
 Read bus power output in a sense channel. More...
 
int ltc2992_get_sum (struct ltc2992_dev *dev, enum ltc2992_channel chan, uint32_t *sum_data)
 Read the shunt voltage sum or power sum of both sense channels. More...
 
int ltc2992_get_sense_data (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
 Read sense data at a SENSE channel. More...
 
int ltc2992_get_max_data (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
 Read maximum sense data at a SENSE channel. More...
 
int ltc2992_get_min_data (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t *data)
 Read minimum sense data at a SENSE channel. More...
 
int ltc2992_set_max_thresh (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
 Set upper thresh level for alert at a SENSE channel. More...
 
int ltc2992_set_min_thresh (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, uint32_t thresh_value)
 Set lower thresh level for alert at a SENSE channel. More...
 
int ltc2992_set_alert (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_alert_value alert)
 Enable alert. More...
 
int ltc2992_get_fault (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan, enum ltc2992_fault_status *fault)
 Get fault status. More...
 
int ltc2992_clear_fault (struct ltc2992_dev *dev, enum ltc2992_sense sense, enum ltc2992_channel chan)
 Clear fault status. More...
 
int ltc2992_get_gpio_data (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
 Get data from a GPIO data converter. More...
 
int ltc2992_get_gpio_max_data (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
 Get maximum data from a GPIO data converter. More...
 
int ltc2992_get_gpio_min_data (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t *gpio_data)
 Get minimum data from a GPIO data converter. More...
 
int ltc2992_set_gpio_max_thresh (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
 Set upper threshold level in a GPIO. More...
 
int ltc2992_set_gpio_min_thresh (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint32_t thresh_value)
 Set lower threshold level in a GPIO. More...
 
int ltc2992_set_gpio_alert (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_alert_value alert_value)
 Enable alert when GPIO level reaches beyond threshold limit. More...
 
int ltc2992_get_gpio_fault (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_fault_status *fault)
 Get GPIO fault status. More...
 
int ltc2992_clear_gpio_fault (struct ltc2992_dev *dev, enum ltc2992_gpio gpio)
 Clear GPIO fault status. More...
 
int ltc2992_reset_alert_pin (struct ltc2992_dev *dev)
 Reset alert pin (GPI04) status. More...
 
int ltc2992_get_gpio_state (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, uint8_t *state)
 Get GPIO state. More...
 
int ltc2992_set_gpio_output (struct ltc2992_dev *dev, enum ltc2992_gpio gpio, enum ltc2992_gpio_output output)
 Set GPIO output. More...
 

Macro Definition Documentation

◆ LTC2992_12B_POWER_VAL_MSK

#define LTC2992_12B_POWER_VAL_MSK   NO_OS_GENMASK(23,0)

◆ LTC2992_12B_SENSE_VAL_MSK

#define LTC2992_12B_SENSE_VAL_MSK   NO_OS_GENMASK(15,4)

◆ LTC2992_8B_POWER_VAL_MSK

#define LTC2992_8B_POWER_VAL_MSK   NO_OS_GENMASK(23,8)

◆ LTC2992_8B_SENSE_VAL_MSK

#define LTC2992_8B_SENSE_VAL_MSK   NO_OS_GENMASK(15,8)

◆ LTC2992_ALERT_CLR_BIT

#define LTC2992_ALERT_CLR_BIT   NO_OS_BIT(7)

◆ LTC2992_DSENSE_ALERT_MSK

#define LTC2992_DSENSE_ALERT_MSK   NO_OS_GENMASK(5,4)

◆ LTC2992_DSENSE_FAULT_MSK

#define LTC2992_DSENSE_FAULT_MSK   NO_OS_GENMASK(5,4)

◆ LTC2992_G1_CTRL_BIT

#define LTC2992_G1_CTRL_BIT   NO_OS_BIT(7)

◆ LTC2992_G1_FAULT_ALERT_MSK

#define LTC2992_G1_FAULT_ALERT_MSK   0x03

◆ LTC2992_G2_CTRL_BIT

#define LTC2992_G2_CTRL_BIT   NO_OS_BIT(6)

◆ LTC2992_G2_FAULT_ALERT_MSK

#define LTC2992_G2_FAULT_ALERT_MSK   0x03

◆ LTC2992_G3_CTRL_BIT

#define LTC2992_G3_CTRL_BIT   NO_OS_BIT(0)

◆ LTC2992_G3_FAULT_ALERT_MSK

#define LTC2992_G3_FAULT_ALERT_MSK   0xC0

◆ LTC2992_G4_ALERT_PIN_BIT

#define LTC2992_G4_ALERT_PIN_BIT   NO_OS_BIT(7)

◆ LTC2992_G4_CTRL_BIT

#define LTC2992_G4_CTRL_BIT   NO_OS_BIT(6)

◆ LTC2992_G4_FAULT_ALERT_MSK

#define LTC2992_G4_FAULT_ALERT_MSK   0x30

◆ LTC2992_ISUM_ALERT_MSK

#define LTC2992_ISUM_ALERT_MSK   NO_OS_GENMASK(3,2)

◆ LTC2992_ISUM_FAULT_MSK

#define LTC2992_ISUM_FAULT_MSK   NO_OS_GENMASK(3,2)

◆ LTC2992_MEASURE_MODE_MSK

#define LTC2992_MEASURE_MODE_MSK   NO_OS_GENMASK(6,5)

◆ LTC2992_MFR_ID_VALUE

#define LTC2992_MFR_ID_VALUE   0x62

◆ LTC2992_OFFSET_CAL_MSK

#define LTC2992_OFFSET_CAL_MSK   NO_OS_BIT(7)

◆ LTC2992_PEAK_RST_BIT

#define LTC2992_PEAK_RST_BIT   NO_OS_BIT(3)

◆ LTC2992_POWER_ALERT_MSK

#define LTC2992_POWER_ALERT_MSK   NO_OS_GENMASK(7,6)

◆ LTC2992_POWER_FAULT_MSK

#define LTC2992_POWER_FAULT_MSK   NO_OS_GENMASK(7,6)

◆ LTC2992_PSUM_ALERT_MSK

#define LTC2992_PSUM_ALERT_MSK   NO_OS_GENMASK(1,0)

◆ LTC2992_PSUM_FAULT_MSK

#define LTC2992_PSUM_FAULT_MSK   NO_OS_GENMASK(1,0)

◆ LTC2992_READ_CTRL_BIT

#define LTC2992_READ_CTRL_BIT   NO_OS_BIT(5)

◆ LTC2992_REG_ALERT1

#define LTC2992_REG_ALERT1   0x02

◆ LTC2992_REG_ALERT2

#define LTC2992_REG_ALERT2   0x34

◆ LTC2992_REG_ALERT3

#define LTC2992_REG_ALERT3   0x91

◆ LTC2992_REG_CTRLA

#define LTC2992_REG_CTRLA   0x00

◆ LTC2992_REG_CTRLB

#define LTC2992_REG_CTRLB   0x01

◆ LTC2992_REG_DSENSE

#define LTC2992_REG_DSENSE (   x)    (LTC2992_REG_DSENSE1 + ((x) * 0x32))

◆ LTC2992_REG_DSENSE1

#define LTC2992_REG_DSENSE1   0x14

◆ LTC2992_REG_DSENSE1_MAX

#define LTC2992_REG_DSENSE1_MAX   0x16

◆ LTC2992_REG_DSENSE1_MAX_THRESH

#define LTC2992_REG_DSENSE1_MAX_THRESH   0x1A

◆ LTC2992_REG_DSENSE1_MIN

#define LTC2992_REG_DSENSE1_MIN   0x18

◆ LTC2992_REG_DSENSE1_MIN_THRESH

#define LTC2992_REG_DSENSE1_MIN_THRESH   0x1C

◆ LTC2992_REG_DSENSE_FAULT

#define LTC2992_REG_DSENSE_FAULT (   x)    (LTC2992_REG_FAULT1 + ((x) * 0x32))

◆ LTC2992_REG_DSENSE_MAX

#define LTC2992_REG_DSENSE_MAX (   x)    (LTC2992_REG_DSENSE1_MAX + ((x) * 0x32))

◆ LTC2992_REG_DSENSE_MAX_THRESH

#define LTC2992_REG_DSENSE_MAX_THRESH (   x)    (LTC2992_REG_DSENSE1_MAX_THRESH + ((x) * 0x32))

◆ LTC2992_REG_DSENSE_MIN

#define LTC2992_REG_DSENSE_MIN (   x)    (LTC2992_REG_DSENSE1_MIN + ((x) * 0x32))

◆ LTC2992_REG_DSENSE_MIN_THRESH

#define LTC2992_REG_DSENSE_MIN_THRESH (   x)    (LTC2992_REG_DSENSE1_MIN_THRESH + ((x) * 0x32))

◆ LTC2992_REG_FAULT1

#define LTC2992_REG_FAULT1   0x03

◆ LTC2992_REG_FAULT2

#define LTC2992_REG_FAULT2   0x35

◆ LTC2992_REG_FAULT3

#define LTC2992_REG_FAULT3   0x92

◆ LTC2992_REG_G1

#define LTC2992_REG_G1   0x28

◆ LTC2992_REG_G1_MAX

#define LTC2992_REG_G1_MAX   0x2A

◆ LTC2992_REG_G1_MAX_THRESH

#define LTC2992_REG_G1_MAX_THRESH   0x2E

◆ LTC2992_REG_G1_MIN

#define LTC2992_REG_G1_MIN   0x2C

◆ LTC2992_REG_G1_MIN_THRESH

#define LTC2992_REG_G1_MIN_THRESH   0x30

◆ LTC2992_REG_G2

#define LTC2992_REG_G2   0x5A

◆ LTC2992_REG_G2_MAX

#define LTC2992_REG_G2_MAX   0x5C

◆ LTC2992_REG_G2_MAX_THRESH

#define LTC2992_REG_G2_MAX_THRESH   0x60

◆ LTC2992_REG_G2_MIN

#define LTC2992_REG_G2_MIN   0x5E

◆ LTC2992_REG_G2_MIN_THRESH

#define LTC2992_REG_G2_MIN_THRESH   0x62

◆ LTC2992_REG_G3

#define LTC2992_REG_G3   0x64

◆ LTC2992_REG_G3_MAX

#define LTC2992_REG_G3_MAX   0x66

◆ LTC2992_REG_G3_MAX_THRESH

#define LTC2992_REG_G3_MAX_THRESH   0x6A

◆ LTC2992_REG_G3_MIN

#define LTC2992_REG_G3_MIN   0x68

◆ LTC2992_REG_G3_MIN_THRESH

#define LTC2992_REG_G3_MIN_THRESH   0x6C

◆ LTC2992_REG_G4

#define LTC2992_REG_G4   0x6E

◆ LTC2992_REG_G4_MAX

#define LTC2992_REG_G4_MAX   0x70

◆ LTC2992_REG_G4_MAX_THRESH

#define LTC2992_REG_G4_MAX_THRESH   0x74

◆ LTC2992_REG_G4_MIN

#define LTC2992_REG_G4_MIN   0x72

◆ LTC2992_REG_G4_MIN_THRESH

#define LTC2992_REG_G4_MIN_THRESH   0x76

◆ LTC2992_REG_GPIO4_CTRL

#define LTC2992_REG_GPIO4_CTRL   0x97

◆ LTC2992_REG_GPIO_IO_CTRL

#define LTC2992_REG_GPIO_IO_CTRL   0x96

◆ LTC2992_REG_GPIO_STATUS

#define LTC2992_REG_GPIO_STATUS   0x95

◆ LTC2992_REG_ISUM

#define LTC2992_REG_ISUM   0x78

◆ LTC2992_REG_ISUM_MAX

#define LTC2992_REG_ISUM_MAX   0x7A

◆ LTC2992_REG_ISUM_MAX_THRESH

#define LTC2992_REG_ISUM_MAX_THRESH   0x7E

◆ LTC2992_REG_ISUM_MIN

#define LTC2992_REG_ISUM_MIN   0x7C

◆ LTC2992_REG_ISUM_MIN_THRESH

#define LTC2992_REG_ISUM_MIN_THRESH   0x80

◆ LTC2992_REG_MFR_SPECIAL_ID

#define LTC2992_REG_MFR_SPECIAL_ID   0xE7

◆ LTC2992_REG_NADC

#define LTC2992_REG_NADC   0x04

◆ LTC2992_REG_POWER

#define LTC2992_REG_POWER (   x)    (LTC2992_REG_POWER1 + ((x) * 0x32))

◆ LTC2992_REG_POWER1

#define LTC2992_REG_POWER1   0x05

◆ LTC2992_REG_POWER1_MAX

#define LTC2992_REG_POWER1_MAX   0x08

◆ LTC2992_REG_POWER1_MAX_THRESH

#define LTC2992_REG_POWER1_MAX_THRESH   0x0E

◆ LTC2992_REG_POWER1_MIN

#define LTC2992_REG_POWER1_MIN   0x0B

◆ LTC2992_REG_POWER1_MIN_THRESH

#define LTC2992_REG_POWER1_MIN_THRESH   0x11

◆ LTC2992_REG_POWER_FAULT

#define LTC2992_REG_POWER_FAULT (   x)    (LTC2992_REG_FAULT1 + ((x) * 0x32))

◆ LTC2992_REG_POWER_MAX

#define LTC2992_REG_POWER_MAX (   x)    (LTC2992_REG_POWER1_MAX + ((x) * 0x32))

◆ LTC2992_REG_POWER_MAX_THRESH

#define LTC2992_REG_POWER_MAX_THRESH (   x)    (LTC2992_REG_POWER1_MAX_THRESH + ((x) * 0x32))

◆ LTC2992_REG_POWER_MIN

#define LTC2992_REG_POWER_MIN (   x)    (LTC2992_REG_POWER1_MIN + ((x) * 0x32))

◆ LTC2992_REG_POWER_MIN_THRESH

#define LTC2992_REG_POWER_MIN_THRESH (   x)    (LTC2992_REG_POWER1_MIN_THRESH + ((x) * 0x32))

◆ LTC2992_REG_PSUM

#define LTC2992_REG_PSUM   0x82

◆ LTC2992_REG_PSUM_MAX

#define LTC2992_REG_PSUM_MAX   0x85

◆ LTC2992_REG_PSUM_MAX_THRESH

#define LTC2992_REG_PSUM_MAX_THRESH   0x8B

◆ LTC2992_REG_PSUM_MIN

#define LTC2992_REG_PSUM_MIN   0x88

◆ LTC2992_REG_PSUM_MIN_THRESH

#define LTC2992_REG_PSUM_MIN_THRESH   0x8E

◆ LTC2992_REG_SENSE

#define LTC2992_REG_SENSE (   x)    (LTC2992_REG_SENSE1 + ((x) * 0x32))

◆ LTC2992_REG_SENSE1

#define LTC2992_REG_SENSE1   0x1E

◆ LTC2992_REG_SENSE1_MAX

#define LTC2992_REG_SENSE1_MAX   0x20

◆ LTC2992_REG_SENSE1_MAX_THRESH

#define LTC2992_REG_SENSE1_MAX_THRESH   0x24

◆ LTC2992_REG_SENSE1_MIN

#define LTC2992_REG_SENSE1_MIN   0x22

◆ LTC2992_REG_SENSE1_MIN_THRESH

#define LTC2992_REG_SENSE1_MIN_THRESH   0x26

◆ LTC2992_REG_SENSE_FAULT

#define LTC2992_REG_SENSE_FAULT (   x)    (LTC2992_REG_FAULT1 + ((x) * 0x32))

◆ LTC2992_REG_SENSE_MAX

#define LTC2992_REG_SENSE_MAX (   x)    (LTC2992_REG_SENSE1_MAX + ((x) * 0x32))

◆ LTC2992_REG_SENSE_MAX_THRESH

#define LTC2992_REG_SENSE_MAX_THRESH (   x)    (LTC2992_REG_SENSE1_MAX_THRESH + ((x) * 0x32))

◆ LTC2992_REG_SENSE_MIN

#define LTC2992_REG_SENSE_MIN (   x)    (LTC2992_REG_SENSE1_MIN + ((x) * 0x32))

◆ LTC2992_REG_SENSE_MIN_THRESH

#define LTC2992_REG_SENSE_MIN_THRESH (   x)    (LTC2992_REG_SENSE1_MIN_THRESH + ((x) * 0x32))

◆ LTC2992_RESET_BIT

#define LTC2992_RESET_BIT   NO_OS_BIT(0)

◆ LTC2992_RESOLUTION_POS

#define LTC2992_RESOLUTION_POS   7

◆ LTC2992_SENSE_ALERT_MSK

#define LTC2992_SENSE_ALERT_MSK   NO_OS_GENMASK(3,2)

◆ LTC2992_SENSE_FAULT_MSK

#define LTC2992_SENSE_FAULT_MSK   NO_OS_GENMASK(3,2)

◆ LTC2992_STUCK_BUS_TIMEOUT_BIT

#define LTC2992_STUCK_BUS_TIMEOUT_BIT   NO_OS_BIT(4)

◆ LTC2992_VSEL_CON_MSK

#define LTC2992_VSEL_CON_MSK   NO_OS_GENMASK(4,3)

◆ LTC2992_VSEL_SNAP_MSK

#define LTC2992_VSEL_SNAP_MSK   NO_OS_GENMASK(2,0)

Enumeration Type Documentation

◆ ltc2992_adr_state

Enumerator
LTC2992_ADR_HIGH 
LTC2992_ADR_LOW 
LTC2992_ADR_NC 

◆ ltc2992_alert_value

Enumerator
LTC2992_ALERT_DISABLE_ALL 
LTC2992_ALERT_ENABLE_UV 
LTC2992_ALERT_ENABLE_OV 
LTC2992_ALERT_ENABLE_ALL 

◆ ltc2992_calibration

Enumerator
LTC2992_CALIBRATE_ALWAYS 
LTC2992_CALIBRATE_ON_DEMAND 

◆ ltc2992_channel

Enumerator
LTC2992_VOLTAGE 
LTC2992_VSHUNT 
LTC2992_CURRENT 
LTC2992_POWER 
LTC2992_ISUM 
LTC2992_PSUM 

◆ ltc2992_continuous_vsel

Enumerator
LTC2992_CONT_VSEL_ALL 
LTC2992_CONT_VSEL_SENSE_ONLY 
LTC2992_CONT_VSEL_GPIO1_GPIO2 
LTC2992_CONT_VSEL_GPIOS_ONLY 

◆ ltc2992_fault_status

Enumerator
LTC2992_FAULT_NONE 
LTC2992_FAULT_UNDERVALUE 
LTC2992_FAULT_OVERVALUE 
LTC2992_FAULT_ALL 

◆ ltc2992_gpio

Enumerator
LTC2992_GPIO1 
LTC2992_GPIO2 
LTC2992_GPIO3 
LTC2992_GPIO4 

◆ ltc2992_gpio_output

Enumerator
LTC2992_GPIO_OUTPUT_HI_Z 
LTC2992_GPIO_OUTPUT_PULL_LOW 

◆ ltc2992_measure_mode

Enumerator
LTC2992_MODE_CONTINUOUS 
LTC2992_MODE_SNAPSHOT 
LTC2992_MODE_SINGLE_CYCLE 
LTC2992_MODE_SHUTDOWN 

◆ ltc2992_resolution

Enumerator
LTC2992_RESOLUTION_12_BIT 
LTC2992_RESOLUTION_8_BIT 

◆ ltc2992_sense

Enumerator
LTC2992_SENSE1 
LTC2992_SENSE2 

◆ ltc2992_snapshot_vsel

Enumerator
LTC2992_SNAP_VSEL_SENSE1 
LTC2992_SNAP_VSEL_SENSE2 
LTC2992_SNAP_VSEL_GPIO1 
LTC2992_SNAP_VSEL_GPIO2 
LTC2992_SNAP_VSEL_GPIO3 
LTC2992_SNAP_VSEL_GPIO4 
LTC2992_SNAP_VSEL_SENSE1_SENSE2 
LTC2992_SNAP_VSEL_GPIO1_GPIO2 

Function Documentation

◆ ltc2992_addr_gen()

int ltc2992_addr_gen ( struct ltc2992_init_param init_param,
enum ltc2992_adr_state  a0,
enum ltc2992_adr_state  a1 
)

Generate device I2C address based on ADR pin states.

Parameters
init_param- Initialization parameter.
a0- ADR0 state. Example: LTC2992_ADR_HIGH - ADR at high logic level. LTC2992_ADR_LOW - ADR at ground.. LTC2992_ADR_NC - ADR not connected.
a1- ADR1 state. Example: LTC2992_ADR_HIGH - ADR at high logic level. LTC2992_ADR_LOW - ADR at ground. LTC2992_ADR_NC - ADR not connected.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_clear_fault()

int ltc2992_clear_fault ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan 
)

Clear fault status.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 LTC2992_SENSE2
chan- Measured data channel. Example: LTC2992_VOLTAGE LTC2992_VSHUNT LTC2992_CURRENT LTC2992_POWER LTC2992_ISUM LTC2992_PSUM
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_clear_gpio_fault()

int ltc2992_clear_gpio_fault ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio 
)

Clear GPIO fault status.

Parameters
dev- The device structure.
gpio- GPIO to clear fault. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_current()

int ltc2992_get_current ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
uint32_t *  current_data 
)

Read bus current along a sense channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
current_data- Current read in milliamperes.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_get_fault()

int ltc2992_get_fault ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
enum ltc2992_fault_status fault 
)

Get fault status.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 LTC2992_SENSE2
chan- Measured data channel. Example: LTC2992_VOLTAGE LTC2992_VSHUNT LTC2992_CURRENT LTC2992_POWER LTC2992_ISUM LTC2992_PSUM
fault- Alert value to set. Example: LTC2992_FAULT_NONE - No fault event LTC2992_FAULT_UNDERVALUE - Undervalue fault occurred LTC2992_FAULT_OVERVALUE - Overvalue fault occurred
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_gpio_data()

int ltc2992_get_gpio_data ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint32_t *  gpio_data 
)

Get data from a GPIO data converter.

Parameters
dev- The device structure.
gpio- GPIO to get. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
gpio_data- Data read
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_gpio_fault()

int ltc2992_get_gpio_fault ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
enum ltc2992_fault_status fault 
)

Get GPIO fault status.

Parameters
dev- The device structure.
gpio- GPIO to read fault status. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
fault- Alert value to set. Example: LTC2992_FAULT_NONE - No fault event LTC2992_FAULT_UNDERVALUE - Undervalue fault occurred LTC2992_FAULT_OVERVALUE - Overvalue fault occurred
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_gpio_max_data()

int ltc2992_get_gpio_max_data ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint32_t *  gpio_data 
)

Get maximum data from a GPIO data converter.

Parameters
dev- The device structure.
gpio- GPIO to read. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
gpio_data- Data read
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_gpio_min_data()

int ltc2992_get_gpio_min_data ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint32_t *  gpio_data 
)

Get minimum data from a GPIO data converter.

Parameters
dev- The device structure.
gpio- GPIO to get. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
gpio_data- Data read
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_gpio_state()

int ltc2992_get_gpio_state ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint8_t *  state 
)

Get GPIO state.

Parameters
dev- The device structure.
gpio- GPIO to read state. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
state- GPIO state Example: 0 - GPIO is logic low 1 - GPIO is logic high
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_max_data()

int ltc2992_get_max_data ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
uint32_t *  data 
)

Read maximum sense data at a SENSE channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
chan- Measured data channel. Example: LTC2992_VOLTAGE - Read bus voltage in millivolts. LTC2992_VSHUNT - Read shunt voltage in microvolts. LTC2992_CURRENT - Read current in milliamperes. LTC2992_POWER - Read power in milliwatts. LTC2992_ISUM - Read ISUM in microvolts. LTC2992_PSUM - Read PSUM in milliwatts.
data- Read max data.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_min_data()

int ltc2992_get_min_data ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
uint32_t *  data 
)

Read minimum sense data at a SENSE channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
chan- Measured data channel. Example: LTC2992_VOLTAGE - Read bus voltage in millivolts. LTC2992_VSHUNT - Read shunt voltage in microvolts. LTC2992_CURRENT - Read current in milliamperes. LTC2992_POWER - Read power in milliwatts. LTC2992_ISUM - Read ISUM in microvolts. LTC2992_PSUM - Read PSUM in milliwatts.
data- Read min data.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_power()

int ltc2992_get_power ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
uint32_t *  power_data 
)

Read bus power output in a sense channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
power_data- Power read in milliwatts.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_get_sense_data()

int ltc2992_get_sense_data ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
uint32_t *  data 
)

Read sense data at a SENSE channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
chan- Measured data channel. Example: LTC2992_VOLTAGE - Read bus voltage in millivolts. LTC2992_VSHUNT - Read shunt voltage in microvolts. LTC2992_CURRENT - Read current in milliamperes. LTC2992_POWER - Read power in milliwatts. LTC2992_ISUM - Read ISUM in microvolts. LTC2992_PSUM - Read PSUM in milliwatts.
data- Read data.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_get_sum()

int ltc2992_get_sum ( struct ltc2992_dev dev,
enum ltc2992_channel  chan,
uint32_t *  sum_data 
)

Read the shunt voltage sum or power sum of both sense channels.

Parameters
dev- The device structure.
chan- Measured channel. Example: LTC2992_VSHUNT - Read ISUM. LTC2992_POWER - Read PSUM.
sum_data- Sum read in microvolts or milliwatts.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_get_voltage()

int ltc2992_get_voltage ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
uint32_t *  voltage_data 
)

Read bus voltage in a sense channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
voltage_data- Voltage read in millivolts.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_get_vshunt()

int ltc2992_get_vshunt ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
uint32_t *  vshunt_data 
)

Read shunt voltage in a sense channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 - Read in SENSE1 channel. LTC2992_SENSE2 - Read in SENSE2 channel.
vshunt_data- Voltage read in microvolts.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_init()

int ltc2992_init ( struct ltc2992_dev **  device,
struct ltc2992_init_param init_param 
)

Initialize communication peripheral for the device.

Parameters
device- The device structure.
init_param- Initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_read_reg()

int ltc2992_read_reg ( struct ltc2992_dev dev,
uint8_t  addr,
uint32_t *  data,
uint8_t  num_bytes 
)

Read raw data from device register.

Parameters
dev- The device structure.
addr- The register address.
data- Register data pointer.
num_bytes- Number of bytes to read.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_remove()

int ltc2992_remove ( struct ltc2992_dev dev)

Free resources allocated to the device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_reset_alert_pin()

int ltc2992_reset_alert_pin ( struct ltc2992_dev dev)

Reset alert pin (GPI04) status.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_alert()

int ltc2992_set_alert ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
enum ltc2992_alert_value  alert 
)

Enable alert.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 LTC2992_SENSE2
chan- Measured data channel. Example: LTC2992_VOLTAGE LTC2992_VSHUNT LTC2992_CURRENT LTC2992_POWER LTC2992_ISUM LTC2992_PSUM
alert- Alert value to set. Example: LTC2992_ALERT_DISABLE_ALL - Disable alert LTC2992_ALERT_ENABLE_UV - Enable undervalue alert LTC2992_ALERT_ENABLE_OV - Enable overvalue alert LTC2992_ALERT_ENABLE_ALL - Enable undervalue and overvalue alert
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_gpio_alert()

int ltc2992_set_gpio_alert ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
enum ltc2992_alert_value  alert_value 
)

Enable alert when GPIO level reaches beyond threshold limit.

Parameters
dev- The device structure.
gpio- GPIO to enable alert. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
alert_value- Alert value to set. Example: LTC2992_ALERT_DISABLE_ALL - Disable alert LTC2992_ALERT_ENABLE_UV - Enable undervalue alert LTC2992_ALERT_ENABLE_OV - Enable overvalue alert LTC2992_ALERT_ENABLE_ALL - Enable undervalue and overvalue alert
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_gpio_max_thresh()

int ltc2992_set_gpio_max_thresh ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint32_t  thresh_value 
)

Set upper threshold level in a GPIO.

Parameters
dev- The device structure.
gpio- GPIO to set. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
thresh_value- Set threshold.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_gpio_min_thresh()

int ltc2992_set_gpio_min_thresh ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
uint32_t  thresh_value 
)

Set lower threshold level in a GPIO.

Parameters
dev- The device structure.
gpio- GPIO to set. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
thresh_value- Set threshold.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_gpio_output()

int ltc2992_set_gpio_output ( struct ltc2992_dev dev,
enum ltc2992_gpio  gpio,
enum ltc2992_gpio_output  output 
)

Set GPIO output.

Parameters
dev- The device structure.
gpio- GPIO to set. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4
output- GPIO output to set Example: LTC2992_GPIO_OUTPUT_HI_Z - Output high impedance. LTC2992_GPIO_OUTPUT_PULL_LOW - Pull output low.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_max_thresh()

int ltc2992_set_max_thresh ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
uint32_t  thresh_value 
)

Set upper thresh level for alert at a SENSE channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 LTC2992_SENSE2
chan- Measured data channel. Example: LTC2992_VOLTAGE - Bus voltage thresh in millivolts. LTC2992_VSHUNT - Shunt voltage thresh in microvolts. LTC2992_CURRENT - Current thresh in milliamperes. LTC2992_POWER - Power thresh in milliwatts. LTC2992_ISUM - ISUM thresh in microvolts. LTC2992_PSUM - PSUM thresh in milliwatts.
thresh_value- Thresh level to set.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_set_min_thresh()

int ltc2992_set_min_thresh ( struct ltc2992_dev dev,
enum ltc2992_sense  sense,
enum ltc2992_channel  chan,
uint32_t  thresh_value 
)

Set lower thresh level for alert at a SENSE channel.

Parameters
dev- The device structure.
sense- Sense channel. Example: LTC2992_SENSE1 LTC2992_SENSE2
chan- Measured data channel. Example: LTC2992_VOLTAGE - Bus voltage thresh in millivolts. LTC2992_VSHUNT - Shunt voltage thresh in microvolts. LTC2992_CURRENT - Current thresh in milliamperes. LTC2992_POWER - Power thresh in milliwatts. LTC2992_ISUM - ISUM thresh in microvolts. LTC2992_PSUM - PSUM thresh in milliwatts.
thresh_value- Thresh level to set.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2992_update_reg()

int ltc2992_update_reg ( struct ltc2992_dev dev,
uint8_t  addr,
uint8_t  mask,
uint8_t  val 
)

Update register value in the device.

Parameters
dev- The device structure.
addr- The register address.
mask- Mask of the bitfield to be updated.
val- Value to write.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2992_write_reg()

int ltc2992_write_reg ( struct ltc2992_dev dev,
uint8_t  addr,
uint32_t  value,
uint8_t  num_bytes 
)

Write raw data to device register.

Parameters
dev- The device structure.
addr- The register address.
value- Value to write.
num_bytes- Number of bytes to write.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: