no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ad8460.h
Go to the documentation of this file.
1/***************************************************************************/
33
34#ifndef __AD8460_H__
35#define __AD8460_H__
36
37#include "no_os_gpio.h"
38#include "no_os_spi.h"
39#include "no_os_util.h"
40
41#define AD8460_HVDAC_DATA_WORD(x) (0x60 + (2 * (x)))
42
43#define AD8460_HV_RESET_MSK NO_OS_BIT(7)
44#define AD8460_HV_SLEEP_MSK NO_OS_BIT(4)
45#define AD8460_WAVE_GEN_MODE_MSK NO_OS_BIT(0)
46
47#define AD8460_HVDAC_SLEEP_MSK NO_OS_BIT(3)
48
49#define AD8460_FAULT_ARM_MSK NO_OS_BIT(7)
50#define AD8460_FAULT_LIMIT_MSK NO_OS_GENMASK(6, 0)
51
52#define AD8460_APG_MODE_ENABLE_MSK NO_OS_BIT(5)
53#define AD8460_PATTERN_DEPTH_MSK NO_OS_GENMASK(3, 0)
54
55#define AD8460_QUIESCENT_CURRENT_MSK NO_OS_GENMASK(7, 0)
56
57#define AD8460_SHUTDOWN_FLAG_MSK NO_OS_BIT(7)
58
59#define AD8460_DATA_BYTE_LOW_MSK NO_OS_GENMASK(7, 0)
60#define AD8460_DATA_BYTE_HIGH_MSK NO_OS_GENMASK(5, 0)
61#define AD8460_DATA_BYTE_FULL_MSK NO_OS_GENMASK(13, 0)
62
63#define AD8460_DEFAULT_FAULT_PROTECT 0x00
64#define AD8460_DATA_BYTE_WORD_LENGTH 2
65#define AD8460_NUM_DATA_WORDS 16
66#define AD8460_NOMINAL_VOLTAGE_SPAN 80
67#define AD8460_MIN_EXT_RESISTOR_OHMS 2000
68#define AD8460_MAX_EXT_RESISTOR_OHMS 20000
69#define AD8460_MIN_VREFIO_UV 120000
70#define AD8460_MAX_VREFIO_UV 1200000
71#define AD8460_ABS_MAX_OVERVOLTAGE_UV 55000000
72#define AD8460_ABS_MAX_OVERCURRENT_UA 1000000
73#define AD8460_MAX_OVERTEMPERATURE_MC 150000
74#define AD8460_MIN_OVERTEMPERATURE_MC 20000
75#define AD8460_CURRENT_LIMIT_CONV(x) ((x) / 15625)
76#define AD8460_VOLTAGE_LIMIT_CONV(x) ((x) / 1953000)
77#define AD8460_TEMP_LIMIT_CONV(x) (((x) + 266640) / 6510)
78
92
106
108int ad8460_reg_read(struct ad8460_device *dev, uint8_t addr, uint8_t *val);
109
111int ad8460_reg_write(struct ad8460_device *dev, uint8_t addr, uint8_t val);
112
114int ad8460_reg_update_bits(struct ad8460_device *dev, uint8_t addr,
115 uint8_t mask, uint8_t val);
116
118int ad8460_init(struct ad8460_device **dev,
120
122int ad8460_remove(struct ad8460_device *dev);
123
125int ad8460_reset(struct ad8460_device *dev);
126
128int ad8460_get_hvdac_word(struct ad8460_device *dev, int8_t index,
129 uint16_t *val);
130
132int ad8460_set_hvdac_word(struct ad8460_device *dev, int8_t index,
133 uint16_t val);
134
136int ad8460_enable_apg_mode(struct ad8460_device *dev, int val);
137
139int ad8460_read_shutdown_flag(struct ad8460_device *dev, uint8_t *flag);
140
142int ad8460_hv_reset(struct ad8460_device *dev);
143
145int ad8460_set_sample(struct ad8460_device *dev, uint16_t val);
146
147#endif /* __AD8460_H__ */
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
int ad8460_reset(struct ad8460_device *dev)
Reset the AD8460 device.
Definition ad8460.c:181
int ad8460_read_shutdown_flag(struct ad8460_device *dev, uint8_t *flag)
Read the shutdown flag.
Definition ad8460.c:269
int ad8460_init(struct ad8460_device **dev, struct ad8460_init_param *init_param)
Device and comm init function.
Definition ad8460.c:115
int ad8460_enable_apg_mode(struct ad8460_device *dev, int val)
Enable or disable the APG mode.
Definition ad8460.c:252
int ad8460_get_hvdac_word(struct ad8460_device *dev, int8_t index, uint16_t *val)
Get the value of a high voltage DAC word.
Definition ad8460.c:207
int ad8460_set_hvdac_word(struct ad8460_device *dev, int8_t index, uint16_t val)
Set the value of a high voltage DAC word.
Definition ad8460.c:233
int ad8460_remove(struct ad8460_device *dev)
Free resources allocated by the init function.
Definition ad8460.c:160
int ad8460_reg_write(struct ad8460_device *dev, uint8_t addr, uint8_t val)
Write a register value.
Definition ad8460.c:75
int ad8460_hv_reset(struct ad8460_device *dev)
Reset the high voltage driver.
Definition ad8460.c:288
int ad8460_reg_update_bits(struct ad8460_device *dev, uint8_t addr, uint8_t mask, uint8_t val)
Read-modify-write operation.
Definition ad8460.c:93
int ad8460_set_sample(struct ad8460_device *dev, uint16_t val)
Set the sample value.
Definition ad8460.c:307
int ad8460_reg_read(struct ad8460_device *dev, uint8_t addr, uint8_t *val)
Read a register value.
Definition ad8460.c:51
Header file of GPIO Interface.
Header file of SPI Interface.
Header file of utility functions.
AD8460 descriptor.
Definition ad8460.h:82
uint32_t ext_resistor_ohms
Definition ad8460.h:90
struct no_os_spi_desc * spi_desc
Definition ad8460.h:84
int refio_1p2v_mv
Definition ad8460.h:88
struct no_os_gpio_desc * gpio_rstn
Definition ad8460.h:86
AD8460 init param.
Definition ad8460.h:96
struct no_os_gpio_init_param gpio_rstn
Definition ad8460.h:100
int refio_1p2v_mv
Definition ad8460.h:102
struct no_os_spi_init_param spi_init_param
Definition ad8460.h:98
uint32_t ext_resistor_ohms
Definition ad8460.h:104
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128