Header file of AD5766 Driver.
More...
#include <stdint.h>
#include "no_os_delay.h"
#include "no_os_gpio.h"
#include "no_os_spi.h"
|
| enum | ad5766_state {
AD5766_ENABLE
,
AD5766_DISABLE
} |
| |
| enum | ad5766_dac {
AD5766_DAC_0
,
AD5766_DAC_1
,
AD5766_DAC_2
,
AD5766_DAC_3
,
AD5766_DAC_4
,
AD5766_DAC_5
,
AD5766_DAC_6
,
AD5766_DAC_7
,
AD5766_DAC_8
,
AD5766_DAC_9
,
AD5766_DAC_10
,
AD5766_DAC_11
,
AD5766_DAC_12
,
AD5766_DAC_13
,
AD5766_DAC_14
,
AD5766_DAC_15
} |
| |
| enum | ad5766_span {
AD5766_M_20V_TO_0V
,
AD5766_M_16V_TO_0V
,
AD5766_M_10V_TO_0V
,
AD5766_M_12V_TO_P_14V
,
AD5766_M_16V_TO_P_10V
,
AD5766_M_5V_TO_P_6V
,
AD5766_M_10V_TO_P_10V
} |
| |
| enum | ad5766_clr {
AD5766_ZERO
,
AD5766_MID
,
AD5766_FULL
} |
| |
|
| int32_t | ad5766_spi_cmd_write (struct ad5766_dev *dev, uint8_t cmd, uint16_t data) |
| |
| int32_t | ad5766_spi_readback_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint32_t *data) |
| |
| int32_t | ad5766_set_sw_ldac (struct ad5766_dev *dev, uint16_t setting) |
| |
| int32_t | ad5766_set_clr_span (struct ad5766_dev *dev, enum ad5766_clr clr, enum ad5766_span span) |
| |
| int32_t | ad5766_set_pwr_dac (struct ad5766_dev *dev, uint16_t setting) |
| |
| int32_t | ad5766_set_pwr_dither (struct ad5766_dev *dev, uint16_t setting) |
| |
| int32_t | ad5766_set_dither_signal (struct ad5766_dev *dev, uint32_t setting) |
| |
| int32_t | ad5766_set_inv_dither (struct ad5766_dev *dev, uint16_t setting) |
| |
| int32_t | ad5766_set_dither_scale (struct ad5766_dev *dev, uint32_t setting) |
| |
| int32_t | ad5766_do_soft_reset (struct ad5766_dev *dev) |
| |
| int32_t | ad5766_set_in_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint16_t data) |
| |
| int32_t | ad5766_set_dac_reg (struct ad5766_dev *dev, enum ad5766_dac dac, uint16_t data) |
| |
| int32_t | ad5766_set_dac_reg_all (struct ad5766_dev *dev, uint16_t data) |
| |
| int32_t | ad5766_init (struct ad5766_dev **device, struct ad5766_init_param init_param) |
| |
| int32_t | ad5766_remove (struct ad5766_dev *dev) |
| | Free the resources allocated by ad5766_init().
|
| |
Header file of AD5766 Driver.
- Author
- DBogdan (drago.nosp@m.s.bo.nosp@m.gdan@.nosp@m.anal.nosp@m.og.co.nosp@m.m)
Copyright 2016(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ AD5766_25
◆ AD5766_50
◆ AD5766_75
◆ AD5766_CFG_CLR
| #define AD5766_CFG_CLR |
( |
| x | ) |
|
◆ AD5766_CMD_DITHER_SCALE_1
| #define AD5766_CMD_DITHER_SCALE_1 0xC0 |
◆ AD5766_CMD_DITHER_SCALE_2
| #define AD5766_CMD_DITHER_SCALE_2 0xD0 |
◆ AD5766_CMD_DITHER_SIG_1
| #define AD5766_CMD_DITHER_SIG_1 0x90 |
◆ AD5766_CMD_DITHER_SIG_2
| #define AD5766_CMD_DITHER_SIG_2 0xA0 |
◆ AD5766_CMD_INV_DITHER
| #define AD5766_CMD_INV_DITHER 0xB0 |
◆ AD5766_CMD_NOP_MUX_OUT
| #define AD5766_CMD_NOP_MUX_OUT 0x00 |
◆ AD5766_CMD_READBACK_REG
| #define AD5766_CMD_READBACK_REG |
( |
| x | ) |
|
◆ AD5766_CMD_SDO_CNTRL
| #define AD5766_CMD_SDO_CNTRL 0x01 |
◆ AD5766_CMD_SPAN_REG
| #define AD5766_CMD_SPAN_REG 0x40 |
◆ AD5766_CMD_SW_FULL_RESET
| #define AD5766_CMD_SW_FULL_RESET 0x70 |
◆ AD5766_CMD_SW_LDAC
| #define AD5766_CMD_SW_LDAC 0x30 |
◆ AD5766_CMD_WR_DAC_REG
| #define AD5766_CMD_WR_DAC_REG |
( |
| x | ) |
|
◆ AD5766_CMD_WR_DAC_REG_ALL
| #define AD5766_CMD_WR_DAC_REG_ALL 0x60 |
◆ AD5766_CMD_WR_IN_REG
| #define AD5766_CMD_WR_IN_REG |
( |
| x | ) |
|
◆ AD5766_CMD_WR_PWR_DAC
| #define AD5766_CMD_WR_PWR_DAC 0x50 |
◆ AD5766_CMD_WR_PWR_DITHER
| #define AD5766_CMD_WR_PWR_DITHER 0x51 |
◆ AD5766_INV_D
| #define AD5766_INV_D |
( |
| x | ) |
|
◆ AD5766_LDAC
◆ AD5766_N0
◆ AD5766_N1
◆ AD5766_PWDN
◆ AD5766_RESET
| #define AD5766_RESET 0x1234 |
◆ AD5766_SDO_EN
| #define AD5766_SDO_EN (1 << 0) |
◆ AD5766_SPAN
◆ ad5766_clr
| Enumerator |
|---|
| AD5766_ZERO | |
| AD5766_MID | |
| AD5766_FULL | |
◆ ad5766_dac
| Enumerator |
|---|
| AD5766_DAC_0 | |
| AD5766_DAC_1 | |
| AD5766_DAC_2 | |
| AD5766_DAC_3 | |
| AD5766_DAC_4 | |
| AD5766_DAC_5 | |
| AD5766_DAC_6 | |
| AD5766_DAC_7 | |
| AD5766_DAC_8 | |
| AD5766_DAC_9 | |
| AD5766_DAC_10 | |
| AD5766_DAC_11 | |
| AD5766_DAC_12 | |
| AD5766_DAC_13 | |
| AD5766_DAC_14 | |
| AD5766_DAC_15 | |
◆ ad5766_span
| Enumerator |
|---|
| AD5766_M_20V_TO_0V | |
| AD5766_M_16V_TO_0V | |
| AD5766_M_10V_TO_0V | |
| AD5766_M_12V_TO_P_14V | |
| AD5766_M_16V_TO_P_10V | |
| AD5766_M_5V_TO_P_6V | |
| AD5766_M_10V_TO_P_10V | |
◆ ad5766_state
| Enumerator |
|---|
| AD5766_ENABLE | |
| AD5766_DISABLE | |
◆ ad5766_do_soft_reset()
| int32_t ad5766_do_soft_reset |
( |
struct ad5766_dev * | dev | ) |
|
Do a software reset.
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_init()
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.
◆ ad5766_remove()
Free the resources allocated by ad5766_init().
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_clr_span()
Set clear code and span settings.
- Parameters
-
| dev | - The device structure. |
| clr | - The clear code setting. Accepted values: AD5766_ZERO AD5766_MID AD5766_FULL |
| span | - The span setting. Accepted values: AD5766_M_20V_TO_0V AD5766_M_16V_TO_0V AD5766_M_10V_TO_0V AD5766_M_12V_TO_P_14V AD5766_M_16V_TO_P_10V AD5766_M_5V_TO_P_6V AD5766_M_10V_TO_P_10V |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_dac_reg()
Set the DAC register for the selected channel.
- Parameters
-
| dev | - The device structure. |
| dac | - The selected channel. |
| data | - The register data. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_dac_reg_all()
| int32_t ad5766_set_dac_reg_all |
( |
struct ad5766_dev * | dev, |
|
|
uint16_t | data ) |
Set the DAC register for all channels.
- Parameters
-
| dev | - The device structure. |
| data | - The register data. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_dither_scale()
| int32_t ad5766_set_dither_scale |
( |
struct ad5766_dev * | dev, |
|
|
uint32_t | setting ) |
Enable the dither scaling for the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_dither_signal()
| int32_t ad5766_set_dither_signal |
( |
struct ad5766_dev * | dev, |
|
|
uint32_t | setting ) |
Enable the dither signal for the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_in_reg()
Set the input register for the selected channel.
- Parameters
-
| dev | - The device structure. |
| dac | - The selected channel. |
| data | - The register data. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_inv_dither()
| int32_t ad5766_set_inv_dither |
( |
struct ad5766_dev * | dev, |
|
|
uint16_t | setting ) |
Invert the dither signal for the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_pwr_dac()
| int32_t ad5766_set_pwr_dac |
( |
struct ad5766_dev * | dev, |
|
|
uint16_t | setting ) |
Power down the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_pwr_dither()
| int32_t ad5766_set_pwr_dither |
( |
struct ad5766_dev * | dev, |
|
|
uint16_t | setting ) |
Power down the dither block for the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_set_sw_ldac()
| int32_t ad5766_set_sw_ldac |
( |
struct ad5766_dev * | dev, |
|
|
uint16_t | setting ) |
Set software LDAC for the selected channels.
- Parameters
-
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_spi_cmd_write()
| int32_t ad5766_spi_cmd_write |
( |
struct ad5766_dev * | dev, |
|
|
uint8_t | cmd, |
|
|
uint16_t | data ) |
SPI command write to device.
- Parameters
-
| dev | - The device structure. |
| cmd | - The command. |
| data | - The data. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5766_spi_readback_reg()
SPI readback register from device.
- Parameters
-
| dev | - The device structure. |
| dac | - The dac address. |
| data | - The register data. |
- Returns
- 0 in case of success, negative error code otherwise.