Go to the documentation of this file.
46 #define AD5686_CTRL_NOP 0
47 #define AD5686_CTRL_WRITE 1
48 #define AD5686_CTRL_UPDATE 2
49 #define AD5686_CTRL_WRITEUPDATE 3
50 #define AD5686_CTRL_PWR 4
51 #define AD5686_CTRL_LDAC_MASK 5
52 #define AD5686_CTRL_SWRESET 6
53 #define AD5686_CTRL_IREF_REG 7
54 #define AD5686_CTRL_DCEN 8
55 #define AD5686_CTRL_RB_REG 9
57 #define AD5683_CMD_WR_CTRL_REG 4
58 #define AD5683_CTRL_RB_REG 5
61 #define AD5686_PWRM_NORMAL 0
62 #define AD5686_PWRM_1K 1
63 #define AD5686_PWRM_100K 2
64 #define AD5686_PWRM_THREESTATE 3
66 #define AD5686_PWRM_MASK 3
69 #define AD5686_INTREF_EN 1
70 #define AD5686_INTREF_DIS 0
71 #define AD5686_DC_EN 1
72 #define AD5686_DC_DIS 0
73 #define AD5686_RB_EN 1
74 #define AD5686_RB_DIS 0
76 #define MAX_RESOLUTION 16 // Maximum resolution of the supported devices
78 #define PKT_LENGTH 3 // SPI packet length in byte
80 #define ADDR_MASK 0xFF // Mask for Address bits
81 #define CMD_OFFSET 4 // Offset for Command
83 #define AD5686_CMD_MASK 0xFF
84 #define AD5686_MSB_MASK 0xFF00 // Most significant byte of the data word
85 #define AD5686_MSB_OFFSET 8
86 #define AD5686_LSB_MASK 0x00FF // Least significant byte of the data word
87 #define AD5686_LSB_OFFSET 0
89 #define AD5683_MIDB_OFFSET 4 // Offset for middle bits
90 #define AD5683_MIDB_MASK 0xFF
91 #define AD5683_MSB_OFFSET 12
92 #define AD5683_MSB_MASK 0xF
93 #define AD5683_CMD_MASK 0xF
94 #define AD5683_LSB_MASK 0xF
95 #define AD5683_LSB_OFFSET 4
97 #define AD5683_REG_MAP 0
98 #define AD5686_REG_MAP 1
102 #define AD5683_CTRL_DCEN(x) (((((x) & 0x1) << 0) << 10) & 0xFC00)
103 #define AD5683_CTRL_GM(x) (((((x) & 0x1) << 1) << 10) & 0xFC00)
104 #define AD5683_CTRL_INT_REF(x) (((((x) & 0x1) << 2) << 10) & 0xFC00)
105 #define AD5683_CTRL_PWRM(x) (((((x) & 0x3) << 3) << 10) & 0xFC00)
106 #define AD5683_SW_RESET ((((0x1) << 5) << 10) & 0xFC00)
@ ID_AD5684R
Definition: ad5686.h:126
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
struct no_os_gpio_desc * gpio_ldac
Definition: ad5686.h:187
#define AD5686_CTRL_RB_REG
Definition: ad5686.h:55
@ I2C
Definition: ad5686.h:151
int32_t no_os_i2c_write(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Write data to slave device.
Definition: no_os_i2c.c:159
int32_t no_os_i2c_init(struct no_os_i2c_desc **desc, const struct no_os_i2c_init_param *param)
Initialize the I2C communication peripheral.
Definition: no_os_i2c.c:52
@ AD5686_CH_7
Definition: ad5686.h:162
uint8_t register_map
Definition: ad5686.h:175
@ AD5686_CH_2
Definition: ad5686.h:157
@ ID_AD5676
Definition: ad5686.h:120
void ad5686_read_back_en(struct ad5686_dev *dev, uint8_t value)
Set up readback register (readback enable)
Definition: ad5686.c:733
#define AD5686_CTRL_NOP
Definition: ad5686.h:46
int32_t no_os_spi_write_and_read(struct no_os_spi_desc *desc, uint8_t *data, uint16_t bytes_number)
Write and read data to/from SPI.
Definition: no_os_spi.c:159
@ ID_AD5689R
Definition: ad5686.h:132
@ ID_AD5675R
Definition: ad5686.h:119
#define AD5686_CTRL_DCEN
Definition: ad5686.h:54
int32_t ad5686_gain_mode(struct ad5686_dev *dev, uint8_t value)
Set Gain mode.
Definition: ad5686.c:751
Header file of SPI Interface.
uint32_t ldac_mask
Definition: ad5686.h:192
@ AD5686_CH_13
Definition: ad5686.h:168
@ AD5686_CH_9
Definition: ad5686.h:164
#define AD5683_MIDB_MASK
Definition: ad5686.h:90
void ad5686_write_update_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data)
Write to and update DAC channel n.
Definition: ad5686.c:511
int32_t no_os_i2c_remove(struct no_os_i2c_desc *desc)
Free the resources allocated by no_os_i2c_init().
Definition: no_os_i2c.c:113
#define AD5686_CTRL_WRITE
Definition: ad5686.h:47
@ AD5686_CH_6
Definition: ad5686.h:161
@ ID_AD5692R
Definition: ad5686.h:144
struct no_os_gpio_desc * gpio_reset
Definition: ad5686.h:186
@ SPI
Definition: ad5686.h:150
#define CMD_OFFSET
Definition: ad5446.c:51
#define AD5683_SW_RESET
Definition: ad5686.h:106
@ AD5686_CH_8
Definition: ad5686.h:163
#define AD5683_MIDB_OFFSET
Definition: ad5686.h:89
#define AD5683_CTRL_DCEN(x)
Definition: ad5686.h:102
@ ID_AD5681R
Definition: ad5686.h:139
#define PKT_LENGTH
Definition: ad5446.c:52
uint16_t ad5686_set_shift_reg(struct ad5686_dev *dev, uint8_t command, uint8_t address, uint16_t data)
Write to input shift register.
Definition: ad5686.c:384
Definition: ad9361_util.h:69
#define AD5683_CTRL_GM(x)
Definition: ad5686.h:103
@ AD5686_CH_4
Definition: ad5686.h:159
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
Header file of AD5686 Driver. This driver supporting the following devices: AD5684R,...
void ad5686_ldac_mask(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t enable)
Set hardware LDAC mask register.
Definition: ad5686.c:657
#define AD5683_CTRL_RB_REG
Definition: ad5686.h:58
@ AD5686_CH_0
Definition: ad5686.h:155
@ AD5686_CH_12
Definition: ad5686.h:167
@ AD5686_CH_3
Definition: ad5686.h:158
void ad5686_daisy_chain_en(struct ad5686_dev *dev, uint8_t value)
Set up DCEN register (daisy-chain enable)
Definition: ad5686.c:714
#define AD5683_CMD_WR_CTRL_REG
Definition: ad5686.h:57
void ad5686_ldac_mask(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t enable)
Set hardware LDAC mask register.
Definition: ad5686.c:657
@ ID_AD5674R
Definition: ad5686.h:118
void ad5686_software_reset(struct ad5686_dev *dev)
Software reset (power-on reset)
Definition: ad5686.c:675
@ ID_AD5693
Definition: ad5686.h:146
uint16_t ad5686_read_back_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel)
Read back Input Register n.
Definition: ad5686.c:549
enum ad5686_type act_device
Definition: ad5686.h:190
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
uint32_t power_down_mask
Definition: ad5686.h:191
@ ID_AD5673R
Definition: ad5686.h:116
#define AD5686_CTRL_UPDATE
Definition: ad5686.h:48
int32_t ad5686_gain_mode(struct ad5686_dev *dev, uint8_t value)
Set Gain mode.
Definition: ad5686.c:751
struct no_os_i2c_init_param i2c_init
Definition: ad5686.h:197
@ ID_AD5685R
Definition: ad5686.h:127
@ ID_AD5686
Definition: ad5686.h:125
void ad5686_write_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data)
Write to Input Register n (dependent on LDAC)
Definition: ad5686.c:443
#define AD5686_CTRL_IREF_REG
Definition: ad5686.h:53
@ I2C
Definition: adxl372.h:317
ad5686_type
Definition: ad5686.h:113
@ ID_AD5691R
Definition: ad5686.h:143
struct no_os_spi_desc * spi_desc
Definition: ad5686.h:184
enum ad5686_type act_device
Definition: ad5686.h:205
#define AD5686_MSB_OFFSET
Definition: ad5686.h:85
@ ID_AD5687R
Definition: ad5686.h:130
#define AD5683_MSB_OFFSET
Definition: ad5686.h:91
@ ID_AD5697R
Definition: ad5686.h:133
#define AD5683_LSB_OFFSET
Definition: ad5686.h:95
#define AD5686_MSB_MASK
Definition: ad5686.h:84
@ ID_AD5672R
Definition: ad5686.h:115
void ad5686_internal_reference(struct ad5686_dev *dev, uint8_t value)
Write to Internal reference setup register.
Definition: ad5686.c:694
uint8_t resolution
Definition: ad5686.h:174
uint16_t ad5686_read_back_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel)
Read back Input Register n.
Definition: ad5686.c:549
@ AD5686_CH_11
Definition: ad5686.h:166
uint16_t ad5686_set_shift_reg(struct ad5686_dev *dev, uint8_t command, uint8_t address, uint16_t data)
Write to input shift register.
Definition: ad5686.c:384
void ad5686_update_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel)
Update DAC Register n with contents of Input Register n.
Definition: ad5686.c:478
@ AD5686_CH_14
Definition: ad5686.h:169
void ad5686_read_back_en(struct ad5686_dev *dev, uint8_t value)
Set up readback register (readback enable)
Definition: ad5686.c:733
#define AD5686_CTRL_PWR
Definition: ad5686.h:50
void ad5686_write_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data)
Write to Input Register n (dependent on LDAC)
Definition: ad5686.c:443
struct no_os_i2c_desc * i2c_desc
Definition: ad5686.h:182
@ ID_AD5694R
Definition: ad5686.h:135
const uint32_t * channel_addr
Definition: ad5686.h:177
#define AD5686_CTRL_SWRESET
Definition: ad5686.h:52
struct no_os_gpio_init_param gpio_ldac
Definition: ad5686.h:202
void ad5686_power_mode(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t mode)
Set Power-down mode for DAC channel n.
Definition: ad5686.c:611
@ ID_AD5682R
Definition: ad5686.h:140
@ ID_AD5696
Definition: ad5686.h:137
#define AD5683_CTRL_INT_REF(x)
Definition: ad5686.h:104
void ad5686_software_reset(struct ad5686_dev *dev)
Software reset (power-on reset)
Definition: ad5686.c:675
int32_t no_os_gpio_remove(struct no_os_gpio_desc *desc)
Free the resources allocated by no_os_gpio_get().
Definition: no_os_gpio.c:104
@ AD5686_CH_5
Definition: ad5686.h:160
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
@ ID_AD5677R
Definition: ad5686.h:122
@ ID_AD5676R
Definition: ad5686.h:121
void ad5686_power_mode(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t mode)
Set Power-down mode for DAC channel n.
Definition: ad5686.c:611
@ ID_AD5683R
Definition: ad5686.h:141
@ ID_AD5679
Definition: ad5686.h:123
int32_t ad5686_init(struct ad5686_dev **device, struct ad5686_init_param init_param)
Initializes the communication peripheral and the initial Values for AD5686 Board.
Definition: ad5686.c:306
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
void ad5686_update_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel)
Update DAC Register n with contents of Input Register n.
Definition: ad5686.c:478
@ ID_AD5674
Definition: ad5686.h:117
@ ID_AD5687
Definition: ad5686.h:129
#define AD5686_CTRL_LDAC_MASK
Definition: ad5686.h:51
@ ID_AD5696R
Definition: ad5686.h:138
Structure holding I2C address descriptor.
Definition: no_os_i2c.h:101
int32_t no_os_gpio_get(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Obtain the GPIO decriptor.
Definition: no_os_gpio.c:49
int32_t no_os_i2c_read(struct no_os_i2c_desc *desc, uint8_t *data, uint8_t bytes_number, uint8_t stop_bit)
I2C Read data from slave device.
Definition: no_os_i2c.c:190
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
@ AD5686_CH_1
Definition: ad5686.h:156
Header file of I2C Interface.
@ ID_AD5689
Definition: ad5686.h:131
#define AD5683_LSB_MASK
Definition: ad5686.h:94
void ad5686_daisy_chain_en(struct ad5686_dev *dev, uint8_t value)
Set up DCEN register (daisy-chain enable)
Definition: ad5686.c:714
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
@ AD5686_CH_15
Definition: ad5686.h:170
int32_t ad5686_init(struct ad5686_dev **device, struct ad5686_init_param init_param)
Initializes the communication peripheral and the initial Values for AD5686 Board.
Definition: ad5686.c:306
@ ID_AD5679R
Definition: ad5686.h:124
@ ID_AD5686R
Definition: ad5686.h:128
@ ID_AD5695R
Definition: ad5686.h:136
ad5686_dac_channels
Definition: ad5686.h:154
Structure holding the parameters for I2C initialization.
Definition: no_os_i2c.h:64
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define AD5686_CMD_MASK
Definition: ad5686.h:83
#define AD5683_MSB_MASK
Definition: ad5686.h:92
#define MAX_RESOLUTION
Definition: ad5446.c:43
enum comm_type communication
Definition: ad5686.h:176
#define AD5683_REG_MAP
Definition: ad5686.h:97
@ AD5686_CH_10
Definition: ad5686.h:165
int32_t no_os_spi_remove(struct no_os_spi_desc *desc)
Free the resources allocated by no_os_spi_init().
Definition: no_os_spi.c:116
Header file of GPIO Interface.
void ad5686_internal_reference(struct ad5686_dev *dev, uint8_t value)
Write to Internal reference setup register.
Definition: ad5686.c:694
#define AD5683_CTRL_PWRM(x)
Definition: ad5686.h:105
int32_t no_os_spi_init(struct no_os_spi_desc **desc, const struct no_os_spi_init_param *param)
Initialize the SPI communication peripheral.
Definition: no_os_spi.c:52
@ ID_AD5683
Definition: ad5686.h:142
#define AD5686_REG_MAP
Definition: ad5686.h:98
struct no_os_spi_init_param spi_init
Definition: ad5686.h:199
comm_type
Definition: ad5686.h:149
@ SPI
Definition: adxl372.h:316
#define AD5683_CMD_MASK
Definition: ad5686.h:93
#define AD5686_CTRL_WRITEUPDATE
Definition: ad5686.h:49
void ad5686_write_update_register(struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data)
Write to and update DAC channel n.
Definition: ad5686.c:511
int32_t no_os_gpio_direction_output(struct no_os_gpio_desc *desc, uint8_t value)
Enable the output direction of the specified GPIO.
Definition: no_os_gpio.c:147
#define ADDR_MASK
Definition: ad5686.h:80
struct no_os_gpio_init_param gpio_gain
Definition: ad5686.h:203
@ ID_AD5693R
Definition: ad5686.h:145
int32_t ad5686_remove(struct ad5686_dev *dev)
Free the resources allocated by ad5686_init().
Definition: ad5686.c:351
struct no_os_gpio_desc * gpio_gain
Definition: ad5686.h:188
struct no_os_gpio_init_param gpio_reset
Definition: ad5686.h:201
#define AD5686_LSB_MASK
Definition: ad5686.h:86
@ ID_AD5694
Definition: ad5686.h:134
@ ID_AD5671R
Definition: ad5686.h:114
int32_t ad5686_remove(struct ad5686_dev *dev)
Free the resources allocated by ad5686_init().
Definition: ad5686.c:351
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140