no-OS
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
ad5446.h
Go to the documentation of this file.
1/***************************************************************************/
36
37#include <stdint.h>
38#include "no_os_gpio.h"
39#include "no_os_spi.h"
40
41/* Custom type for active clock edge */
46
47/* Custom boolean type */
48enum bool_t {
49 false,
50 true
51};
52
53/* Data structure for chip's attributes */
59
60/* Supported output types */
62 unipolar, /* 0 .. Vref */
63 unipolar_inv, /* 0 .. -Vref */
64 bipolar /* -Vref .. Vref*/
65};
66
67/* Supported devices */
82
83struct ad5446_dev {
84 /* SPI */
86 /* GPIO */
89 /* Device Settings */
91};
92
94 /* SPI */
96 /* GPIO */
99 /* Device Settings */
101};
102
103/* Control Bits */
104#define AD5446_CTRL_LOAD_UPDATE 0x0
105#define AD5446_CTRL_ACTIVE_POSEDGE 0x3
106
107/* AD5446 GPIO */
108#define AD5446_LDAC_OUT no_os_gpio_direction_output(dev->gpio_ladc, \
109 NO_OS_GPIO_HIGH)
110#define AD5446_LDAC_LOW no_os_gpio_set_value(dev->gpio_ladc, \
111 NO_OS_GPIO_LOW)
112#define AD5446_LDAC_HIGH no_os_gpio_set_value(dev->gpio_ladc, \
113 NO_OS_GPIO_HIGH)
114
115#define AD5446_CLR_OUT no_os_gpio_direction_output(dev->gpio_clrout, \
116 NO_OS_GPIO_HIGH)
117#define AD5446_CLR_LOW no_os_gpio_set_value(dev->gpio_clrout, \
118 NO_OS_GPIO_LOW)
119#define AD5446_CLR_HIGH no_os_gpio_set_value(dev->gpio_clrout, \
120 NO_OS_GPIO_HIGH)
121
122/* Initialize SPI and Initial Values for AD5446 Board. */
123int8_t ad5446_init(struct ad5446_dev **device,
125
126/* Free the resources allocated by ad5446_init(). */
127int32_t ad5446_remove(struct ad5446_dev *dev);
128
129/* Write to shift register via SPI. */
130void ad5446_set_register(struct ad5446_dev *dev,
131 uint8_t command,
132 uint16_t data);
133
134/* Sets the output voltage. */
135float ad5446_set_voltage(struct ad5446_dev *dev,
136 float voltage,
137 float vref,
138 enum vout_type_t vout_type);
bool_t
Definition ad5446.h:48
int32_t ad5446_remove(struct ad5446_dev *dev)
Free the resources allocated by ad5446_init().
Definition ad5446.c:172
vout_type_t
Definition ad5446.h:61
@ unipolar
Definition ad5446.h:62
@ unipolar_inv
Definition ad5446.h:63
@ bipolar
Definition ad5446.h:64
active_clk_t
Definition ad5446.h:42
@ negedge
Definition ad5446.h:43
@ posedge
Definition ad5446.h:44
void ad5446_set_register(struct ad5446_dev *dev, uint8_t command, uint16_t data)
Writes to input register via SPI.
Definition ad5446.c:193
ad5446_type_t
Definition ad5446.h:68
@ ID_AD5541A
Definition ad5446.h:73
@ ID_AD5444
Definition ad5446.h:80
@ ID_AD5452
Definition ad5446.h:76
@ ID_AD5543
Definition ad5446.h:71
@ ID_AD5512A
Definition ad5446.h:74
@ ID_AD5553
Definition ad5446.h:70
@ ID_AD5446
Definition ad5446.h:79
@ ID_AD5542A
Definition ad5446.h:72
@ ID_AD5450
Definition ad5446.h:78
@ ID_AD5451
Definition ad5446.h:77
@ ID_AD5600
Definition ad5446.h:69
@ ID_AD5453
Definition ad5446.h:75
int8_t ad5446_init(struct ad5446_dev **device, struct ad5446_init_param init_param)
Initialize SPI and Initial Values for AD5446 Board.
Definition ad5446.c:126
float ad5446_set_voltage(struct ad5446_dev *dev, float voltage, float vref, enum vout_type_t vout_type)
Sets the output voltage.
Definition ad5446.c:225
struct ad7616_init_param init_param
Definition ad7616_sdz.c:107
Header file of GPIO Interface.
Header file of SPI Interface.
Definition ad5446.h:54
enum active_clk_t data_clock_in
Definition ad5446.h:56
uint8_t resolution
Definition ad5446.h:55
enum bool_t has_ctrl
Definition ad5446.h:57
Definition ad5446.h:83
enum ad5446_type_t act_device
Definition ad5446.h:90
struct no_os_spi_desc * spi_desc
Definition ad5446.h:85
struct no_os_gpio_desc * gpio_clrout
Definition ad5446.h:88
struct no_os_gpio_desc * gpio_ladc
Definition ad5446.h:87
Definition ad5446.h:93
struct no_os_gpio_init_param gpio_clrout
Definition ad5446.h:98
struct no_os_spi_init_param spi_init
Definition ad5446.h:95
struct no_os_gpio_init_param gpio_ladc
Definition ad5446.h:97
enum ad5446_type_t act_device
Definition ad5446.h:100
Definition ad9361_util.h:63
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