no-OS
Loading...
Searching...
No Matches
ltc3350.h File Reference
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_i2c.h"
Include dependency graph for ltc3350.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ltc3350_init_param
 Structure holding the parameters for LTC3350 device initialization. More...
 
struct  ltc3350_dev
 LTC3350 Device structure. More...
 

Macros

#define LTC3350_AD_CLR_ALARMS   0x00
 
#define LTC3350_AD_MSK_ALARMS   0x01
 
#define LTC3350_AD_MSK_MON_STATUS   0x02
 
#define LTC3350_AD_CAP_ESR_PER   0x04
 
#define LTC3350_AD_VCAPFB_DAC   0x05
 
#define LTC3350_AD_VSHUNT   0x06
 
#define LTC3350_AD_CAP_UV_LVL   0x07
 
#define LTC3350_AD_CAP_OV_LVL   0x08
 
#define LTC3350_AD_GPI_UV_LVL   0x09
 
#define LTC3350_AD_GPI_OV_LVL   0x0A
 
#define LTC3350_AD_VIN_UV_LVL   0x0B
 
#define LTC3350_AD_VIN_OV_LVL   0x0C
 
#define LTC3350_AD_VCAP_UV_LVL   0x0D
 
#define LTC3350_AD_VCAP_OV_LVL   0x0E
 
#define LTC3350_AD_VOUT_UV_LVL   0x0F
 
#define LTC3350_AD_VOUT_OV_LVL   0x10
 
#define LTC3350_AD_IIN_OC_LVL   0x11
 
#define LTC3350_AD_ICHG_UC_LVL   0x12
 
#define LTC3350_AD_DTEMP_COLD_LVL   0x13
 
#define LTC3350_AD_DTEMP_HOT_LVL   0x14
 
#define LTC3350_AD_ESR_HI_LVL   0x15
 
#define LTC3350_AD_CAP_LO_LVL   0x16
 
#define LTC3350_AD_CTL_REG   0x17
 
#define LTC3350_AD_NUM_CAPS   0x1A
 
#define LTC3350_AD_CHRG_STATUS   0x1B
 
#define LTC3350_AD_MON_STATUS   0x1C
 
#define LTC3350_AD_ALARM_REG   0x1D
 
#define LTC3350_AD_MEAS_CAP   0x1E
 
#define LTC3350_AD_MEAS_ESR   0x1F
 
#define LTC3350_AD_MEAS_VCAP1   0x20
 
#define LTC3350_AD_MEAS_VCAP2   0x21
 
#define LTC3350_AD_MEAS_VCAP3   0x22
 
#define LTC3350_AD_MEAS_VCAP4   0x23
 
#define LTC3350_AD_MEAS_GPI   0x24
 
#define LTC3350_AD_MEAS_VIN   0x25
 
#define LTC3350_AD_MEAS_VCAP   0x26
 
#define LTC3350_AD_MEAS_VOUT   0x27
 
#define LTC3350_AD_MEAS_IIN   0x28
 
#define LTC3350_AD_MEAS_ICHG   0x29
 
#define LTC3350_AD_MEAS_DTEMP   0x2A
 
#define LTC3350_USE_MEASUREMENTS   1
 LTC3350 measurements configuration switch.
 
#define LTC3350_USE_ALARMS   0
 LTC3350 alarms configuration switch.
 

Enumerations

enum  ltc3350_enum_alarms {
  LTC3350_CAP_UV_LVL = 0 ,
  LTC3350_CAP_OV_LVL = 1 ,
  LTC3350_GPI_UV_LVL = 2 ,
  LTC3350_GPI_OV_LVL = 3 ,
  LTC3350_VIN_UV_LVL = 4 ,
  LTC3350_VIN_OV_LVL = 5 ,
  LTC3350_VCAP_UV_LVL = 6 ,
  LTC3350_VCAP_OV_LVL = 7 ,
  LTC3350_VOUT_UV_LVL = 8 ,
  LTC3350_VOUT_OV_LVL = 9 ,
  LTC3350_IIN_OC_LVL = 10 ,
  LTC3350_ICHG_UC_LVL = 11 ,
  LTC3350_DTEMP_COLD_LVL = 12 ,
  LTC3350_DTEMP_HOT_LVL = 13 ,
  LTC3350_ESR_HI_LVL = 14 ,
  LTC3350_CAP_LO_LVL = 15
}
 
enum  ltc3350_enum_alarms_mask {
  LTC3350_CAP_UV_LVL_B_BIT = NO_OS_BIT(0) ,
  LTC3350_CAP_OV_LVL_BIT = NO_OS_BIT(1) ,
  LTC3350_GPI_UV_LVL_BIT = NO_OS_BIT(2) ,
  LTC3350_GPI_OV_LVL_BIT = NO_OS_BIT(3) ,
  LTC3350_VIN_UV_LVL_BIT = NO_OS_BIT(4) ,
  LTC3350_VIN_OV_LVL_BIT = NO_OS_BIT(5) ,
  LTC3350_VCAP_UV_LVL_BIT = NO_OS_BIT(6) ,
  LTC3350_VCAP_OV_LVL_BIT = NO_OS_BIT(7) ,
  LTC3350_VOUT_UV_LVL_BIT = NO_OS_BIT(8) ,
  LTC3350_VOUT_OV_LVL_BIT = NO_OS_BIT(9) ,
  LTC3350_IIN_OC_LVL_BIT = NO_OS_BIT(10) ,
  LTC3350_ICHG_UC_LVL_BIT = NO_OS_BIT(11) ,
  LTC3350_DTEMP_COLD_LVL_BIT = NO_OS_BIT(12) ,
  LTC3350_DTEMP_HOT_LVL_BIT = NO_OS_BIT(13) ,
  LTC3350_ESR_HI_LVL_BIT = NO_OS_BIT(14) ,
  LTC3350_CAP_LO_LVL_BIT = NO_OS_BIT(15)
}
 

Functions

int ltc3350_init (struct ltc3350_dev **device, struct ltc3350_init_param *init_param)
 Initializes the communication peripheral and checks if the LTC3350 part is present.
 
int ltc3350_remove (struct ltc3350_dev *dev)
 Free the resources allocated by ltc3350_init().
 
int ltc3350_read_device_data (struct ltc3350_dev *dev, uint8_t base_address, uint16_t *read_data)
 Reads data from the device (I2C).
 
int ltc3350_write_device_data (struct ltc3350_dev *dev, uint8_t base_address, uint16_t write_data)
 Writes data to the device (I2C)
 

Macro Definition Documentation

◆ LTC3350_AD_ALARM_REG

#define LTC3350_AD_ALARM_REG   0x1D

◆ LTC3350_AD_CAP_ESR_PER

#define LTC3350_AD_CAP_ESR_PER   0x04

◆ LTC3350_AD_CAP_LO_LVL

#define LTC3350_AD_CAP_LO_LVL   0x16

◆ LTC3350_AD_CAP_OV_LVL

#define LTC3350_AD_CAP_OV_LVL   0x08

◆ LTC3350_AD_CAP_UV_LVL

#define LTC3350_AD_CAP_UV_LVL   0x07

◆ LTC3350_AD_CHRG_STATUS

#define LTC3350_AD_CHRG_STATUS   0x1B

◆ LTC3350_AD_CLR_ALARMS

#define LTC3350_AD_CLR_ALARMS   0x00

◆ LTC3350_AD_CTL_REG

#define LTC3350_AD_CTL_REG   0x17

◆ LTC3350_AD_DTEMP_COLD_LVL

#define LTC3350_AD_DTEMP_COLD_LVL   0x13

◆ LTC3350_AD_DTEMP_HOT_LVL

#define LTC3350_AD_DTEMP_HOT_LVL   0x14

◆ LTC3350_AD_ESR_HI_LVL

#define LTC3350_AD_ESR_HI_LVL   0x15

◆ LTC3350_AD_GPI_OV_LVL

#define LTC3350_AD_GPI_OV_LVL   0x0A

◆ LTC3350_AD_GPI_UV_LVL

#define LTC3350_AD_GPI_UV_LVL   0x09

◆ LTC3350_AD_ICHG_UC_LVL

#define LTC3350_AD_ICHG_UC_LVL   0x12

◆ LTC3350_AD_IIN_OC_LVL

#define LTC3350_AD_IIN_OC_LVL   0x11

◆ LTC3350_AD_MEAS_CAP

#define LTC3350_AD_MEAS_CAP   0x1E

◆ LTC3350_AD_MEAS_DTEMP

#define LTC3350_AD_MEAS_DTEMP   0x2A

◆ LTC3350_AD_MEAS_ESR

#define LTC3350_AD_MEAS_ESR   0x1F

◆ LTC3350_AD_MEAS_GPI

#define LTC3350_AD_MEAS_GPI   0x24

◆ LTC3350_AD_MEAS_ICHG

#define LTC3350_AD_MEAS_ICHG   0x29

◆ LTC3350_AD_MEAS_IIN

#define LTC3350_AD_MEAS_IIN   0x28

◆ LTC3350_AD_MEAS_VCAP

#define LTC3350_AD_MEAS_VCAP   0x26

◆ LTC3350_AD_MEAS_VCAP1

#define LTC3350_AD_MEAS_VCAP1   0x20

◆ LTC3350_AD_MEAS_VCAP2

#define LTC3350_AD_MEAS_VCAP2   0x21

◆ LTC3350_AD_MEAS_VCAP3

#define LTC3350_AD_MEAS_VCAP3   0x22

◆ LTC3350_AD_MEAS_VCAP4

#define LTC3350_AD_MEAS_VCAP4   0x23

◆ LTC3350_AD_MEAS_VIN

#define LTC3350_AD_MEAS_VIN   0x25

◆ LTC3350_AD_MEAS_VOUT

#define LTC3350_AD_MEAS_VOUT   0x27

◆ LTC3350_AD_MON_STATUS

#define LTC3350_AD_MON_STATUS   0x1C

◆ LTC3350_AD_MSK_ALARMS

#define LTC3350_AD_MSK_ALARMS   0x01

◆ LTC3350_AD_MSK_MON_STATUS

#define LTC3350_AD_MSK_MON_STATUS   0x02

◆ LTC3350_AD_NUM_CAPS

#define LTC3350_AD_NUM_CAPS   0x1A

◆ LTC3350_AD_VCAP_OV_LVL

#define LTC3350_AD_VCAP_OV_LVL   0x0E

◆ LTC3350_AD_VCAP_UV_LVL

#define LTC3350_AD_VCAP_UV_LVL   0x0D

◆ LTC3350_AD_VCAPFB_DAC

#define LTC3350_AD_VCAPFB_DAC   0x05

◆ LTC3350_AD_VIN_OV_LVL

#define LTC3350_AD_VIN_OV_LVL   0x0C

◆ LTC3350_AD_VIN_UV_LVL

#define LTC3350_AD_VIN_UV_LVL   0x0B

◆ LTC3350_AD_VOUT_OV_LVL

#define LTC3350_AD_VOUT_OV_LVL   0x10

◆ LTC3350_AD_VOUT_UV_LVL

#define LTC3350_AD_VOUT_UV_LVL   0x0F

◆ LTC3350_AD_VSHUNT

#define LTC3350_AD_VSHUNT   0x06

◆ LTC3350_USE_ALARMS

#define LTC3350_USE_ALARMS   0

LTC3350 alarms configuration switch.

If set to TRUE more configurations are available.

Note
The default is FALSE.

◆ LTC3350_USE_MEASUREMENTS

#define LTC3350_USE_MEASUREMENTS   1

LTC3350 measurements configuration switch.

If set to TRUE more configurations are available.

Note
The default is TRUE.

Enumeration Type Documentation

◆ ltc3350_enum_alarms

Enumerator
LTC3350_CAP_UV_LVL 
LTC3350_CAP_OV_LVL 
LTC3350_GPI_UV_LVL 
LTC3350_GPI_OV_LVL 
LTC3350_VIN_UV_LVL 
LTC3350_VIN_OV_LVL 
LTC3350_VCAP_UV_LVL 
LTC3350_VCAP_OV_LVL 
LTC3350_VOUT_UV_LVL 
LTC3350_VOUT_OV_LVL 
LTC3350_IIN_OC_LVL 
LTC3350_ICHG_UC_LVL 
LTC3350_DTEMP_COLD_LVL 
LTC3350_DTEMP_HOT_LVL 
LTC3350_ESR_HI_LVL 
LTC3350_CAP_LO_LVL 

◆ ltc3350_enum_alarms_mask

Enumerator
LTC3350_CAP_UV_LVL_B_BIT 
LTC3350_CAP_OV_LVL_BIT 
LTC3350_GPI_UV_LVL_BIT 
LTC3350_GPI_OV_LVL_BIT 
LTC3350_VIN_UV_LVL_BIT 
LTC3350_VIN_OV_LVL_BIT 
LTC3350_VCAP_UV_LVL_BIT 
LTC3350_VCAP_OV_LVL_BIT 
LTC3350_VOUT_UV_LVL_BIT 
LTC3350_VOUT_OV_LVL_BIT 
LTC3350_IIN_OC_LVL_BIT 
LTC3350_ICHG_UC_LVL_BIT 
LTC3350_DTEMP_COLD_LVL_BIT 
LTC3350_DTEMP_HOT_LVL_BIT 
LTC3350_ESR_HI_LVL_BIT 
LTC3350_CAP_LO_LVL_BIT 

Function Documentation

◆ ltc3350_init()

int ltc3350_init ( struct ltc3350_dev ** device,
struct ltc3350_init_param * init_param )

Initializes the communication peripheral and checks if the LTC3350 part is present.

NO OS Requirements

Initialize the device driver before use.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
ret - Result of the initialization procedure.

◆ ltc3350_read_device_data()

int ltc3350_read_device_data ( struct ltc3350_dev * dev,
uint8_t base_address,
uint16_t * read_data )

Reads data from the device (I2C).

General functions

Read a device register through the I2C interface.

Parameters
dev- The device structure.
base_address- Address of the base register.
read_data- The read data value
Returns
ret - Result of the reading procedure.

◆ ltc3350_remove()

int ltc3350_remove ( struct ltc3350_dev * dev)

Free the resources allocated by ltc3350_init().

Free memory allocated by ltc3350_init().

Parameters
dev- The device structure.
Returns
ret - Result of the remove procedure.

◆ ltc3350_write_device_data()

int ltc3350_write_device_data ( struct ltc3350_dev * dev,
uint8_t base_address,
uint16_t write_data )

Writes data to the device (I2C)

Write a device register through the I2C interface.

Parameters
dev- The device structure.
base_address- Address of the base register.
write_data- The data which is going to be written.
Returns
ret - Result of the writing procedure.