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"
Go to the source code of this file.
Classes | |
struct | ltc7871_init_param |
Initialization parameter for the LTC7871 device. More... | |
struct | ltc7871_dev |
Device descriptor for ltc7871. More... | |
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() | |
Header file for the LTC7871 Driver.
Copyright 2024(c) Analog Devices, Inc.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define CLEAR 0 |
#define LTC7871_BUCK_BOOST_MASK NO_OS_BIT(0) |
#define LTC7871_BURST_MASK NO_OS_BIT(4) |
#define LTC7871_CHIP_CTRL 0x07 |
#define LTC7871_CML_MASK NO_OS_BIT(2) |
#define LTC7871_CRC_POLYNOMIAL 0x07 |
#define LTC7871_DATA_READ_COMMAND 0xF4 |
#define LTC7871_DATA_READ_COMMAND_SIZE 8 |
#define LTC7871_DATA_WRITE_COMMAND 0xF2 |
#define LTC7871_DATA_WRITE_COMMAND_SIZE 8 |
#define LTC7871_DCM_MASK NO_OS_BIT(3) |
#define LTC7871_DRVCC_SET_MASK NO_OS_GENMASK(4, 3) |
#define LTC7871_DRVCC_UV_MASK NO_OS_BIT(3) |
#define LTC7871_FRAME_SIZE 3 |
#define LTC7871_HIZ_MASK NO_OS_BIT(2) |
#define LTC7871_IDAC_SETCUR 0x0A |
#define LTC7871_IDAC_VHIGH 0x09 |
#define LTC7871_IDAC_VLOW 0x08 |
#define LTC7871_ILIM_SET_MASK NO_OS_GENMASK(2, 0) |
#define LTC7871_MAX_CURRENT_MASK NO_OS_BIT(1) |
#define LTC7871_MFR_CHIP_CTRL_MASK NO_OS_GENMASK(2, 0) |
#define LTC7871_MFR_CONFIG1 0x05 |
#define LTC7871_MFR_CONFIG1_MASK NO_OS_GENMASK(5, 0) |
#define LTC7871_MFR_CONFIG2 0x06 |
#define LTC7871_MFR_CONFIG2_MASK NO_OS_GENMASK(4, 0) |
#define LTC7871_MFR_FAULT 0x01 |
#define LTC7871_MFR_FAULT_MASK NO_OS_GENMASK(6, 0) |
#define LTC7871_MFR_IDAC_SETCUR_MASK NO_OS_GENMASK(4, 0) |
#define LTC7871_MFR_IDAC_VHIGH_MASK NO_OS_GENMASK(6, 0) |
#define LTC7871_MFR_IDAC_VLOW_MASK NO_OS_GENMASK(6, 0) |
#define LTC7871_MFR_NOC_FAULT 0x03 |
#define LTC7871_MFR_NOC_FAULT_MASK NO_OS_GENMASK(6, 0) |
#define LTC7871_MFR_OC_FAULT 0x02 |
#define LTC7871_MFR_OC_FAULT_MASK NO_OS_GENMASK(6, 0) |
#define LTC7871_MFR_SSFM 0x0B |
#define LTC7871_MFR_SSFM_FSR_MASK NO_OS_GENMASK(4, 3) |
#define LTC7871_MFR_SSFM_MASK NO_OS_GENMASK(8, 0) |
#define LTC7871_MFR_SSFM_MSF_MASK NO_OS_GENMASK(2, 0) |
#define LTC7871_MFR_STATUS 0x04 |
#define LTC7871_MFR_STATUS_MASK NO_OS_GENMASK(2, 0) |
#define LTC7871_NOC_FAULT_1_MASK NO_OS_BIT(0) |
#define LTC7871_NOC_FAULT_2_MASK NO_OS_BIT(1) |
#define LTC7871_NOC_FAULT_3_MASK NO_OS_BIT(2) |
#define LTC7871_NOC_FAULT_4_MASK NO_OS_BIT(3) |
#define LTC7871_NOC_FAULT_5_MASK NO_OS_BIT(4) |
#define LTC7871_NOC_FAULT_6_MASK NO_OS_BIT(5) |
#define LTC7871_NUM_REGISTERS 8 |
#define LTC7871_OC_FAULT_1_MASK NO_OS_BIT(0) |
#define LTC7871_OC_FAULT_2_MASK NO_OS_BIT(1) |
#define LTC7871_OC_FAULT_3_MASK NO_OS_BIT(2) |
#define LTC7871_OC_FAULT_4_MASK NO_OS_BIT(3) |
#define LTC7871_OC_FAULT_5_MASK NO_OS_BIT(4) |
#define LTC7871_OC_FAULT_6_MASK NO_OS_BIT(5) |
#define LTC7871_OVER_TEMP_MASK NO_OS_BIT(0) |
#define LTC7871_PGOOD_MASK NO_OS_BIT(0) |
#define LTC7871_RESET_MASK NO_OS_BIT(1) |
#define LTC7871_SERCUR_WARNING_MASK NO_OS_BIT(5) |
#define LTC7871_SPI_READ 0x01 |
#define LTC7871_SPI_WRITE 0x00 |
#define LTC7871_SPRD_MASK NO_OS_BIT(1) |
#define LTC7871_SS_DONE_MASK NO_OS_BIT(2) |
#define LTC7871_STATUS_ACQUISITION_COMMAND 0xF0 |
#define LTC7871_STATUS_ACQUISITION_COMMAND_SIZE 4 |
#define LTC7871_V5_UV_MASK NO_OS_BIT(2) |
#define LTC7871_VHIGH_OV_MASK NO_OS_BIT(5) |
#define LTC7871_VHIGH_UV_MASK NO_OS_BIT(4) |
#define LTC7871_VLOW_OV_MASK NO_OS_BIT(6) |
#define LTC7871_VREF_BAD_MASK NO_OS_BIT(1) |
#define LTC7871_WP_MASK NO_OS_BIT(0) |
#define SET 1 |
enum ltc7871_ctrl_wp |
enum ltc7871_ssfm_fsr |
enum ltc7871_ssfm_msf |
Modulation Signal Frequency control bits.
int ltc7871_clear_pec_fault | ( | struct ltc7871_dev * | dev | ) |
Clear PEC fault bit.
Clear PEC fault bit
dev | - LTC7871 device descriptor |
int ltc7871_get_freq_spread_range | ( | struct ltc7871_dev * | dev, |
uint8_t * | value ) |
Get Frequency Spread Range.
Get Frequency Spread Range.
dev | - LTC7871 device descriptor |
value | - Frequencey Spread range |
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.
dev | - LTC7871 device descriptor |
config | - configuration to get. |
value | - status value to be returned. |
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.
dev | - LTC7871 device descriptor |
config | - configuration to get. |
value | - status value to be returned. |
int ltc7871_get_mfr_fault | ( | struct ltc7871_dev * | dev, |
uint8_t | status, | ||
bool * | value ) |
gets mfr fault bit.
Read Most critical fault status
dev | - LTC7871 device descriptor |
status | - m askfault status to get. |
value | - status value to be returned. |
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.
dev | - LTC7871 device descriptor |
value | - DAC Value |
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.
dev | - LTC7871 device descriptor |
value | - DAC Value |
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.
dev | - LTC7871 device descriptor |
value | - DAC Value |
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
dev | - LTC7871 device descriptor |
status | - mask fault status to get. (0-5) |
value | - status value to be returned. |
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
dev | - LTC7871 device descriptor |
status | - mask fault status to get. (0-5) |
value | - status value to be returned. |
int ltc7871_get_mfr_status | ( | struct ltc7871_dev * | dev, |
uint8_t | status_mask, | ||
bool * | status ) |
gets status.
gets status
dev | - LTC7871 device descriptor |
status_mask | - status mask to be acquire. |
status | - status value. |
int ltc7871_get_mod_freq | ( | struct ltc7871_dev * | dev, |
uint8_t * | value ) |
Get Modulation Signal Frequency.
Get Modulation Signal Frequency
dev | - LTC7871 device descriptor |
value | - Modulation signal frequency value |
uint8_t ltc7871_get_pec_byte | ( | uint8_t * | data, |
uint8_t | len ) |
Compute the PEC.
Register Read
data | - Data buffer. |
len | - Buffer length. |
int ltc7871_get_pwmen_pin | ( | struct ltc7871_dev * | dev, |
uint8_t * | value ) |
Get EN pin of LTC7871 device.
Get PWMEN pin
dev | - LTC7871 device descriptor |
value | - EN pin value. |
int ltc7871_init | ( | struct ltc7871_dev ** | device, |
struct ltc7871_init_param * | init_param ) |
Initialize the LTC7871 device.
Initialize the LTC7871 device descriptor.
device | - LTC7871 device descriptor |
init_param | - Initialization parameter containing information about the LTC7871 device to be initialized. |
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
dev | - LTC7871 device descriptor |
value | - value of write protect bit |
int ltc7871_read_pec_fault | ( | struct ltc7871_dev * | dev, |
bool * | value ) |
Read PEC fault bit.
Read PEC fault bit
dev | - LTC7871 device descriptor |
value | - fault bit value. |
int ltc7871_reg_read | ( | struct ltc7871_dev * | dev, |
uint8_t | reg, | ||
uint8_t * | data ) |
Register Read.
Register Read
dev | - The device structure |
reg | - The register value |
data | - The data read from the device. |
int ltc7871_reg_write | ( | struct ltc7871_dev * | dev, |
uint8_t | reg, | ||
uint8_t | data ) |
Register Write.
Register Write
dev | - The device structure |
reg | - The register value |
data | - The data written to the device |
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
dev | - LTC7871 device descriptor |
address | - Register address. |
mask | - Mask to be applied. |
data | - Data to be written. |
int ltc7871_remove | ( | struct ltc7871_dev * | dev | ) |
Free the resources allocated by the LT7871_init()
Remove resources allocated by the init function.
dev | - LTC7871 device descriptor |
int ltc7871_reset | ( | struct ltc7871_dev * | dev | ) |
Reset all R/W registers.
Reset all R/W registers
dev | - LTC7871 device descriptor |
int ltc7871_set_freq_spread_range | ( | struct ltc7871_dev * | dev, |
enum ltc7871_ssfm_fsr | value ) |
Set Frequency Spread Range.
Set Frequency Spread Range
dev | - LTC7871 device descriptor |
value | - Frequency Spread Range value |
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.
dev | - LTC7871 device descriptor |
value | - DAC value |
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.
dev | - LTC7871 device descriptor |
value | - DAC value |
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.
dev | - LTC7871 device descriptor |
value | - DAC value |
int ltc7871_set_mod_freq | ( | struct ltc7871_dev * | dev, |
enum ltc7871_ssfm_msf | value ) |
Set Modulation Signal Frequency.
Set Modulation Signal Frequency
dev | - LTC7871 device descriptor |
value | - Modulation signal frequency value |
int ltc7871_set_pwmen_pin | ( | struct ltc7871_dev * | dev, |
uint8_t | value ) |
Set PWMEN pin of LTC7871 device.
Set PWMEN pin of LTC7871 device.
dev | - LTC7871 device descriptor |
value | Set SWEN pin of LTC7871 device. |
int ltc7871_set_write_protect | ( | struct ltc7871_dev * | dev, |
bool | value ) |
set write protect bit.
et write protect bit
dev | - LTC7871 device descriptor |
value | - 1 if enable wp, 0 if disable |