![]() |
no-OS
|
Header file of ADHV4710 Driver. More...
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
#include "no_os_irq.h"
#include "no_os_delay.h"
#include "no_os_units.h"
#include "no_os_alloc.h"
#include "no_os_crc16.h"
#include "no_os_print_log.h"
#include <stdlib.h>
#include <errno.h>
#include <math.h>
Go to the source code of this file.
Classes | |
struct | adhv4710_init_param |
ADHV4710 Device initialization parameters. More... | |
struct | adhv4710_dev |
ADHV4710 Device structure. More... | |
Functions | |
int | adhv4710_init (struct adhv4710_dev **device, struct adhv4710_init_param init_param) |
Initialize the device. | |
int | adhv4710_read (struct adhv4710_dev *dev, uint8_t reg_addr, int8_t *reg_data) |
Read device register. | |
int | adhv4710_write (struct adhv4710_dev *dev, uint8_t reg_addr, uint8_t reg_data) |
Write device register. | |
int | adhv4710_update_bits (struct adhv4710_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_data) |
Update specific register bits. | |
int | adhv4710_get_status (struct adhv4710_dev *dev, uint8_t reg_addr, uint8_t msk, uint8_t *status) |
Get indicator of settings. | |
int | adhv4710_remove (struct adhv4710_dev *dev) |
Remove the device and release resources. | |
int | adhv4710_sw_reset (struct adhv4710_dev *dev) |
Reset the device using SW reset. | |
int | adhv4710_hw_reset (struct adhv4710_dev *dev) |
Reset the device using HW reset. | |
int | adhv4710_clear_shutdown_latch (struct adhv4710_dev *dev) |
Clear shutdown latch and re-enable amplifier from shutdown. | |
int | adhv4710_shutdown_amplifier (struct adhv4710_dev *dev) |
Shutdown the amplifier. | |
int | adhv4710_set_quiescent_current (struct adhv4710_dev *dev, uint8_t value, uint8_t direction) |
Program quiescent current of amplifier. | |
int | adhv4710_enable_source_overcurrent_protection (struct adhv4710_dev *dev) |
Enable source overcurrent protection. | |
int | adhv4710_set_source_overcurrent_level (struct adhv4710_dev *dev, uint8_t level) |
Set level of overcurrent source protection. | |
int | adhv4710_enable_sink_overcurrent_protection (struct adhv4710_dev *dev) |
Enable sink overcurrent protection. | |
int | adhv4710_set_sink_overcurrent_level (struct adhv4710_dev *dev, uint8_t level) |
Set level of overcurrent sink protection. | |
int | adhv4710_enable_overvoltage_pos_protection (struct adhv4710_dev *dev) |
Enable overvoltage positive protection. | |
int | adhv4710_set_overvoltage_pos_level (struct adhv4710_dev *dev, uint8_t level) |
Set level of overvoltage positive protection. | |
int | adhv4710_enable_overvoltage_neg_protection (struct adhv4710_dev *dev) |
Enable overvoltage negative protection. | |
int | adhv4710_set_overvoltage_neg_level (struct adhv4710_dev *dev, uint8_t level) |
Set level of overvoltage negative protection. | |
int | adhv4710_enable_overtemperature_protection (struct adhv4710_dev *dev) |
Enable overtemperature protection. | |
int | adhv4710_set_overtemperature_level (struct adhv4710_dev *dev, uint8_t level) |
Set level of overtemperature protection. | |
int | adhv4710_version_product (struct adhv4710_dev *dev, uint8_t *data_read) |
Version product. | |
Header file of ADHV4710 Driver.
Copyright 2025(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 ADEHV4710_OC_SNK_LIMIT_MSK NO_OS_GENMASK(6, 0) |
#define ADEHV4710_OC_SRC_LIMIT_MSK NO_OS_GENMASK(6, 0) |
#define ADEHV4710_OT_LIMIT_MSK NO_OS_GENMASK(6, 0) |
#define ADEHV4710_OV_NEG_LIMIT_MSK NO_OS_GENMASK(6, 0) |
#define ADEHV4710_OV_POS_LIMIT_MSK NO_OS_GENMASK(6, 0) |
#define ADHV4710_ALL_ALARM_LATCH_MSK NO_OS_GENMASK(4, 0) |
#define ADHV4710_CHIP_ID_MSK NO_OS_GENMASK(7, 0) |
#define ADHV4710_DECREASE_I 0 |
#define ADHV4710_DIE_REV_MSK NO_OS_GENMASK(3, 0) |
#define ADHV4710_HV_RESET_MSK NO_OS_BIT(7) |
#define ADHV4710_HV_SLEEP_MSK NO_OS_BIT(4) |
#define ADHV4710_INC_DEC_MSK NO_OS_BIT(7) |
#define ADHV4710_INCREASE_I 1 |
#define ADHV4710_OC_SNK_ALARM_LATCH_MSK NO_OS_BIT(3) |
#define ADHV4710_OC_SNK_ALARM_MSK NO_OS_BIT(3) |
#define ADHV4710_OC_SNK_ARM_MSK NO_OS_BIT(7) |
#define ADHV4710_OC_SRC_ALARM_LATCH_MSK NO_OS_BIT(4) |
#define ADHV4710_OC_SRC_ALARM_MSK NO_OS_BIT(4) |
#define ADHV4710_OC_SRC_ARM_MSK NO_OS_BIT(7) |
#define ADHV4710_OT_ALARM_LATCH_MSK NO_OS_BIT(0) |
#define ADHV4710_OT_ALARM_MSK NO_OS_BIT(0) |
#define ADHV4710_OT_ARM_MSK NO_OS_BIT(7) |
#define ADHV4710_OV_NEG_ALARM_LATCH_MSK NO_OS_BIT(1) |
#define ADHV4710_OV_NEG_ALARM_MSK NO_OS_BIT(1) |
#define ADHV4710_OV_NEG_ARM_MSK NO_OS_BIT(7) |
#define ADHV4710_OV_POS_ALARM_LATCH_MSK NO_OS_BIT(2) |
#define ADHV4710_OV_POS_ALARM_MSK NO_OS_BIT(2) |
#define ADHV4710_OV_POS_ARM_MSK NO_OS_BIT(7) |
#define ADHV4710_REG_CTRL_REG_00 0x000 |
#define ADHV4710_REG_CTRL_REG_03 0x003 |
#define ADHV4710_REG_CTRL_REG_04 0x004 |
#define ADHV4710_REG_CTRL_REG_08 0x008 |
#define ADHV4710_REG_CTRL_REG_09 0x009 |
#define ADHV4710_REG_CTRL_REG_10 0x00A |
#define ADHV4710_REG_CTRL_REG_11 0x00B |
#define ADHV4710_REG_CTRL_REG_12 0x00C |
#define ADHV4710_REG_CTRL_REG_13 0x00D |
#define ADHV4710_REG_CTRL_REG_14 0x00E |
#define ADHV4710_REG_CTRL_REG_25 0x019 |
#define ADHV4710_REG_CTRL_REG_26 0x01A |
#define ADHV4710_SET_IQ_MSK NO_OS_GENMASK(7, 0) |
#define ADHV4710_SHUTDOWN_FLAG_MSK NO_OS_BIT(7) |
#define ADHV4710_SILICON_REV 0x4 |
#define ADHV4710_SOFT_RESET_MSK NO_OS_BIT(0) |
#define ADHV4710_SPI_READ NO_OS_BIT(7) |
#define ADHV4710_VERSION_PRODUCT 0x46 |
int adhv4710_clear_shutdown_latch | ( | struct adhv4710_dev * | dev | ) |
Clear shutdown latch and re-enable amplifier from shutdown.
dev | - The device structure. |
int adhv4710_enable_overtemperature_protection | ( | struct adhv4710_dev * | dev | ) |
Enable overtemperature protection.
dev | - The device structure. |
int adhv4710_enable_overvoltage_neg_protection | ( | struct adhv4710_dev * | dev | ) |
Enable overvoltage negative protection.
dev | - The device structure. |
int adhv4710_enable_overvoltage_pos_protection | ( | struct adhv4710_dev * | dev | ) |
Enable overvoltage positive protection.
dev | - The device structure. |
int adhv4710_enable_sink_overcurrent_protection | ( | struct adhv4710_dev * | dev | ) |
Enable sink overcurrent protection.
dev | - The device structure. |
int adhv4710_enable_source_overcurrent_protection | ( | struct adhv4710_dev * | dev | ) |
Enable source overcurrent protection.
dev | - The device structure. |
int adhv4710_get_status | ( | struct adhv4710_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | msk, | ||
uint8_t * | status ) |
Get indicator of settings.
dev | - The device structure. |
reg_addr | - The register address. |
msk | - Bit that needs to be tested. |
status | - Status indicator. |
int adhv4710_hw_reset | ( | struct adhv4710_dev * | dev | ) |
Reset the device using HW reset.
dev | - The device structure. |
int adhv4710_init | ( | struct adhv4710_dev ** | device, |
struct adhv4710_init_param | init_param ) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int adhv4710_read | ( | struct adhv4710_dev * | dev, |
uint8_t | reg_addr, | ||
int8_t * | reg_data ) |
Read device register.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The data read from 32bit register. |
int adhv4710_remove | ( | struct adhv4710_dev * | dev | ) |
Remove the device and release resources.
dev | - The device structure. |
int adhv4710_set_overtemperature_level | ( | struct adhv4710_dev * | dev, |
uint8_t | level ) |
Set level of overtemperature protection.
dev | - The device structure. |
level | - The level of overtemperature protection (level = round( (threshold[℃] + 266.64[℃]) / 6.51[℃/LSB]) ). |
int adhv4710_set_overvoltage_neg_level | ( | struct adhv4710_dev * | dev, |
uint8_t | level ) |
Set level of overvoltage negative protection.
dev | - The device structure. |
level | - The level of overvoltage negative protection (level = round(threshold[V] / 1.953[V/LSB])). |
int adhv4710_set_overvoltage_pos_level | ( | struct adhv4710_dev * | dev, |
uint8_t | level ) |
Set level of overvoltage positive protection.
dev | - The device structure. |
level | - The level of overvoltage positive protection (level = round(threshold[V] / 1.953[V/LSB])). |
int adhv4710_set_quiescent_current | ( | struct adhv4710_dev * | dev, |
uint8_t | value, | ||
uint8_t | direction ) |
Program quiescent current of amplifier.
dev | - The device structure. |
value | - The quiescent current value to be set (0x0 for nominal supply current). |
direction | - The direction of the quiescent current (0 for reduction, 1 for increase). |
int adhv4710_set_sink_overcurrent_level | ( | struct adhv4710_dev * | dev, |
uint8_t | level ) |
Set level of overcurrent sink protection.
dev | - The device structure. |
level | - The level of overcurrent source protection (level = round(threshold[mA] / 15.625[mA/LSB])). |
int adhv4710_set_source_overcurrent_level | ( | struct adhv4710_dev * | dev, |
uint8_t | level ) |
Set level of overcurrent source protection.
dev | - The device structure. |
level | - The level of overcurrent source protection (level = round(threshold[mA] / 15.625[mA/LSB])). |
int adhv4710_shutdown_amplifier | ( | struct adhv4710_dev * | dev | ) |
Shutdown the amplifier.
dev | - The device structure. |
int adhv4710_sw_reset | ( | struct adhv4710_dev * | dev | ) |
Reset the device using SW reset.
dev | - The device structure. |
int adhv4710_update_bits | ( | struct adhv4710_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t | reg_data ) |
Update specific register bits.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - Specific bits mask. |
reg_data | - The data to be written. |
int adhv4710_version_product | ( | struct adhv4710_dev * | dev, |
uint8_t * | data_read ) |
Version product.
dev | - The device structure. |
data_read | - The version product read value |
int adhv4710_write | ( | struct adhv4710_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data ) |
Write device register.
dev- | The device structure. |
reg_addr | - The register address. |
reg_data | - The data to be written. |