no-OS
Loading...
Searching...
No Matches
ltc7871.h File Reference

Header file for the LTC7871 Driver. More...

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_units.h"
#include "no_os_util.h"
Include dependency graph for ltc7871.h:

Classes

struct  ltc7871_init_param
 Initialization parameter for the LTC7871 device. More...
 
struct  ltc7871_dev
 Device descriptor for ltc7871. More...
 

Macros

#define SET   1
 
#define CLEAR   0
 
#define LTC7871_CRC_POLYNOMIAL   0x07
 
#define LTC7871_FRAME_SIZE   3
 
#define LTC7871_NUM_REGISTERS   8
 
#define LTC7871_SPI_READ   0x01
 
#define LTC7871_SPI_WRITE   0x00
 
#define LTC7871_STATUS_ACQUISITION_COMMAND   0xF0
 
#define LTC7871_DATA_WRITE_COMMAND   0xF2
 
#define LTC7871_DATA_READ_COMMAND   0xF4
 
#define LTC7871_STATUS_ACQUISITION_COMMAND_SIZE   4
 
#define LTC7871_DATA_WRITE_COMMAND_SIZE   8
 
#define LTC7871_DATA_READ_COMMAND_SIZE   8
 
#define LTC7871_MFR_FAULT   0x01
 
#define LTC7871_MFR_OC_FAULT   0x02
 
#define LTC7871_MFR_NOC_FAULT   0x03
 
#define LTC7871_MFR_STATUS   0x04
 
#define LTC7871_MFR_CONFIG1   0x05
 
#define LTC7871_MFR_CONFIG2   0x06
 
#define LTC7871_CHIP_CTRL   0x07
 
#define LTC7871_IDAC_VLOW   0x08
 
#define LTC7871_IDAC_VHIGH   0x09
 
#define LTC7871_IDAC_SETCUR   0x0A
 
#define LTC7871_MFR_SSFM   0x0B
 
#define LTC7871_MFR_FAULT_MASK   NO_OS_GENMASK(6, 0)
 
#define LTC7871_MFR_OC_FAULT_MASK   NO_OS_GENMASK(6, 0)
 
#define LTC7871_MFR_NOC_FAULT_MASK   NO_OS_GENMASK(6, 0)
 
#define LTC7871_MFR_STATUS_MASK   NO_OS_GENMASK(2, 0)
 
#define LTC7871_MFR_CONFIG1_MASK   NO_OS_GENMASK(5, 0)
 
#define LTC7871_MFR_CONFIG2_MASK   NO_OS_GENMASK(4, 0)
 
#define LTC7871_MFR_CHIP_CTRL_MASK   NO_OS_GENMASK(2, 0)
 
#define LTC7871_MFR_SSFM_MASK   NO_OS_GENMASK(8, 0)
 
#define LTC7871_VLOW_OV_MASK   NO_OS_BIT(6)
 
#define LTC7871_VHIGH_OV_MASK   NO_OS_BIT(5)
 
#define LTC7871_VHIGH_UV_MASK   NO_OS_BIT(4)
 
#define LTC7871_DRVCC_UV_MASK   NO_OS_BIT(3)
 
#define LTC7871_V5_UV_MASK   NO_OS_BIT(2)
 
#define LTC7871_VREF_BAD_MASK   NO_OS_BIT(1)
 
#define LTC7871_OVER_TEMP_MASK   NO_OS_BIT(0)
 
#define LTC7871_OC_FAULT_6_MASK   NO_OS_BIT(5)
 
#define LTC7871_OC_FAULT_5_MASK   NO_OS_BIT(4)
 
#define LTC7871_OC_FAULT_4_MASK   NO_OS_BIT(3)
 
#define LTC7871_OC_FAULT_3_MASK   NO_OS_BIT(2)
 
#define LTC7871_OC_FAULT_2_MASK   NO_OS_BIT(1)
 
#define LTC7871_OC_FAULT_1_MASK   NO_OS_BIT(0)
 
#define LTC7871_NOC_FAULT_6_MASK   NO_OS_BIT(5)
 
#define LTC7871_NOC_FAULT_5_MASK   NO_OS_BIT(4)
 
#define LTC7871_NOC_FAULT_4_MASK   NO_OS_BIT(3)
 
#define LTC7871_NOC_FAULT_3_MASK   NO_OS_BIT(2)
 
#define LTC7871_NOC_FAULT_2_MASK   NO_OS_BIT(1)
 
#define LTC7871_NOC_FAULT_1_MASK   NO_OS_BIT(0)
 
#define LTC7871_SS_DONE_MASK   NO_OS_BIT(2)
 
#define LTC7871_MAX_CURRENT_MASK   NO_OS_BIT(1)
 
#define LTC7871_PGOOD_MASK   NO_OS_BIT(0)
 
#define LTC7871_SERCUR_WARNING_MASK   NO_OS_BIT(5)
 
#define LTC7871_DRVCC_SET_MASK   NO_OS_GENMASK(4, 3)
 
#define LTC7871_ILIM_SET_MASK   NO_OS_GENMASK(2, 0)
 
#define LTC7871_BURST_MASK   NO_OS_BIT(4)
 
#define LTC7871_DCM_MASK   NO_OS_BIT(3)
 
#define LTC7871_HIZ_MASK   NO_OS_BIT(2)
 
#define LTC7871_SPRD_MASK   NO_OS_BIT(1)
 
#define LTC7871_BUCK_BOOST_MASK   NO_OS_BIT(0)
 
#define LTC7871_CML_MASK   NO_OS_BIT(2)
 
#define LTC7871_RESET_MASK   NO_OS_BIT(1)
 
#define LTC7871_WP_MASK   NO_OS_BIT(0)
 
#define LTC7871_MFR_IDAC_VLOW_MASK   NO_OS_GENMASK(6, 0)
 
#define LTC7871_MFR_IDAC_VHIGH_MASK   NO_OS_GENMASK(6, 0)
 
#define LTC7871_MFR_IDAC_SETCUR_MASK   NO_OS_GENMASK(4, 0)
 
#define LTC7871_MFR_SSFM_FSR_MASK   NO_OS_GENMASK(4, 3)
 
#define LTC7871_MFR_SSFM_MSF_MASK   NO_OS_GENMASK(2, 0)
 

Enumerations

enum  ltc7871_ssfm_fsr {
  LTC7871_SSFM_FSR_12 ,
  LTC7871_SSFM_FSR_15 ,
  LTC7871_SSFM_FSR_10 ,
  LTC7871_SSFM_FSR_8
}
 Frequency Spread Range control bits. More...
 
enum  ltc7871_ssfm_msf {
  LTC7871_SSFM_MSF_512 ,
  LTC7871_SSFM_MSF_1024 ,
  LTC7871_SSFM_MSF_2048 ,
  LTC7871_SSFM_MSF_4096 ,
  LTC7871_SSFM_MSF_256 ,
  LTC7871_SSFM_MSF_128 ,
  LTC7871_SSFM_MSF_64 ,
  LTC7871_SSFM_MSF_512U
}
 Modulation Signal Frequency control bits. More...
 
enum  ltc7871_ctrl_wp {
  LTC7871_CTRL_WP_ENABLE ,
  LTC7871_CTRL_WP_DISABLE
}
 Frequency Spread Range control bits. More...
 

Functions

uint8_t ltc7871_get_pec_byte (uint8_t *data, uint8_t len)
 Compute the PEC.
 
int ltc7871_reg_read (struct ltc7871_dev *dev, uint8_t reg, uint8_t *data)
 Register Read.
 
int ltc7871_reg_write (struct ltc7871_dev *dev, uint8_t reg, uint8_t data)
 Register Write.
 
int ltc7871_reg_write_mask (struct ltc7871_dev *dev, uint8_t address, uint8_t mask, uint8_t data)
 Write to LTC7871 device register with mask.
 
int ltc7871_get_mfr_fault (struct ltc7871_dev *dev, uint8_t status, bool *value)
 gets mfr fault bit.
 
int ltc7871_get_mfr_oc_fault (struct ltc7871_dev *dev, uint8_t status, bool *value)
 gets status for overcurrent condition status.
 
int ltc7871_get_mfr_noc_fault (struct ltc7871_dev *dev, uint8_t status, bool *value)
 gets status for negative overcurrent fault condition status.
 
int ltc7871_get_mfr_config1_setting (struct ltc7871_dev *dev, uint8_t config, uint8_t *value)
 gets configuration of the controller programmed by the pins.
 
int ltc7871_get_mfr_config2_setting (struct ltc7871_dev *dev, uint8_t config, uint8_t *value)
 gets configuration of the controller programmed by the pins.
 
int ltc7871_get_mfr_status (struct ltc7871_dev *dev, uint8_t status_mask, bool *status)
 gets status.
 
int ltc7871_reset (struct ltc7871_dev *dev)
 Reset all R/W registers.
 
int ltc7871_clear_pec_fault (struct ltc7871_dev *dev)
 Clear PEC fault bit.
 
int ltc7871_read_pec_fault (struct ltc7871_dev *dev, bool *value)
 Read PEC fault bit.
 
int ltc7871_set_write_protect (struct ltc7871_dev *dev, bool value)
 set write protect bit.
 
int ltc7871_is_write_protected (struct ltc7871_dev *dev, bool *value)
 Read Write Protect bit for IDAC registers, and MFR_SSFM register.
 
int ltc7871_get_mfr_idac_vlow (struct ltc7871_dev *dev, int8_t *value)
 get the current DAC value to program the VLOW voltage.
 
int ltc7871_set_mfr_idac_vlow (struct ltc7871_dev *dev, int8_t value)
 stores the current DAC value to program the VLOW voltage.
 
int ltc7871_get_mfr_idac_vhigh (struct ltc7871_dev *dev, int8_t *value)
 get the current DAC value to program the VHIGH voltage.
 
int ltc7871_set_mfr_idac_vhigh (struct ltc7871_dev *dev, int8_t value)
 stores the current DAC value to program the VHIGH voltage.
 
int ltc7871_get_mfr_idac_setcur (struct ltc7871_dev *dev, int8_t *value)
 get the current DAC value to program the sourcing current of the SETCUR pin.
 
int ltc7871_set_mfr_idac_setcur (struct ltc7871_dev *dev, int8_t value)
 stores the current DAC value to program the sourcing current of the SETCUR pin.
 
int ltc7871_get_freq_spread_range (struct ltc7871_dev *dev, uint8_t *value)
 Get Frequency Spread Range.
 
int ltc7871_set_freq_spread_range (struct ltc7871_dev *dev, enum ltc7871_ssfm_fsr value)
 Set Frequency Spread Range.
 
int ltc7871_get_mod_freq (struct ltc7871_dev *dev, uint8_t *value)
 Get Modulation Signal Frequency.
 
int ltc7871_set_mod_freq (struct ltc7871_dev *dev, enum ltc7871_ssfm_msf value)
 Set Modulation Signal Frequency.
 
int ltc7871_set_pwmen_pin (struct ltc7871_dev *dev, uint8_t value)
 Set PWMEN pin of LTC7871 device.
 
int ltc7871_get_pwmen_pin (struct ltc7871_dev *dev, uint8_t *value)
 Get EN pin of LTC7871 device.
 
int ltc7871_init (struct ltc7871_dev **device, struct ltc7871_init_param *init_param)
 Initialize the LTC7871 device.
 
int ltc7871_remove (struct ltc7871_dev *dev)
 Free the resources allocated by the LT7871_init()
 

Detailed Description

Header file for the LTC7871 Driver.

Author
Aldrin Abacan (aldri.nosp@m.n.ab.nosp@m.acan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

Copyright 2024(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ CLEAR

#define CLEAR   0

◆ LTC7871_BUCK_BOOST_MASK

#define LTC7871_BUCK_BOOST_MASK   NO_OS_BIT(0)

◆ LTC7871_BURST_MASK

#define LTC7871_BURST_MASK   NO_OS_BIT(4)

◆ LTC7871_CHIP_CTRL

#define LTC7871_CHIP_CTRL   0x07

◆ LTC7871_CML_MASK

#define LTC7871_CML_MASK   NO_OS_BIT(2)

◆ LTC7871_CRC_POLYNOMIAL

#define LTC7871_CRC_POLYNOMIAL   0x07

◆ LTC7871_DATA_READ_COMMAND

#define LTC7871_DATA_READ_COMMAND   0xF4

◆ LTC7871_DATA_READ_COMMAND_SIZE

#define LTC7871_DATA_READ_COMMAND_SIZE   8

◆ LTC7871_DATA_WRITE_COMMAND

#define LTC7871_DATA_WRITE_COMMAND   0xF2

◆ LTC7871_DATA_WRITE_COMMAND_SIZE

#define LTC7871_DATA_WRITE_COMMAND_SIZE   8

◆ LTC7871_DCM_MASK

#define LTC7871_DCM_MASK   NO_OS_BIT(3)

◆ LTC7871_DRVCC_SET_MASK

#define LTC7871_DRVCC_SET_MASK   NO_OS_GENMASK(4, 3)

◆ LTC7871_DRVCC_UV_MASK

#define LTC7871_DRVCC_UV_MASK   NO_OS_BIT(3)

◆ LTC7871_FRAME_SIZE

#define LTC7871_FRAME_SIZE   3

◆ LTC7871_HIZ_MASK

#define LTC7871_HIZ_MASK   NO_OS_BIT(2)

◆ LTC7871_IDAC_SETCUR

#define LTC7871_IDAC_SETCUR   0x0A

◆ LTC7871_IDAC_VHIGH

#define LTC7871_IDAC_VHIGH   0x09

◆ LTC7871_IDAC_VLOW

#define LTC7871_IDAC_VLOW   0x08

◆ LTC7871_ILIM_SET_MASK

#define LTC7871_ILIM_SET_MASK   NO_OS_GENMASK(2, 0)

◆ LTC7871_MAX_CURRENT_MASK

#define LTC7871_MAX_CURRENT_MASK   NO_OS_BIT(1)

◆ LTC7871_MFR_CHIP_CTRL_MASK

#define LTC7871_MFR_CHIP_CTRL_MASK   NO_OS_GENMASK(2, 0)

◆ LTC7871_MFR_CONFIG1

#define LTC7871_MFR_CONFIG1   0x05

◆ LTC7871_MFR_CONFIG1_MASK

#define LTC7871_MFR_CONFIG1_MASK   NO_OS_GENMASK(5, 0)

◆ LTC7871_MFR_CONFIG2

#define LTC7871_MFR_CONFIG2   0x06

◆ LTC7871_MFR_CONFIG2_MASK

#define LTC7871_MFR_CONFIG2_MASK   NO_OS_GENMASK(4, 0)

◆ LTC7871_MFR_FAULT

#define LTC7871_MFR_FAULT   0x01

◆ LTC7871_MFR_FAULT_MASK

#define LTC7871_MFR_FAULT_MASK   NO_OS_GENMASK(6, 0)

◆ LTC7871_MFR_IDAC_SETCUR_MASK

#define LTC7871_MFR_IDAC_SETCUR_MASK   NO_OS_GENMASK(4, 0)

◆ LTC7871_MFR_IDAC_VHIGH_MASK

#define LTC7871_MFR_IDAC_VHIGH_MASK   NO_OS_GENMASK(6, 0)

◆ LTC7871_MFR_IDAC_VLOW_MASK

#define LTC7871_MFR_IDAC_VLOW_MASK   NO_OS_GENMASK(6, 0)

◆ LTC7871_MFR_NOC_FAULT

#define LTC7871_MFR_NOC_FAULT   0x03

◆ LTC7871_MFR_NOC_FAULT_MASK

#define LTC7871_MFR_NOC_FAULT_MASK   NO_OS_GENMASK(6, 0)

◆ LTC7871_MFR_OC_FAULT

#define LTC7871_MFR_OC_FAULT   0x02

◆ LTC7871_MFR_OC_FAULT_MASK

#define LTC7871_MFR_OC_FAULT_MASK   NO_OS_GENMASK(6, 0)

◆ LTC7871_MFR_SSFM

#define LTC7871_MFR_SSFM   0x0B

◆ LTC7871_MFR_SSFM_FSR_MASK

#define LTC7871_MFR_SSFM_FSR_MASK   NO_OS_GENMASK(4, 3)

◆ LTC7871_MFR_SSFM_MASK

#define LTC7871_MFR_SSFM_MASK   NO_OS_GENMASK(8, 0)

◆ LTC7871_MFR_SSFM_MSF_MASK

#define LTC7871_MFR_SSFM_MSF_MASK   NO_OS_GENMASK(2, 0)

◆ LTC7871_MFR_STATUS

#define LTC7871_MFR_STATUS   0x04

◆ LTC7871_MFR_STATUS_MASK

#define LTC7871_MFR_STATUS_MASK   NO_OS_GENMASK(2, 0)

◆ LTC7871_NOC_FAULT_1_MASK

#define LTC7871_NOC_FAULT_1_MASK   NO_OS_BIT(0)

◆ LTC7871_NOC_FAULT_2_MASK

#define LTC7871_NOC_FAULT_2_MASK   NO_OS_BIT(1)

◆ LTC7871_NOC_FAULT_3_MASK

#define LTC7871_NOC_FAULT_3_MASK   NO_OS_BIT(2)

◆ LTC7871_NOC_FAULT_4_MASK

#define LTC7871_NOC_FAULT_4_MASK   NO_OS_BIT(3)

◆ LTC7871_NOC_FAULT_5_MASK

#define LTC7871_NOC_FAULT_5_MASK   NO_OS_BIT(4)

◆ LTC7871_NOC_FAULT_6_MASK

#define LTC7871_NOC_FAULT_6_MASK   NO_OS_BIT(5)

◆ LTC7871_NUM_REGISTERS

#define LTC7871_NUM_REGISTERS   8

◆ LTC7871_OC_FAULT_1_MASK

#define LTC7871_OC_FAULT_1_MASK   NO_OS_BIT(0)

◆ LTC7871_OC_FAULT_2_MASK

#define LTC7871_OC_FAULT_2_MASK   NO_OS_BIT(1)

◆ LTC7871_OC_FAULT_3_MASK

#define LTC7871_OC_FAULT_3_MASK   NO_OS_BIT(2)

◆ LTC7871_OC_FAULT_4_MASK

#define LTC7871_OC_FAULT_4_MASK   NO_OS_BIT(3)

◆ LTC7871_OC_FAULT_5_MASK

#define LTC7871_OC_FAULT_5_MASK   NO_OS_BIT(4)

◆ LTC7871_OC_FAULT_6_MASK

#define LTC7871_OC_FAULT_6_MASK   NO_OS_BIT(5)

◆ LTC7871_OVER_TEMP_MASK

#define LTC7871_OVER_TEMP_MASK   NO_OS_BIT(0)

◆ LTC7871_PGOOD_MASK

#define LTC7871_PGOOD_MASK   NO_OS_BIT(0)

◆ LTC7871_RESET_MASK

#define LTC7871_RESET_MASK   NO_OS_BIT(1)

◆ LTC7871_SERCUR_WARNING_MASK

#define LTC7871_SERCUR_WARNING_MASK   NO_OS_BIT(5)

◆ LTC7871_SPI_READ

#define LTC7871_SPI_READ   0x01

◆ LTC7871_SPI_WRITE

#define LTC7871_SPI_WRITE   0x00

◆ LTC7871_SPRD_MASK

#define LTC7871_SPRD_MASK   NO_OS_BIT(1)

◆ LTC7871_SS_DONE_MASK

#define LTC7871_SS_DONE_MASK   NO_OS_BIT(2)

◆ LTC7871_STATUS_ACQUISITION_COMMAND

#define LTC7871_STATUS_ACQUISITION_COMMAND   0xF0

◆ LTC7871_STATUS_ACQUISITION_COMMAND_SIZE

#define LTC7871_STATUS_ACQUISITION_COMMAND_SIZE   4

◆ LTC7871_V5_UV_MASK

#define LTC7871_V5_UV_MASK   NO_OS_BIT(2)

◆ LTC7871_VHIGH_OV_MASK

#define LTC7871_VHIGH_OV_MASK   NO_OS_BIT(5)

◆ LTC7871_VHIGH_UV_MASK

#define LTC7871_VHIGH_UV_MASK   NO_OS_BIT(4)

◆ LTC7871_VLOW_OV_MASK

#define LTC7871_VLOW_OV_MASK   NO_OS_BIT(6)

◆ LTC7871_VREF_BAD_MASK

#define LTC7871_VREF_BAD_MASK   NO_OS_BIT(1)

◆ LTC7871_WP_MASK

#define LTC7871_WP_MASK   NO_OS_BIT(0)

◆ SET

#define SET   1

Enumeration Type Documentation

◆ ltc7871_ctrl_wp

Frequency Spread Range control bits.

Enumerator
LTC7871_CTRL_WP_ENABLE 

enable write protect

LTC7871_CTRL_WP_DISABLE 

disable write protect

◆ ltc7871_ssfm_fsr

Frequency Spread Range control bits.

Enumerator
LTC7871_SSFM_FSR_12 

+/-12%

LTC7871_SSFM_FSR_15 

+/-15%

LTC7871_SSFM_FSR_10 

+/-10%

LTC7871_SSFM_FSR_8 

+/-8%

◆ ltc7871_ssfm_msf

Modulation Signal Frequency control bits.

Enumerator
LTC7871_SSFM_MSF_512 

Controller Switching Frequency/512

LTC7871_SSFM_MSF_1024 

Controller Switching Frequency/1024

LTC7871_SSFM_MSF_2048 

Controller Switching Frequency/2048

LTC7871_SSFM_MSF_4096 

Controller Switching Frequency/4096

LTC7871_SSFM_MSF_256 

Controller Switching Frequency/256

LTC7871_SSFM_MSF_128 

Controller Switching Frequency/128

LTC7871_SSFM_MSF_64 

Controller Switching Frequency/64

LTC7871_SSFM_MSF_512U 

Controller Switching Frequency/512

Function Documentation

◆ ltc7871_clear_pec_fault()

int ltc7871_clear_pec_fault ( struct ltc7871_dev * dev)

Clear PEC fault bit.

Clear PEC fault bit

Parameters
dev- LTC7871 device descriptor
Returns
0 in case of success, negative error code otherwise

◆ ltc7871_get_freq_spread_range()

int ltc7871_get_freq_spread_range ( struct ltc7871_dev * dev,
uint8_t * value )

Get Frequency Spread Range.

Get Frequency Spread Range.

Parameters
dev- LTC7871 device descriptor
value- Frequencey Spread range
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_config1_setting()

int ltc7871_get_mfr_config1_setting ( struct ltc7871_dev * dev,
uint8_t config,
uint8_t * value )

gets configuration of the controller programmed by the pins.

gets configuration of the controller programmed by the pins.

Parameters
dev- LTC7871 device descriptor
config- configuration to get.
value- status value to be returned.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_config2_setting()

int ltc7871_get_mfr_config2_setting ( struct ltc7871_dev * dev,
uint8_t config,
uint8_t * value )

gets configuration of the controller programmed by the pins.

gets configuration of the controller programmed by the pins.

Parameters
dev- LTC7871 device descriptor
config- configuration to get.
value- status value to be returned.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_fault()

int ltc7871_get_mfr_fault ( struct ltc7871_dev * dev,
uint8_t status,
bool * value )

gets mfr fault bit.

Read Most critical fault status

Parameters
dev- LTC7871 device descriptor
status- m askfault status to get.
value- status value to be returned.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_idac_setcur()

int ltc7871_get_mfr_idac_setcur ( struct ltc7871_dev * dev,
int8_t * value )

get the current DAC value to program the sourcing current of the SETCUR pin.

get the current DAC value to program the sourcing current of the SETCUR pin.

Parameters
dev- LTC7871 device descriptor
value- DAC Value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_idac_vhigh()

int ltc7871_get_mfr_idac_vhigh ( struct ltc7871_dev * dev,
int8_t * value )

get the current DAC value to program the VHIGH voltage.

get the current DAC value to program the VHIGH voltage.

Parameters
dev- LTC7871 device descriptor
value- DAC Value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_idac_vlow()

int ltc7871_get_mfr_idac_vlow ( struct ltc7871_dev * dev,
int8_t * value )

get the current DAC value to program the VLOW voltage.

get the current DAC value to program the VLOW voltage.

Parameters
dev- LTC7871 device descriptor
value- DAC Value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_noc_fault()

int ltc7871_get_mfr_noc_fault ( struct ltc7871_dev * dev,
uint8_t status,
bool * value )

gets status for negative overcurrent fault condition status.

Read negative overcurrent condition status

Parameters
dev- LTC7871 device descriptor
status- mask fault status to get. (0-5)
value- status value to be returned.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_oc_fault()

int ltc7871_get_mfr_oc_fault ( struct ltc7871_dev * dev,
uint8_t status,
bool * value )

gets status for overcurrent condition status.

Read overcurrent condition status

Parameters
dev- LTC7871 device descriptor
status- mask fault status to get. (0-5)
value- status value to be returned.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mfr_status()

int ltc7871_get_mfr_status ( struct ltc7871_dev * dev,
uint8_t status_mask,
bool * status )

gets status.

gets status

Parameters
dev- LTC7871 device descriptor
status_mask- status mask to be acquire.
status- status value.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_mod_freq()

int ltc7871_get_mod_freq ( struct ltc7871_dev * dev,
uint8_t * value )

Get Modulation Signal Frequency.

Get Modulation Signal Frequency

Parameters
dev- LTC7871 device descriptor
value- Modulation signal frequency value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_get_pec_byte()

uint8_t ltc7871_get_pec_byte ( uint8_t * data,
uint8_t len )

Compute the PEC.

Register Read

Parameters
data- Data buffer.
len- Buffer length.
Returns
8-bit CRC value

◆ ltc7871_get_pwmen_pin()

int ltc7871_get_pwmen_pin ( struct ltc7871_dev * dev,
uint8_t * value )

Get EN pin of LTC7871 device.

Get PWMEN pin

Parameters
dev- LTC7871 device descriptor
value- EN pin value.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_init()

int ltc7871_init ( struct ltc7871_dev ** device,
struct ltc7871_init_param * init_param )

Initialize the LTC7871 device.

Initialize the LTC7871 device descriptor.

Parameters
device- LTC7871 device descriptor
init_param- Initialization parameter containing information about the LTC7871 device to be initialized.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_is_write_protected()

int ltc7871_is_write_protected ( struct ltc7871_dev * dev,
bool * value )

Read Write Protect bit for IDAC registers, and MFR_SSFM register.

Read Write Protect bit for IDAC registers, and MFR_SSFM register

Parameters
dev- LTC7871 device descriptor
value- value of write protect bit
Returns
0 in case of success, negative error code otherwise

◆ ltc7871_read_pec_fault()

int ltc7871_read_pec_fault ( struct ltc7871_dev * dev,
bool * value )

Read PEC fault bit.

Read PEC fault bit

Parameters
dev- LTC7871 device descriptor
value- fault bit value.
Returns
0 in case of success, negative error code otherwise

◆ ltc7871_reg_read()

int ltc7871_reg_read ( struct ltc7871_dev * dev,
uint8_t reg,
uint8_t * data )

Register Read.

Register Read

Parameters
dev- The device structure
reg- The register value
data- The data read from the device.
Returns
0 in case of success, negative code otherwise

◆ ltc7871_reg_write()

int ltc7871_reg_write ( struct ltc7871_dev * dev,
uint8_t reg,
uint8_t data )

Register Write.

Register Write

Parameters
dev- The device structure
reg- The register value
data- The data written to the device
Returns
0 in case of success, negative code otherwise

◆ ltc7871_reg_write_mask()

int ltc7871_reg_write_mask ( struct ltc7871_dev * dev,
uint8_t address,
uint8_t mask,
uint8_t data )

Write to LTC7871 device register with mask.

Register mask Write

Parameters
dev- LTC7871 device descriptor
address- Register address.
mask- Mask to be applied.
data- Data to be written.
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_remove()

int ltc7871_remove ( struct ltc7871_dev * dev)

Free the resources allocated by the LT7871_init()

Remove resources allocated by the init function.

Parameters
dev- LTC7871 device descriptor
Returns
- 0 in case of succes, negative error code otherwise

◆ ltc7871_reset()

int ltc7871_reset ( struct ltc7871_dev * dev)

Reset all R/W registers.

Reset all R/W registers

Parameters
dev- LTC7871 device descriptor
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_freq_spread_range()

int ltc7871_set_freq_spread_range ( struct ltc7871_dev * dev,
enum ltc7871_ssfm_fsr value )

Set Frequency Spread Range.

Set Frequency Spread Range

Parameters
dev- LTC7871 device descriptor
value- Frequency Spread Range value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_mfr_idac_setcur()

int ltc7871_set_mfr_idac_setcur ( struct ltc7871_dev * dev,
int8_t value )

stores the current DAC value to program the sourcing current of the SETCUR pin.

stores the current DAC value to program the sourcing current of the SETCUR pin.

Parameters
dev- LTC7871 device descriptor
value- DAC value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_mfr_idac_vhigh()

int ltc7871_set_mfr_idac_vhigh ( struct ltc7871_dev * dev,
int8_t value )

stores the current DAC value to program the VHIGH voltage.

stores the current DAC value to program the VHIGH voltage.

Parameters
dev- LTC7871 device descriptor
value- DAC value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_mfr_idac_vlow()

int ltc7871_set_mfr_idac_vlow ( struct ltc7871_dev * dev,
int8_t value )

stores the current DAC value to program the VLOW voltage.

stores the current DAC value to program the VLOW voltage.

Parameters
dev- LTC7871 device descriptor
value- DAC value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_mod_freq()

int ltc7871_set_mod_freq ( struct ltc7871_dev * dev,
enum ltc7871_ssfm_msf value )

Set Modulation Signal Frequency.

Set Modulation Signal Frequency

Parameters
dev- LTC7871 device descriptor
value- Modulation signal frequency value
Returns
0 in case of succes, negative error code otherwise

◆ ltc7871_set_pwmen_pin()

int ltc7871_set_pwmen_pin ( struct ltc7871_dev * dev,
uint8_t value )

Set PWMEN pin of LTC7871 device.

Set PWMEN pin of LTC7871 device.

Parameters
dev- LTC7871 device descriptor
valueSet SWEN pin of LTC7871 device.
Returns
- 0 in case of succes, negative error code otherwise

◆ ltc7871_set_write_protect()

int ltc7871_set_write_protect ( struct ltc7871_dev * dev,
bool value )

set write protect bit.

et write protect bit

Parameters
dev- LTC7871 device descriptor
value- 1 if enable wp, 0 if disable
Returns
0 in case of success, negative error code otherwise