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

Implementation of ADHV4710 Driver. More...

#include "adhv4710.h"
#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.c:

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

Implementation 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

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.