no-OS
|
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_i2c.h"
#include "no_os_gpio.h"
Go to the source code of this file.
Classes | |
struct | ltc2992_regmap |
struct | ltc2992_dev |
struct | ltc2992_init_param |
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... | |
#define LTC2992_12B_POWER_VAL_MSK NO_OS_GENMASK(23,0) |
#define LTC2992_12B_SENSE_VAL_MSK NO_OS_GENMASK(15,4) |
#define LTC2992_8B_POWER_VAL_MSK NO_OS_GENMASK(23,8) |
#define LTC2992_8B_SENSE_VAL_MSK NO_OS_GENMASK(15,8) |
#define LTC2992_ALERT_CLR_BIT NO_OS_BIT(7) |
#define LTC2992_DSENSE_ALERT_MSK NO_OS_GENMASK(5,4) |
#define LTC2992_DSENSE_FAULT_MSK NO_OS_GENMASK(5,4) |
#define LTC2992_G1_CTRL_BIT NO_OS_BIT(7) |
#define LTC2992_G1_FAULT_ALERT_MSK 0x03 |
#define LTC2992_G2_CTRL_BIT NO_OS_BIT(6) |
#define LTC2992_G2_FAULT_ALERT_MSK 0x03 |
#define LTC2992_G3_CTRL_BIT NO_OS_BIT(0) |
#define LTC2992_G3_FAULT_ALERT_MSK 0xC0 |
#define LTC2992_G4_ALERT_PIN_BIT NO_OS_BIT(7) |
#define LTC2992_G4_CTRL_BIT NO_OS_BIT(6) |
#define LTC2992_G4_FAULT_ALERT_MSK 0x30 |
#define LTC2992_ISUM_ALERT_MSK NO_OS_GENMASK(3,2) |
#define LTC2992_ISUM_FAULT_MSK NO_OS_GENMASK(3,2) |
#define LTC2992_MEASURE_MODE_MSK NO_OS_GENMASK(6,5) |
#define LTC2992_MFR_ID_VALUE 0x62 |
#define LTC2992_OFFSET_CAL_MSK NO_OS_BIT(7) |
#define LTC2992_PEAK_RST_BIT NO_OS_BIT(3) |
#define LTC2992_POWER_ALERT_MSK NO_OS_GENMASK(7,6) |
#define LTC2992_POWER_FAULT_MSK NO_OS_GENMASK(7,6) |
#define LTC2992_PSUM_ALERT_MSK NO_OS_GENMASK(1,0) |
#define LTC2992_PSUM_FAULT_MSK NO_OS_GENMASK(1,0) |
#define LTC2992_READ_CTRL_BIT NO_OS_BIT(5) |
#define LTC2992_REG_ALERT1 0x02 |
#define LTC2992_REG_ALERT2 0x34 |
#define LTC2992_REG_ALERT3 0x91 |
#define LTC2992_REG_CTRLA 0x00 |
#define LTC2992_REG_CTRLB 0x01 |
#define LTC2992_REG_DSENSE | ( | x | ) | (LTC2992_REG_DSENSE1 + ((x) * 0x32)) |
#define LTC2992_REG_DSENSE1 0x14 |
#define LTC2992_REG_DSENSE1_MAX 0x16 |
#define LTC2992_REG_DSENSE1_MAX_THRESH 0x1A |
#define LTC2992_REG_DSENSE1_MIN 0x18 |
#define LTC2992_REG_DSENSE1_MIN_THRESH 0x1C |
#define LTC2992_REG_DSENSE_FAULT | ( | x | ) | (LTC2992_REG_FAULT1 + ((x) * 0x32)) |
#define LTC2992_REG_DSENSE_MAX | ( | x | ) | (LTC2992_REG_DSENSE1_MAX + ((x) * 0x32)) |
#define LTC2992_REG_DSENSE_MAX_THRESH | ( | x | ) | (LTC2992_REG_DSENSE1_MAX_THRESH + ((x) * 0x32)) |
#define LTC2992_REG_DSENSE_MIN | ( | x | ) | (LTC2992_REG_DSENSE1_MIN + ((x) * 0x32)) |
#define LTC2992_REG_DSENSE_MIN_THRESH | ( | x | ) | (LTC2992_REG_DSENSE1_MIN_THRESH + ((x) * 0x32)) |
#define LTC2992_REG_FAULT1 0x03 |
#define LTC2992_REG_FAULT2 0x35 |
#define LTC2992_REG_FAULT3 0x92 |
#define LTC2992_REG_G1 0x28 |
#define LTC2992_REG_G1_MAX 0x2A |
#define LTC2992_REG_G1_MAX_THRESH 0x2E |
#define LTC2992_REG_G1_MIN 0x2C |
#define LTC2992_REG_G1_MIN_THRESH 0x30 |
#define LTC2992_REG_G2 0x5A |
#define LTC2992_REG_G2_MAX 0x5C |
#define LTC2992_REG_G2_MAX_THRESH 0x60 |
#define LTC2992_REG_G2_MIN 0x5E |
#define LTC2992_REG_G2_MIN_THRESH 0x62 |
#define LTC2992_REG_G3 0x64 |
#define LTC2992_REG_G3_MAX 0x66 |
#define LTC2992_REG_G3_MAX_THRESH 0x6A |
#define LTC2992_REG_G3_MIN 0x68 |
#define LTC2992_REG_G3_MIN_THRESH 0x6C |
#define LTC2992_REG_G4 0x6E |
#define LTC2992_REG_G4_MAX 0x70 |
#define LTC2992_REG_G4_MAX_THRESH 0x74 |
#define LTC2992_REG_G4_MIN 0x72 |
#define LTC2992_REG_G4_MIN_THRESH 0x76 |
#define LTC2992_REG_GPIO4_CTRL 0x97 |
#define LTC2992_REG_GPIO_IO_CTRL 0x96 |
#define LTC2992_REG_GPIO_STATUS 0x95 |
#define LTC2992_REG_ISUM 0x78 |
#define LTC2992_REG_ISUM_MAX 0x7A |
#define LTC2992_REG_ISUM_MAX_THRESH 0x7E |
#define LTC2992_REG_ISUM_MIN 0x7C |
#define LTC2992_REG_ISUM_MIN_THRESH 0x80 |
#define LTC2992_REG_MFR_SPECIAL_ID 0xE7 |
#define LTC2992_REG_NADC 0x04 |
#define LTC2992_REG_POWER | ( | x | ) | (LTC2992_REG_POWER1 + ((x) * 0x32)) |
#define LTC2992_REG_POWER1 0x05 |
#define LTC2992_REG_POWER1_MAX 0x08 |
#define LTC2992_REG_POWER1_MAX_THRESH 0x0E |
#define LTC2992_REG_POWER1_MIN 0x0B |
#define LTC2992_REG_POWER1_MIN_THRESH 0x11 |
#define LTC2992_REG_POWER_FAULT | ( | x | ) | (LTC2992_REG_FAULT1 + ((x) * 0x32)) |
#define LTC2992_REG_POWER_MAX | ( | x | ) | (LTC2992_REG_POWER1_MAX + ((x) * 0x32)) |
#define LTC2992_REG_POWER_MAX_THRESH | ( | x | ) | (LTC2992_REG_POWER1_MAX_THRESH + ((x) * 0x32)) |
#define LTC2992_REG_POWER_MIN | ( | x | ) | (LTC2992_REG_POWER1_MIN + ((x) * 0x32)) |
#define LTC2992_REG_POWER_MIN_THRESH | ( | x | ) | (LTC2992_REG_POWER1_MIN_THRESH + ((x) * 0x32)) |
#define LTC2992_REG_PSUM 0x82 |
#define LTC2992_REG_PSUM_MAX 0x85 |
#define LTC2992_REG_PSUM_MAX_THRESH 0x8B |
#define LTC2992_REG_PSUM_MIN 0x88 |
#define LTC2992_REG_PSUM_MIN_THRESH 0x8E |
#define LTC2992_REG_SENSE | ( | x | ) | (LTC2992_REG_SENSE1 + ((x) * 0x32)) |
#define LTC2992_REG_SENSE1 0x1E |
#define LTC2992_REG_SENSE1_MAX 0x20 |
#define LTC2992_REG_SENSE1_MAX_THRESH 0x24 |
#define LTC2992_REG_SENSE1_MIN 0x22 |
#define LTC2992_REG_SENSE1_MIN_THRESH 0x26 |
#define LTC2992_REG_SENSE_FAULT | ( | x | ) | (LTC2992_REG_FAULT1 + ((x) * 0x32)) |
#define LTC2992_REG_SENSE_MAX | ( | x | ) | (LTC2992_REG_SENSE1_MAX + ((x) * 0x32)) |
#define LTC2992_REG_SENSE_MAX_THRESH | ( | x | ) | (LTC2992_REG_SENSE1_MAX_THRESH + ((x) * 0x32)) |
#define LTC2992_REG_SENSE_MIN | ( | x | ) | (LTC2992_REG_SENSE1_MIN + ((x) * 0x32)) |
#define LTC2992_REG_SENSE_MIN_THRESH | ( | x | ) | (LTC2992_REG_SENSE1_MIN_THRESH + ((x) * 0x32)) |
#define LTC2992_RESET_BIT NO_OS_BIT(0) |
#define LTC2992_RESOLUTION_POS 7 |
#define LTC2992_SENSE_ALERT_MSK NO_OS_GENMASK(3,2) |
#define LTC2992_SENSE_FAULT_MSK NO_OS_GENMASK(3,2) |
#define LTC2992_STUCK_BUS_TIMEOUT_BIT NO_OS_BIT(4) |
#define LTC2992_VSEL_CON_MSK NO_OS_GENMASK(4,3) |
#define LTC2992_VSEL_SNAP_MSK NO_OS_GENMASK(2,0) |
enum ltc2992_adr_state |
enum ltc2992_alert_value |
enum ltc2992_calibration |
enum ltc2992_channel |
enum ltc2992_fault_status |
enum ltc2992_gpio |
enum ltc2992_gpio_output |
enum ltc2992_measure_mode |
enum ltc2992_resolution |
enum ltc2992_sense |
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.
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. |
int ltc2992_clear_fault | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
enum ltc2992_channel | chan | ||
) |
Clear fault status.
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 |
int ltc2992_clear_gpio_fault | ( | struct ltc2992_dev * | dev, |
enum ltc2992_gpio | gpio | ||
) |
Clear GPIO fault status.
dev | - The device structure. |
gpio | - GPIO to clear fault. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
int ltc2992_get_current | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
uint32_t * | current_data | ||
) |
Read bus current along a sense channel.
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. |
int ltc2992_get_fault | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
enum ltc2992_channel | chan, | ||
enum ltc2992_fault_status * | fault | ||
) |
Get fault status.
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 |
int ltc2992_get_gpio_data | ( | struct ltc2992_dev * | dev, |
enum ltc2992_gpio | gpio, | ||
uint32_t * | gpio_data | ||
) |
Get data from a GPIO data converter.
dev | - The device structure. |
gpio | - GPIO to get. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
gpio_data | - Data read |
int ltc2992_get_gpio_fault | ( | struct ltc2992_dev * | dev, |
enum ltc2992_gpio | gpio, | ||
enum ltc2992_fault_status * | fault | ||
) |
Get GPIO fault status.
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 |
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.
dev | - The device structure. |
gpio | - GPIO to read. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
gpio_data | - Data read |
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.
dev | - The device structure. |
gpio | - GPIO to get. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
gpio_data | - Data read |
int ltc2992_get_gpio_state | ( | struct ltc2992_dev * | dev, |
enum ltc2992_gpio | gpio, | ||
uint8_t * | state | ||
) |
Get GPIO state.
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 |
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.
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. |
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.
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. |
int ltc2992_get_power | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
uint32_t * | power_data | ||
) |
Read bus power output in a sense channel.
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. |
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.
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. |
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.
dev | - The device structure. |
chan | - Measured channel. Example: LTC2992_VSHUNT - Read ISUM. LTC2992_POWER - Read PSUM. |
sum_data | - Sum read in microvolts or milliwatts. |
int ltc2992_get_voltage | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
uint32_t * | voltage_data | ||
) |
Read bus voltage in a sense channel.
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. |
int ltc2992_get_vshunt | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
uint32_t * | vshunt_data | ||
) |
Read shunt voltage in a sense channel.
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. |
int ltc2992_init | ( | struct ltc2992_dev ** | device, |
struct ltc2992_init_param * | init_param | ||
) |
Initialize communication peripheral for the device.
device | - The device structure. |
init_param | - Initial parameters. |
int ltc2992_read_reg | ( | struct ltc2992_dev * | dev, |
uint8_t | addr, | ||
uint32_t * | data, | ||
uint8_t | num_bytes | ||
) |
Read raw data from device register.
dev | - The device structure. |
addr | - The register address. |
data | - Register data pointer. |
num_bytes | - Number of bytes to read. |
int ltc2992_remove | ( | struct ltc2992_dev * | dev | ) |
Free resources allocated to the device.
dev | - The device structure. |
int ltc2992_reset_alert_pin | ( | struct ltc2992_dev * | dev | ) |
Reset alert pin (GPI04) status.
dev | - The device structure. |
int ltc2992_set_alert | ( | struct ltc2992_dev * | dev, |
enum ltc2992_sense | sense, | ||
enum ltc2992_channel | chan, | ||
enum ltc2992_alert_value | alert | ||
) |
Enable alert.
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 |
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.
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 |
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.
dev | - The device structure. |
gpio | - GPIO to set. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
thresh_value | - Set threshold. |
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.
dev | - The device structure. |
gpio | - GPIO to set. Example: LTC2992_GPIO1 LTC2992_GPIO2 LTC2992_GPIO3 LTC2992_GPIO4 |
thresh_value | - Set threshold. |
int ltc2992_set_gpio_output | ( | struct ltc2992_dev * | dev, |
enum ltc2992_gpio | gpio, | ||
enum ltc2992_gpio_output | output | ||
) |
Set GPIO output.
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. |
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.
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. |
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.
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. |
int ltc2992_update_reg | ( | struct ltc2992_dev * | dev, |
uint8_t | addr, | ||
uint8_t | mask, | ||
uint8_t | val | ||
) |
Update register value in the device.
dev | - The device structure. |
addr | - The register address. |
mask | - Mask of the bitfield to be updated. |
val | - Value to write. |
int ltc2992_write_reg | ( | struct ltc2992_dev * | dev, |
uint8_t | addr, | ||
uint32_t | value, | ||
uint8_t | num_bytes | ||
) |
Write raw data to device register.
dev | - The device structure. |
addr | - The register address. |
value | - Value to write. |
num_bytes | - Number of bytes to write. |