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

Implementation of AD8460 Driver. More...

#include "no_os_gpio.h"
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for ad8460.h:

Classes

struct  ad8460_device
 AD8460 descriptor. More...
 
struct  ad8460_init_param
 AD8460 init param. More...
 

Macros

#define AD8460_HVDAC_DATA_WORD(x)
 
#define AD8460_HV_RESET_MSK   NO_OS_BIT(7)
 
#define AD8460_HV_SLEEP_MSK   NO_OS_BIT(4)
 
#define AD8460_WAVE_GEN_MODE_MSK   NO_OS_BIT(0)
 
#define AD8460_HVDAC_SLEEP_MSK   NO_OS_BIT(3)
 
#define AD8460_FAULT_ARM_MSK   NO_OS_BIT(7)
 
#define AD8460_FAULT_LIMIT_MSK   NO_OS_GENMASK(6, 0)
 
#define AD8460_APG_MODE_ENABLE_MSK   NO_OS_BIT(5)
 
#define AD8460_PATTERN_DEPTH_MSK   NO_OS_GENMASK(3, 0)
 
#define AD8460_QUIESCENT_CURRENT_MSK   NO_OS_GENMASK(7, 0)
 
#define AD8460_SHUTDOWN_FLAG_MSK   NO_OS_BIT(7)
 
#define AD8460_DATA_BYTE_LOW_MSK   NO_OS_GENMASK(7, 0)
 
#define AD8460_DATA_BYTE_HIGH_MSK   NO_OS_GENMASK(5, 0)
 
#define AD8460_DATA_BYTE_FULL_MSK   NO_OS_GENMASK(13, 0)
 
#define AD8460_DEFAULT_FAULT_PROTECT   0x00
 
#define AD8460_DATA_BYTE_WORD_LENGTH   2
 
#define AD8460_NUM_DATA_WORDS   16
 
#define AD8460_NOMINAL_VOLTAGE_SPAN   80
 
#define AD8460_MIN_EXT_RESISTOR_OHMS   2000
 
#define AD8460_MAX_EXT_RESISTOR_OHMS   20000
 
#define AD8460_MIN_VREFIO_UV   120000
 
#define AD8460_MAX_VREFIO_UV   1200000
 
#define AD8460_ABS_MAX_OVERVOLTAGE_UV   55000000
 
#define AD8460_ABS_MAX_OVERCURRENT_UA   1000000
 
#define AD8460_MAX_OVERTEMPERATURE_MC   150000
 
#define AD8460_MIN_OVERTEMPERATURE_MC   20000
 
#define AD8460_CURRENT_LIMIT_CONV(x)
 
#define AD8460_VOLTAGE_LIMIT_CONV(x)
 
#define AD8460_TEMP_LIMIT_CONV(x)
 

Functions

int ad8460_reg_read (struct ad8460_device *dev, uint8_t addr, uint8_t *val)
 Read a register value.
 
int ad8460_reg_write (struct ad8460_device *dev, uint8_t addr, uint8_t val)
 Write a register value.
 
int ad8460_reg_update_bits (struct ad8460_device *dev, uint8_t addr, uint8_t mask, uint8_t val)
 Read-modify-write operation.
 
int ad8460_init (struct ad8460_device **dev, struct ad8460_init_param *init_param)
 Device and comm init function.
 
int ad8460_remove (struct ad8460_device *dev)
 Free resources allocated by the init function.
 
int ad8460_reset (struct ad8460_device *dev)
 Reset the AD8460 device.
 
int ad8460_get_hvdac_word (struct ad8460_device *dev, int8_t index, uint16_t *val)
 Get the value of a high voltage DAC word.
 
int ad8460_set_hvdac_word (struct ad8460_device *dev, int8_t index, uint16_t val)
 Set the value of a high voltage DAC word.
 
int ad8460_enable_apg_mode (struct ad8460_device *dev, int val)
 Enable or disable the APG mode.
 
int ad8460_read_shutdown_flag (struct ad8460_device *dev, uint8_t *flag)
 Read the shutdown flag.
 
int ad8460_hv_reset (struct ad8460_device *dev)
 Reset the high voltage driver.
 
int ad8460_set_sample (struct ad8460_device *dev, uint16_t val)
 Set the sample value.
 

Detailed Description

Implementation of AD8460 Driver.

Author
John Erasmus Mari Geronimo (johne.nosp@m.rasm.nosp@m.usmar.nosp@m.i.ge.nosp@m.ronim.nosp@m.o@an.nosp@m.alog..nosp@m.com)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD8460_ABS_MAX_OVERCURRENT_UA

#define AD8460_ABS_MAX_OVERCURRENT_UA   1000000

◆ AD8460_ABS_MAX_OVERVOLTAGE_UV

#define AD8460_ABS_MAX_OVERVOLTAGE_UV   55000000

◆ AD8460_APG_MODE_ENABLE_MSK

#define AD8460_APG_MODE_ENABLE_MSK   NO_OS_BIT(5)

◆ AD8460_CURRENT_LIMIT_CONV

#define AD8460_CURRENT_LIMIT_CONV ( x)
Value:
((x) / 15625)

◆ AD8460_DATA_BYTE_FULL_MSK

#define AD8460_DATA_BYTE_FULL_MSK   NO_OS_GENMASK(13, 0)

◆ AD8460_DATA_BYTE_HIGH_MSK

#define AD8460_DATA_BYTE_HIGH_MSK   NO_OS_GENMASK(5, 0)

◆ AD8460_DATA_BYTE_LOW_MSK

#define AD8460_DATA_BYTE_LOW_MSK   NO_OS_GENMASK(7, 0)

◆ AD8460_DATA_BYTE_WORD_LENGTH

#define AD8460_DATA_BYTE_WORD_LENGTH   2

◆ AD8460_DEFAULT_FAULT_PROTECT

#define AD8460_DEFAULT_FAULT_PROTECT   0x00

◆ AD8460_FAULT_ARM_MSK

#define AD8460_FAULT_ARM_MSK   NO_OS_BIT(7)

◆ AD8460_FAULT_LIMIT_MSK

#define AD8460_FAULT_LIMIT_MSK   NO_OS_GENMASK(6, 0)

◆ AD8460_HV_RESET_MSK

#define AD8460_HV_RESET_MSK   NO_OS_BIT(7)

◆ AD8460_HV_SLEEP_MSK

#define AD8460_HV_SLEEP_MSK   NO_OS_BIT(4)

◆ AD8460_HVDAC_DATA_WORD

#define AD8460_HVDAC_DATA_WORD ( x)
Value:
(0x60 + (2 * (x)))

◆ AD8460_HVDAC_SLEEP_MSK

#define AD8460_HVDAC_SLEEP_MSK   NO_OS_BIT(3)

◆ AD8460_MAX_EXT_RESISTOR_OHMS

#define AD8460_MAX_EXT_RESISTOR_OHMS   20000

◆ AD8460_MAX_OVERTEMPERATURE_MC

#define AD8460_MAX_OVERTEMPERATURE_MC   150000

◆ AD8460_MAX_VREFIO_UV

#define AD8460_MAX_VREFIO_UV   1200000

◆ AD8460_MIN_EXT_RESISTOR_OHMS

#define AD8460_MIN_EXT_RESISTOR_OHMS   2000

◆ AD8460_MIN_OVERTEMPERATURE_MC

#define AD8460_MIN_OVERTEMPERATURE_MC   20000

◆ AD8460_MIN_VREFIO_UV

#define AD8460_MIN_VREFIO_UV   120000

◆ AD8460_NOMINAL_VOLTAGE_SPAN

#define AD8460_NOMINAL_VOLTAGE_SPAN   80

◆ AD8460_NUM_DATA_WORDS

#define AD8460_NUM_DATA_WORDS   16

◆ AD8460_PATTERN_DEPTH_MSK

#define AD8460_PATTERN_DEPTH_MSK   NO_OS_GENMASK(3, 0)

◆ AD8460_QUIESCENT_CURRENT_MSK

#define AD8460_QUIESCENT_CURRENT_MSK   NO_OS_GENMASK(7, 0)

◆ AD8460_SHUTDOWN_FLAG_MSK

#define AD8460_SHUTDOWN_FLAG_MSK   NO_OS_BIT(7)

◆ AD8460_TEMP_LIMIT_CONV

#define AD8460_TEMP_LIMIT_CONV ( x)
Value:
(((x) + 266640) / 6510)

◆ AD8460_VOLTAGE_LIMIT_CONV

#define AD8460_VOLTAGE_LIMIT_CONV ( x)
Value:
((x) / 1953000)

◆ AD8460_WAVE_GEN_MODE_MSK

#define AD8460_WAVE_GEN_MODE_MSK   NO_OS_BIT(0)

Function Documentation

◆ ad8460_enable_apg_mode()

int ad8460_enable_apg_mode ( struct ad8460_device * dev,
int val )

Enable or disable the APG mode.

Enable or disable the APG mode

Parameters
dev- AD8460 descriptor
val- enable or disable APG mode
Returns
0 in case of success, negative error code otherwise

◆ ad8460_get_hvdac_word()

int ad8460_get_hvdac_word ( struct ad8460_device * dev,
int8_t index,
uint16_t * val )

Get the value of a high voltage DAC word.

Get the value of a high voltage DAC word

Parameters
dev- AD8460 descriptor
index- index of the word to be read
val- value of the word
Returns
0 in case of success, negative error code otherwise

◆ ad8460_hv_reset()

int ad8460_hv_reset ( struct ad8460_device * dev)

Reset the high voltage driver.

Reset the high voltage driver

Parameters
dev- AD8460 descriptor
Returns
0 in case of success, negative error code otherwise

◆ ad8460_init()

int ad8460_init ( struct ad8460_device ** dev,
struct ad8460_init_param * init_param )

Device and comm init function.

Device and comm init function

Parameters
dev- AD8460 descriptor to be initialized
init_param- Init parameter for descriptor
Returns
0 in case of success, errno errors otherwise

◆ ad8460_read_shutdown_flag()

int ad8460_read_shutdown_flag ( struct ad8460_device * dev,
uint8_t * flag )

Read the shutdown flag.

Read the shutdown flag

Parameters
dev- AD8460 descriptor
flag- shutdown flag
Returns
0 in case of success, negative error code otherwise

◆ ad8460_reg_read()

int ad8460_reg_read ( struct ad8460_device * dev,
uint8_t addr,
uint8_t * val )

Read a register value.

Read a register value

Parameters
dev- AD8460 descriptor
addr- register address
val- register value
Returns
0 in case of success, negative error code otherwise

◆ ad8460_reg_update_bits()

int ad8460_reg_update_bits ( struct ad8460_device * dev,
uint8_t addr,
uint8_t mask,
uint8_t val )

Read-modify-write operation.

Read-modify-write operation

Parameters
dev- AD8460 descriptor
addr- register address
mask- Mask for specific register bits to be updated
val- register value
Returns
0 in case of success, negative error code otherwise

◆ ad8460_reg_write()

int ad8460_reg_write ( struct ad8460_device * dev,
uint8_t addr,
uint8_t val )

Write a register value.

Write a register value

Parameters
dev- AD8460 descriptor
addr- register address
val- register value
Returns
0 in case of success, negative error code otherwise

◆ ad8460_remove()

int ad8460_remove ( struct ad8460_device * dev)

Free resources allocated by the init function.

Free resources allocated by the init function

Parameters
dev- AD8460 descriptor
Returns
0 in case of success, errno errors otherwise

◆ ad8460_reset()

int ad8460_reset ( struct ad8460_device * dev)

Reset the AD8460 device.

Reset the AD8460 device

Parameters
dev- AD8460 descriptor
Returns
0 in case of success, negative error code otherwise

◆ ad8460_set_hvdac_word()

int ad8460_set_hvdac_word ( struct ad8460_device * dev,
int8_t index,
uint16_t val )

Set the value of a high voltage DAC word.

Set the value of a high voltage DAC word

Parameters
dev- AD8460 descriptor
index- index of the word to be set
val- value of the word
Returns
0 in case of success, negative error code otherwise

◆ ad8460_set_sample()

int ad8460_set_sample ( struct ad8460_device * dev,
uint16_t val )

Set the sample value.

Set the sample value

Parameters
dev- AD8460 descriptor
val- sample value
Returns
0 in case of success, negative error code otherwise