Source file for the LTC7871 Driver. More...
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include "no_os_alloc.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_print_log.h"
#include "ltc7871.h"
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() | |
Source 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.
int ltc7871_clear_pec_fault | ( | struct ltc7871_dev * | dev | ) |
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
dev | - LTC7871 device descriptor |
value | - Modulation signal frequency value |
uint8_t ltc7871_get_pec_byte | ( | uint8_t * | data, |
uint8_t | len ) |
Compute the PEC.
data | - Data buffer. |
len | - Buffer length. |
int ltc7871_get_pwmen_pin | ( | struct ltc7871_dev * | dev, |
uint8_t * | value ) |
Get EN pin of LTC7871 device.
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.
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.
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.
dev | - LTC7871 device descriptor |
value | - fault bit value. |
int ltc7871_reg_read | ( | struct ltc7871_dev * | dev, |
uint8_t | reg, | ||
uint8_t * | data ) |
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.
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.
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()
dev | - LTC7871 device descriptor |
int ltc7871_reset | ( | struct ltc7871_dev * | dev | ) |
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.
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.
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.
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.
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.
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.
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.
dev | - LTC7871 device descriptor |
value | - 1 if enable wp, 0 if disable |