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

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>
Include dependency graph for adhv4710.h:

Classes

struct  adhv4710_chip_info
 Per-variant constants. More...
 
struct  adhv4710_init_param
 ADHV4710 Device initialization parameters. More...
 
struct  adhv4710_dev
 ADHV4710 Device structure. More...
 

Macros

#define ADHV4710_SPI_READ   NO_OS_BIT(7)
 
#define ADHV4710_SILICON_REV   0x4
 
#define ADHV4710_VERSION_PRODUCT   0x46
 
#define ADHV4711_VERSION_PRODUCT   0x47
 
#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_HV_RESET_MSK   NO_OS_BIT(7)
 
#define ADHV4710_HV_SLEEP_MSK   NO_OS_BIT(4)
 
#define ADHV4710_SOFT_RESET_MSK   NO_OS_BIT(0)
 
#define ADHV4710_SET_IQ_MSK   NO_OS_GENMASK(7, 0)
 
#define ADHV4710_OC_SRC_ARM_MSK   NO_OS_BIT(7)
 
#define ADEHV4710_OC_SRC_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define ADHV4710_OC_SNK_ARM_MSK   NO_OS_BIT(7)
 
#define ADEHV4710_OC_SNK_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define ADHV4710_OV_POS_ARM_MSK   NO_OS_BIT(7)
 
#define ADEHV4710_OV_POS_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define ADHV4710_OV_NEG_ARM_MSK   NO_OS_BIT(7)
 
#define ADEHV4710_OV_NEG_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define ADHV4710_OT_ARM_MSK   NO_OS_BIT(7)
 
#define ADEHV4710_OT_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define ADHV4710_OC_SRC_ALARM_LATCH_MSK   NO_OS_BIT(4)
 
#define ADHV4710_OC_SNK_ALARM_LATCH_MSK   NO_OS_BIT(3)
 
#define ADHV4710_OV_POS_ALARM_LATCH_MSK   NO_OS_BIT(2)
 
#define ADHV4710_OV_NEG_ALARM_LATCH_MSK   NO_OS_BIT(1)
 
#define ADHV4710_OT_ALARM_LATCH_MSK   NO_OS_BIT(0)
 
#define ADHV4710_ALL_ALARM_LATCH_MSK   NO_OS_GENMASK(4, 0)
 
#define ADHV4710_SHUTDOWN_FLAG_MSK   NO_OS_BIT(7)
 
#define ADHV4710_OC_SRC_ALARM_MSK   NO_OS_BIT(4)
 
#define ADHV4710_OC_SNK_ALARM_MSK   NO_OS_BIT(3)
 
#define ADHV4710_OV_POS_ALARM_MSK   NO_OS_BIT(2)
 
#define ADHV4710_OV_NEG_ALARM_MSK   NO_OS_BIT(1)
 
#define ADHV4710_OT_ALARM_MSK   NO_OS_BIT(0)
 
#define ADHV4710_DIE_REV_MSK   NO_OS_GENMASK(3, 0)
 
#define ADHV4710_CHIP_ID_MSK   NO_OS_GENMASK(7, 0)
 
#define ADHV4710_INC_DEC_MSK   NO_OS_BIT(7)
 
#define ADHV4710_INCREASE_I   1
 
#define ADHV4710_DECREASE_I   0
 

Enumerations

enum  adhv4710_type {
  ID_ADHV4710 ,
  ID_ADHV4711
}
 Supported device variants. 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.
 

Detailed Description

Header file of ADHV4710 Driver.

Author
REtz (radu..nosp@m.etz@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ ADEHV4710_OC_SNK_LIMIT_MSK

#define ADEHV4710_OC_SNK_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ ADEHV4710_OC_SRC_LIMIT_MSK

#define ADEHV4710_OC_SRC_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ ADEHV4710_OT_LIMIT_MSK

#define ADEHV4710_OT_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ ADEHV4710_OV_NEG_LIMIT_MSK

#define ADEHV4710_OV_NEG_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ ADEHV4710_OV_POS_LIMIT_MSK

#define ADEHV4710_OV_POS_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ ADHV4710_ALL_ALARM_LATCH_MSK

#define ADHV4710_ALL_ALARM_LATCH_MSK   NO_OS_GENMASK(4, 0)

◆ ADHV4710_CHIP_ID_MSK

#define ADHV4710_CHIP_ID_MSK   NO_OS_GENMASK(7, 0)

◆ ADHV4710_DECREASE_I

#define ADHV4710_DECREASE_I   0

◆ ADHV4710_DIE_REV_MSK

#define ADHV4710_DIE_REV_MSK   NO_OS_GENMASK(3, 0)

◆ ADHV4710_HV_RESET_MSK

#define ADHV4710_HV_RESET_MSK   NO_OS_BIT(7)

◆ ADHV4710_HV_SLEEP_MSK

#define ADHV4710_HV_SLEEP_MSK   NO_OS_BIT(4)

◆ ADHV4710_INC_DEC_MSK

#define ADHV4710_INC_DEC_MSK   NO_OS_BIT(7)

◆ ADHV4710_INCREASE_I

#define ADHV4710_INCREASE_I   1

◆ ADHV4710_OC_SNK_ALARM_LATCH_MSK

#define ADHV4710_OC_SNK_ALARM_LATCH_MSK   NO_OS_BIT(3)

◆ ADHV4710_OC_SNK_ALARM_MSK

#define ADHV4710_OC_SNK_ALARM_MSK   NO_OS_BIT(3)

◆ ADHV4710_OC_SNK_ARM_MSK

#define ADHV4710_OC_SNK_ARM_MSK   NO_OS_BIT(7)

◆ ADHV4710_OC_SRC_ALARM_LATCH_MSK

#define ADHV4710_OC_SRC_ALARM_LATCH_MSK   NO_OS_BIT(4)

◆ ADHV4710_OC_SRC_ALARM_MSK

#define ADHV4710_OC_SRC_ALARM_MSK   NO_OS_BIT(4)

◆ ADHV4710_OC_SRC_ARM_MSK

#define ADHV4710_OC_SRC_ARM_MSK   NO_OS_BIT(7)

◆ ADHV4710_OT_ALARM_LATCH_MSK

#define ADHV4710_OT_ALARM_LATCH_MSK   NO_OS_BIT(0)

◆ ADHV4710_OT_ALARM_MSK

#define ADHV4710_OT_ALARM_MSK   NO_OS_BIT(0)

◆ ADHV4710_OT_ARM_MSK

#define ADHV4710_OT_ARM_MSK   NO_OS_BIT(7)

◆ ADHV4710_OV_NEG_ALARM_LATCH_MSK

#define ADHV4710_OV_NEG_ALARM_LATCH_MSK   NO_OS_BIT(1)

◆ ADHV4710_OV_NEG_ALARM_MSK

#define ADHV4710_OV_NEG_ALARM_MSK   NO_OS_BIT(1)

◆ ADHV4710_OV_NEG_ARM_MSK

#define ADHV4710_OV_NEG_ARM_MSK   NO_OS_BIT(7)

◆ ADHV4710_OV_POS_ALARM_LATCH_MSK

#define ADHV4710_OV_POS_ALARM_LATCH_MSK   NO_OS_BIT(2)

◆ ADHV4710_OV_POS_ALARM_MSK

#define ADHV4710_OV_POS_ALARM_MSK   NO_OS_BIT(2)

◆ ADHV4710_OV_POS_ARM_MSK

#define ADHV4710_OV_POS_ARM_MSK   NO_OS_BIT(7)

◆ ADHV4710_REG_CTRL_REG_00

#define ADHV4710_REG_CTRL_REG_00   0x000

◆ ADHV4710_REG_CTRL_REG_03

#define ADHV4710_REG_CTRL_REG_03   0x003

◆ ADHV4710_REG_CTRL_REG_04

#define ADHV4710_REG_CTRL_REG_04   0x004

◆ ADHV4710_REG_CTRL_REG_08

#define ADHV4710_REG_CTRL_REG_08   0x008

◆ ADHV4710_REG_CTRL_REG_09

#define ADHV4710_REG_CTRL_REG_09   0x009

◆ ADHV4710_REG_CTRL_REG_10

#define ADHV4710_REG_CTRL_REG_10   0x00A

◆ ADHV4710_REG_CTRL_REG_11

#define ADHV4710_REG_CTRL_REG_11   0x00B

◆ ADHV4710_REG_CTRL_REG_12

#define ADHV4710_REG_CTRL_REG_12   0x00C

◆ ADHV4710_REG_CTRL_REG_13

#define ADHV4710_REG_CTRL_REG_13   0x00D

◆ ADHV4710_REG_CTRL_REG_14

#define ADHV4710_REG_CTRL_REG_14   0x00E

◆ ADHV4710_REG_CTRL_REG_25

#define ADHV4710_REG_CTRL_REG_25   0x019

◆ ADHV4710_REG_CTRL_REG_26

#define ADHV4710_REG_CTRL_REG_26   0x01A

◆ ADHV4710_SET_IQ_MSK

#define ADHV4710_SET_IQ_MSK   NO_OS_GENMASK(7, 0)

◆ ADHV4710_SHUTDOWN_FLAG_MSK

#define ADHV4710_SHUTDOWN_FLAG_MSK   NO_OS_BIT(7)

◆ ADHV4710_SILICON_REV

#define ADHV4710_SILICON_REV   0x4

◆ ADHV4710_SOFT_RESET_MSK

#define ADHV4710_SOFT_RESET_MSK   NO_OS_BIT(0)

◆ ADHV4710_SPI_READ

#define ADHV4710_SPI_READ   NO_OS_BIT(7)

◆ ADHV4710_VERSION_PRODUCT

#define ADHV4710_VERSION_PRODUCT   0x46

◆ ADHV4711_VERSION_PRODUCT

#define ADHV4711_VERSION_PRODUCT   0x47

Enumeration Type Documentation

◆ adhv4710_type

Supported device variants.

Enumerator
ID_ADHV4710 

ADHV4710

ID_ADHV4711 

ADHV4711

Function Documentation

◆ adhv4710_clear_shutdown_latch()

int adhv4710_clear_shutdown_latch ( struct adhv4710_dev * dev)

Clear shutdown latch and re-enable amplifier from shutdown.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_enable_overtemperature_protection()

int adhv4710_enable_overtemperature_protection ( struct adhv4710_dev * dev)

Enable overtemperature protection.

Parameters
dev- The device structure.

◆ adhv4710_enable_overvoltage_neg_protection()

int adhv4710_enable_overvoltage_neg_protection ( struct adhv4710_dev * dev)

Enable overvoltage negative protection.

Parameters
dev- The device structure.

◆ adhv4710_enable_overvoltage_pos_protection()

int adhv4710_enable_overvoltage_pos_protection ( struct adhv4710_dev * dev)

Enable overvoltage positive protection.

Parameters
dev- The device structure.

◆ adhv4710_enable_sink_overcurrent_protection()

int adhv4710_enable_sink_overcurrent_protection ( struct adhv4710_dev * dev)

Enable sink overcurrent protection.

Parameters
dev- The device structure.

◆ adhv4710_enable_source_overcurrent_protection()

int adhv4710_enable_source_overcurrent_protection ( struct adhv4710_dev * dev)

Enable source overcurrent protection.

Parameters
dev- The device structure.

◆ adhv4710_get_status()

int adhv4710_get_status ( struct adhv4710_dev * dev,
uint8_t reg_addr,
uint8_t msk,
uint8_t * status )

Get indicator of settings.

Parameters
dev- The device structure.
reg_addr- The register address.
msk- Bit that needs to be tested.
status- Status indicator.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_hw_reset()

int adhv4710_hw_reset ( struct adhv4710_dev * dev)

Reset the device using HW reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_init()

int adhv4710_init ( struct adhv4710_dev ** device,
struct adhv4710_init_param init_param )

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_read()

int adhv4710_read ( struct adhv4710_dev * dev,
uint8_t reg_addr,
int8_t * reg_data )

Read device register.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The data read from 32bit register.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_remove()

int adhv4710_remove ( struct adhv4710_dev * dev)

Remove the device and release resources.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_set_overtemperature_level()

int adhv4710_set_overtemperature_level ( struct adhv4710_dev * dev,
uint8_t level )

Set level of overtemperature protection.

Parameters
dev- The device structure.
level- The level of overtemperature protection (level = round( (threshold[℃] + 266.64[℃]) / 6.51[℃/LSB]) ).

◆ adhv4710_set_overvoltage_neg_level()

int adhv4710_set_overvoltage_neg_level ( struct adhv4710_dev * dev,
uint8_t level )

Set level of overvoltage negative protection.

Parameters
dev- The device structure.
level- The level of overvoltage negative protection (level = round(threshold[V] / 1.953[V/LSB])).

◆ adhv4710_set_overvoltage_pos_level()

int adhv4710_set_overvoltage_pos_level ( struct adhv4710_dev * dev,
uint8_t level )

Set level of overvoltage positive protection.

Parameters
dev- The device structure.
level- The level of overvoltage positive protection (level = round(threshold[V] / 1.953[V/LSB])).

◆ adhv4710_set_quiescent_current()

int adhv4710_set_quiescent_current ( struct adhv4710_dev * dev,
uint8_t value,
uint8_t direction )

Program quiescent current of amplifier.

Parameters
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).
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_set_sink_overcurrent_level()

int adhv4710_set_sink_overcurrent_level ( struct adhv4710_dev * dev,
uint8_t level )

Set level of overcurrent sink protection.

Parameters
dev- The device structure.
level- The level of overcurrent source protection (level = round(threshold[mA] / 15.625[mA/LSB])).

◆ adhv4710_set_source_overcurrent_level()

int adhv4710_set_source_overcurrent_level ( struct adhv4710_dev * dev,
uint8_t level )

Set level of overcurrent source protection.

Parameters
dev- The device structure.
level- The level of overcurrent source protection (level = round(threshold[mA] / 15.625[mA/LSB])).

◆ adhv4710_shutdown_amplifier()

int adhv4710_shutdown_amplifier ( struct adhv4710_dev * dev)

Shutdown the amplifier.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_sw_reset()

int adhv4710_sw_reset ( struct adhv4710_dev * dev)

Reset the device using SW reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_update_bits()

int adhv4710_update_bits ( struct adhv4710_dev * dev,
uint8_t reg_addr,
uint8_t mask,
uint8_t reg_data )

Update specific register bits.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Specific bits mask.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_version_product()

int adhv4710_version_product ( struct adhv4710_dev * dev,
uint8_t * data_read )

Version product.

Parameters
dev- The device structure.
data_read- The version product read value
Returns
0 in case of success, negative error code otherwise.

◆ adhv4710_write()

int adhv4710_write ( struct adhv4710_dev * dev,
uint8_t reg_addr,
uint8_t reg_data )

Write device register.

Parameters
dev-The device structure.
reg_addr- The register address.
reg_data- The data to be written.
Returns
0 in case of success, negative error code otherwise.