no-OS
|
Header file of AD5686 Driver. This driver supporting the following devices: AD5684R, AD5685R, AD5686R, AD5694R, AD5695R, AD5696R,. More...
Go to the source code of this file.
Classes | |
struct | ad5686_chip_info |
struct | ad5686_dev |
struct | ad5686_init_param |
Enumerations | |
enum | ad5686_type { ID_AD5671R, ID_AD5672R, ID_AD5673R, ID_AD5674, ID_AD5674R, ID_AD5675R, ID_AD5676, ID_AD5676R, ID_AD5677R, ID_AD5679, ID_AD5679R, ID_AD5686, ID_AD5684R, ID_AD5685R, ID_AD5686R, ID_AD5687, ID_AD5687R, ID_AD5689, ID_AD5689R, ID_AD5697R, ID_AD5694, ID_AD5694R, ID_AD5695R, ID_AD5696, ID_AD5696R, ID_AD5681R, ID_AD5682R, ID_AD5683R, ID_AD5683, ID_AD5691R, ID_AD5692R, ID_AD5693R, ID_AD5693 } |
enum | comm_type { SPI, I2C } |
enum | ad5686_dac_channels { AD5686_CH_0 = 0, AD5686_CH_1, AD5686_CH_2, AD5686_CH_3, AD5686_CH_4, AD5686_CH_5, AD5686_CH_6, AD5686_CH_7, AD5686_CH_8, AD5686_CH_9, AD5686_CH_10, AD5686_CH_11, AD5686_CH_12, AD5686_CH_13, AD5686_CH_14, AD5686_CH_15 } |
Functions | |
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. More... | |
int32_t | ad5686_remove (struct ad5686_dev *dev) |
Free the resources allocated by ad5686_init(). More... | |
uint16_t | ad5686_set_shift_reg (struct ad5686_dev *dev, uint8_t command, uint8_t address, uint16_t data) |
Write to input shift register. More... | |
void | ad5686_write_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data) |
Write to Input Register n (dependent on LDAC) More... | |
void | ad5686_update_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel) |
Update DAC Register n with contents of Input Register n. More... | |
void | ad5686_write_update_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint16_t data) |
Write to and update DAC channel n. More... | |
uint16_t | ad5686_read_back_register (struct ad5686_dev *dev, enum ad5686_dac_channels channel) |
Read back Input Register n. More... | |
void | ad5686_power_mode (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t mode) |
Set Power-down mode for DAC channel n. More... | |
void | ad5686_ldac_mask (struct ad5686_dev *dev, enum ad5686_dac_channels channel, uint8_t enable) |
Set hardware LDAC mask register. More... | |
void | ad5686_software_reset (struct ad5686_dev *dev) |
Software reset (power-on reset) More... | |
void | ad5686_internal_reference (struct ad5686_dev *dev, uint8_t value) |
Write to Internal reference setup register. More... | |
void | ad5686_daisy_chain_en (struct ad5686_dev *dev, uint8_t value) |
Set up DCEN register (daisy-chain enable) More... | |
void | ad5686_read_back_en (struct ad5686_dev *dev, uint8_t value) |
Set up readback register (readback enable) More... | |
int32_t | ad5686_gain_mode (struct ad5686_dev *dev, uint8_t value) |
Set Gain mode. More... | |
Header file of AD5686 Driver. This driver supporting the following devices: AD5684R, AD5685R, AD5686R, AD5694R, AD5695R, AD5696R,.
Copyright 2013, 2020(c) Analog Devices, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
#define AD5683_CMD_MASK 0xF |
#define AD5683_CMD_WR_CTRL_REG 4 |
#define AD5683_CTRL_DCEN | ( | x | ) | (((((x) & 0x1) << 0) << 10) & 0xFC00) |
#define AD5683_CTRL_GM | ( | x | ) | (((((x) & 0x1) << 1) << 10) & 0xFC00) |
#define AD5683_CTRL_INT_REF | ( | x | ) | (((((x) & 0x1) << 2) << 10) & 0xFC00) |
#define AD5683_CTRL_PWRM | ( | x | ) | (((((x) & 0x3) << 3) << 10) & 0xFC00) |
#define AD5683_CTRL_RB_REG 5 |
#define AD5683_LSB_MASK 0xF |
#define AD5683_LSB_OFFSET 4 |
#define AD5683_MIDB_MASK 0xFF |
#define AD5683_MIDB_OFFSET 4 |
#define AD5683_MSB_MASK 0xF |
#define AD5683_MSB_OFFSET 12 |
#define AD5683_REG_MAP 0 |
#define AD5683_SW_RESET ((((0x1) << 5) << 10) & 0xFC00) |
#define AD5686_CMD_MASK 0xFF |
#define AD5686_CTRL_DCEN 8 |
#define AD5686_CTRL_IREF_REG 7 |
#define AD5686_CTRL_LDAC_MASK 5 |
#define AD5686_CTRL_NOP 0 |
#define AD5686_CTRL_PWR 4 |
#define AD5686_CTRL_RB_REG 9 |
#define AD5686_CTRL_SWRESET 6 |
#define AD5686_CTRL_UPDATE 2 |
#define AD5686_CTRL_WRITE 1 |
#define AD5686_CTRL_WRITEUPDATE 3 |
#define AD5686_DC_DIS 0 |
#define AD5686_DC_EN 1 |
#define AD5686_INTREF_DIS 0 |
#define AD5686_INTREF_EN 1 |
#define AD5686_LSB_MASK 0x00FF |
#define AD5686_LSB_OFFSET 0 |
#define AD5686_MSB_MASK 0xFF00 |
#define AD5686_MSB_OFFSET 8 |
#define AD5686_PWRM_100K 2 |
#define AD5686_PWRM_1K 1 |
#define AD5686_PWRM_MASK 3 |
#define AD5686_PWRM_NORMAL 0 |
#define AD5686_PWRM_THREESTATE 3 |
#define AD5686_RB_DIS 0 |
#define AD5686_RB_EN 1 |
#define AD5686_REG_MAP 1 |
#define ADDR_MASK 0xFF |
#define CMD_OFFSET 4 |
#define MAX_RESOLUTION 16 |
#define PKT_LENGTH 3 |
enum ad5686_dac_channels |
enum ad5686_type |
enum comm_type |
void ad5686_daisy_chain_en | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set up DCEN register (daisy-chain enable)
dev | - The device structure. |
value | - Enable or disable daisy-chain mode Example : 'AD5686_DC_EN' - daisy-chain enable 'AD5686_DC_DIS' - daisy-chain disable |
int32_t ad5686_gain_mode | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set Gain mode.
dev | - The device structure. |
value | - Gain modes. Accepted values: Example : 'AD5683_GB_VREF' - 0V to VREF 'AD5683_GB_2VREF' - 0V to 2xVREF |
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.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
void ad5686_internal_reference | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Write to Internal reference setup register.
dev | - The device structure. |
value | - The internal reference register value Example : 'AD5686_INTREF_EN' - enable internal reference 'AD5686_INTREF_DIS' - disable internal reference |
void ad5686_ldac_mask | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint8_t | enable | ||
) |
Set hardware LDAC mask register.
dev | - The device structure. |
channel | - In case of which channel ignore transitions on the LDAC pin. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
enable | - Enable/disable channel. |
void ad5686_power_mode | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint8_t | mode | ||
) |
Set Power-down mode for DAC channel n.
dev | - The device structure. |
channel | - The chosen channel to change the power-down mode. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
mode | - Power-down operation modes. Accepted values: 'AD5686_PWRM_NORMAL' - Normal Mode 'AD5686_PWRM_1K' - Power-down mode 1kOhm to GND 'AD5686_PWRM_100K' - Power-down mode 100kOhm to GND 'AD5686_PWRM_THREESTATE' - Three-State 'AD5686_PWRM_100K' is not available for AD5674R/AD5679R. |
void ad5686_read_back_en | ( | struct ad5686_dev * | dev, |
uint8_t | value | ||
) |
Set up readback register (readback enable)
dev | - The device structure. |
value | - Enable or disable daisy-chain mode Example : 'AD5686_RB_EN' - daisy-chain enable 'AD5686_RB_DIS' - daisy-chain disable |
uint16_t ad5686_read_back_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel | ||
) |
Read back Input Register n.
dev | - The device structure. |
channel | - The channel which will be read back. Note: only one channel should be selected, if there will be selected more than one channel, the channel A will be read back by default Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
int32_t ad5686_remove | ( | struct ad5686_dev * | dev | ) |
Free the resources allocated by ad5686_init().
dev | - The device structure. |
uint16_t ad5686_set_shift_reg | ( | struct ad5686_dev * | dev, |
uint8_t | command, | ||
uint8_t | address, | ||
uint16_t | data | ||
) |
Write to input shift register.
dev | - The device structure. |
command | - Command control bits. |
address | - The address bits. |
data | - Data to be written in input register. |
void ad5686_software_reset | ( | struct ad5686_dev * | dev | ) |
Software reset (power-on reset)
dev | - The device structure. |
void ad5686_update_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel | ||
) |
Update DAC Register n with contents of Input Register n.
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
void ad5686_write_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint16_t | data | ||
) |
Write to Input Register n (dependent on LDAC)
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
data | - desired value to be written in register. |
void ad5686_write_update_register | ( | struct ad5686_dev * | dev, |
enum ad5686_dac_channels | channel, | ||
uint16_t | data | ||
) |
Write to and update DAC channel n.
dev | - The device structure. |
channel | - The chosen channel to write to. Accepted values: AD5686_CH_0 AD5686_CH_1 AD5686_CH_2 AD5686_CH_3 AD5686_CH_4 AD5686_CH_5 AD5686_CH_6 AD5686_CH_7 AD5686_CH_8 AD5686_CH_9 AD5686_CH_10 AD5686_CH_11 AD5686_CH_12 AD5686_CH_13 AD5686_CH_14 AD5686_CH_15 |
data | - Desired value to be written in register. |