no-OS
|
Header file of AD5761R Driver. More...
Go to the source code of this file.
Classes | |
struct | ad5761r_dev |
struct | ad5761r_init_param |
Macros | |
#define | AD5761R_INPUT_ZERO_BIT (1 << 20) |
#define | AD5761R_INPUT_ADDR_CMD(x) (((x) & 0xF) << 16) |
#define | AD5761R_INPUT_DATA(x) (((x) & 0xFFFF) << 0) |
#define | AD5761R_DATA(x) (((x) & 0xFFFF) << 0) |
#define | AD5721R_DATA(x) (((x) & 0xFFF) << 4) |
#define | CMD_NOP 0x0 |
#define | CMD_WR_TO_INPUT_REG 0x1 |
#define | CMD_UPDATE_DAC_REG 0x2 |
#define | CMD_WR_UPDATE_DAC_REG 0x3 |
#define | CMD_WR_CTRL_REG 0x4 |
#define | CMD_NOP_ALT_1 0x5 |
#define | CMD_NOP_ALT_2 0x6 |
#define | CMD_SW_DATA_RESET 0x7 |
#define | CMD_RESERVED 0x8 |
#define | CMD_DIS_DAISY_CHAIN 0x9 |
#define | CMD_RD_INPUT_REG 0xA |
#define | CMD_RD_DAC_REG 0xB |
#define | CMD_RD_CTRL_REG 0xC |
#define | CMD_NOP_ALT_3 0xD |
#define | CMD_NOP_ALT_4 0xE |
#define | CMD_SW_FULL_RESET 0xF |
#define | AD5761R_CTRL_SC (1 << 12) |
#define | AD5761R_CTRL_BO (1 << 11) |
#define | AD5761R_CTRL_CV(x) (((x) & 0x3) << 9) |
#define | AD5761R_CTRL_OVR (1 << 8) |
#define | AD5761R_CTRL_B2C (1 << 7) |
#define | AD5761R_CTRL_ETS (1 << 6) |
#define | AD5761R_CTRL_IRO (1 << 5) |
#define | AD5761R_CTRL_PV(x) (((x) & 0x3) << 3) |
#define | AD5761R_CTRL_RA(x) (((x) & 0x7) << 0) |
#define | AD5761R_DIS_DAISY_CHAIN_DDC(x) (((x) & 0x1) << 0) |
Header file of AD5761R Driver.
Copyright 2015(c) Analog Devices, Inc.
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, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define AD5721R_DATA | ( | x | ) | (((x) & 0xFFF) << 4) |
#define AD5761R_CTRL_B2C (1 << 7) |
#define AD5761R_CTRL_BO (1 << 11) |
#define AD5761R_CTRL_CV | ( | x | ) | (((x) & 0x3) << 9) |
#define AD5761R_CTRL_ETS (1 << 6) |
#define AD5761R_CTRL_IRO (1 << 5) |
#define AD5761R_CTRL_OVR (1 << 8) |
#define AD5761R_CTRL_PV | ( | x | ) | (((x) & 0x3) << 3) |
#define AD5761R_CTRL_RA | ( | x | ) | (((x) & 0x7) << 0) |
#define AD5761R_CTRL_SC (1 << 12) |
#define AD5761R_DATA | ( | x | ) | (((x) & 0xFFFF) << 0) |
#define AD5761R_DIS_DAISY_CHAIN_DDC | ( | x | ) | (((x) & 0x1) << 0) |
#define AD5761R_INPUT_ADDR_CMD | ( | x | ) | (((x) & 0xF) << 16) |
#define AD5761R_INPUT_DATA | ( | x | ) | (((x) & 0xFFFF) << 0) |
#define AD5761R_INPUT_ZERO_BIT (1 << 20) |
#define CMD_DIS_DAISY_CHAIN 0x9 |
#define CMD_NOP 0x0 |
#define CMD_NOP_ALT_1 0x5 |
#define CMD_NOP_ALT_2 0x6 |
#define CMD_NOP_ALT_3 0xD |
#define CMD_NOP_ALT_4 0xE |
#define CMD_RD_CTRL_REG 0xC |
#define CMD_RD_DAC_REG 0xB |
#define CMD_RD_INPUT_REG 0xA |
#define CMD_RESERVED 0x8 |
#define CMD_SW_DATA_RESET 0x7 |
#define CMD_SW_FULL_RESET 0xF |
#define CMD_UPDATE_DAC_REG 0x2 |
#define CMD_WR_CTRL_REG 0x4 |
#define CMD_WR_TO_INPUT_REG 0x1 |
#define CMD_WR_UPDATE_DAC_REG 0x3 |
enum ad5761r_range |
enum ad5761r_reg |
enum ad5761r_scale |
enum ad5761r_type |
int32_t ad5761r_config | ( | struct ad5761r_dev * | dev | ) |
Configure the part based on the settings stored in the device structure.
dev | - The device structure. |
int32_t ad5761r_get_2c_bipolar_range_en_dis | ( | struct ad5761r_dev * | dev, |
bool * | en_dis | ||
) |
Get the status of the twos complement bipolar output range.
dev | - The device structure. |
en_dis | - The status of the twos complement bipolar output range (enabled, disabled). |
int32_t ad5761r_get_brownout_condition | ( | struct ad5761r_dev * | dev, |
bool * | bo | ||
) |
Get the brownout condition. Note: The condition is reset at every control register write.
dev | - The device structure. |
bo | - The status of the brownout condition (detected, not detected). |
int32_t ad5761r_get_clear_voltage | ( | struct ad5761r_dev * | dev, |
enum ad5761r_scale * | cv | ||
) |
Get the clear voltage.
dev | - The device structure. |
cv | - The clear voltage. |
int32_t ad5761r_get_clr_pin | ( | struct ad5761r_dev * | dev, |
uint8_t * | value | ||
) |
Get the clr pin value.
dev | - The device structure. |
value | - The pin value. |
int32_t ad5761r_get_daisy_chain_en_dis | ( | struct ad5761r_dev * | dev, |
bool * | en_dis | ||
) |
Get the status of the daisy-chain mode.
dev | - The device structure. |
en_dis | - The status of the daisy-chain mode (enabled, disabled). |
int32_t ad5761r_get_exceed_temp_shutdown_en_dis | ( | struct ad5761r_dev * | dev, |
bool * | en_dis | ||
) |
Get the status of the ETS (exceed temperature shutdown) function.
dev | - The device structure. |
en_dis | - The status of the ETS function (enabled, disabled). |
int32_t ad5761r_get_internal_reference_en_dis | ( | struct ad5761r_dev * | dev, |
bool * | en_dis | ||
) |
Get the status of the internal reference.
dev | - The device structure. |
en_dis | - The status of the internal reference (enabled, disabled). |
int32_t ad5761r_get_ldac_pin | ( | struct ad5761r_dev * | dev, |
uint8_t * | value | ||
) |
Get the ldac pin value.
dev | - The device structure. |
value | - The pin value. |
int32_t ad5761r_get_output_range | ( | struct ad5761r_dev * | dev, |
enum ad5761r_range * | out_range | ||
) |
Get the output_range.
dev | - The device structure. |
out_range | - The output range values. |
int32_t ad5761r_get_overrange_en_dis | ( | struct ad5761r_dev * | dev, |
bool * | en_dis | ||
) |
Get the status of the 5% overrange.
dev | - The device structure. |
en_dis | - The status of the twos 5% overrange (enabled, disabled). |
int32_t ad5761r_get_power_up_voltage | ( | struct ad5761r_dev * | dev, |
enum ad5761r_scale * | pv | ||
) |
Get the power up voltage.
dev | - The device structure. |
pv | - The power up voltage. |
int32_t ad5761r_get_reset_pin | ( | struct ad5761r_dev * | dev, |
uint8_t * | value | ||
) |
Get the reset pin value.
dev | - The device structure. |
value | - The pin value. |
int32_t ad5761r_get_short_circuit_condition | ( | struct ad5761r_dev * | dev, |
bool * | sc | ||
) |
Get the short-circuit condition. Note: The condition is reset at every control register write.
dev | - The device structure. |
sc | - The status of the short-circuit condition (detected, not detected). |
int32_t ad5761r_init | ( | struct ad5761r_dev ** | device, |
struct ad5761r_init_param | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad5761r_read | ( | struct ad5761r_dev * | dev, |
uint8_t | reg_addr_cmd, | ||
uint16_t * | reg_data | ||
) |
SPI read from device.
dev | - The device structure. |
reg_addr_cmd | - The input shift register command. Accepted values: CMD_NOP CMD_WR_TO_INPUT_REG CMD_UPDATE_DAC_REG_FROM_INPUT_REG CMD_WR_UPDATE_DAC_REG CMD_WR_CTRL_REG CMD_SW_DATA_RESET CMD_DIS_DAISY_CHAIN CMD_RD_INPUT_REG CMD_RD_DAC_REG CMD_RD_CTRL_REG CMD_SW_FULL_RESET |
reg_data | - The received data. |
int32_t ad5761r_register_readback | ( | struct ad5761r_dev * | dev, |
enum ad5761r_reg | reg, | ||
uint16_t * | reg_data | ||
) |
Readback the register data. Note: Readback operation is not enabled if daisy-chain mode is disabled.
dev | - The device structure. |
reg | - The register to be read. Accepted values: AD5761R_REG_INPUT AD5761R_REG_DAC AD5761R_REG_CTRL |
reg_data | - The register data. |
int32_t ad5761r_remove | ( | struct ad5761r_dev * | dev | ) |
Free the resources allocated by ad5761r_init().
dev | - The device structure. |
int32_t ad5761r_set_2c_bipolar_range_en_dis | ( | struct ad5761r_dev * | dev, |
bool | en_dis | ||
) |
Enable/disable the twos complement bipolar output range.
dev | - The device structure. |
en_dis | - Set true in order to enable the twos complement bipolar output range. Accepted values: true false |
int32_t ad5761r_set_clear_voltage | ( | struct ad5761r_dev * | dev, |
enum ad5761r_scale | cv | ||
) |
Set the clear voltage.
dev | - The device structure. |
cv | - The clear voltage. Accepted values: AD5761R_SCALE_ZERO AD5761R_SCALE_HALF AD5761R_SCALE_FULL |
int32_t ad5761r_set_clr_pin | ( | struct ad5761r_dev * | dev, |
uint8_t | value | ||
) |
Set the clr pin value.
dev | - The device structure. |
value | - The pin value. Accepted values: NO_OS_GPIO_LOW NO_OS_GPIO_HIGH |
int32_t ad5761r_set_daisy_chain_en_dis | ( | struct ad5761r_dev * | dev, |
bool | en_dis | ||
) |
Enable/disable daisy-chain mode.
dev | - The device structure. |
en_dis | - Set true in order to enable the daisy-chain mode. Accepted values: true false |
int32_t ad5761r_set_exceed_temp_shutdown_en_dis | ( | struct ad5761r_dev * | dev, |
bool | en_dis | ||
) |
Enable/disable ETS (exceed temperature shutdown) function.
dev | - The device structure. |
en_dis | - Set true in order to enable the ETS function. Accepted values: true false |
int32_t ad5761r_set_internal_reference_en_dis | ( | struct ad5761r_dev * | dev, |
bool | en_dis | ||
) |
Enable/disable internal reference.
dev | - The device structure. |
en_dis | - Set true in order to enable the internal reference. Accepted values: true false |
int32_t ad5761r_set_ldac_pin | ( | struct ad5761r_dev * | dev, |
uint8_t | value | ||
) |
Set the ldac pin value.
dev | - The device structure. |
value | - The pin value. Accepted values: NO_OS_GPIO_LOW NO_OS_GPIO_HIGH |
int32_t ad5761r_set_output_range | ( | struct ad5761r_dev * | dev, |
enum ad5761r_range | out_range | ||
) |
Set the output_range.
dev | - The device structure. |
out_range | - The output range. Accepted values: AD5761R_RANGE_M_10V_TO_P_10V, AD5761R_RANGE_0_V_TO_P_10V AD5761R_RANGE_M_5V_TO_P_5V AD5761R_RANGE_0V_TO_P_5V AD5761R_RANGE_M_2V5_TO_P_7V5 AD5761R_RANGE_M_3V_TO_P_3V AD5761R_RANGE_0V_TO_P_16V AD5761R_RANGE_0V_TO_P_20V |
int32_t ad5761r_set_overrange_en_dis | ( | struct ad5761r_dev * | dev, |
bool | en_dis | ||
) |
Enable/disable the 5% overrange.
dev | - The device structure. |
en_dis | - Set true in order to enable the 5% overrange. Accepted values: true false |
int32_t ad5761r_set_power_up_voltage | ( | struct ad5761r_dev * | dev, |
enum ad5761r_scale | pv | ||
) |
Set the power up voltage.
dev | - The device structure. |
pv | - The power up voltage. Accepted values: AD5761R_SCALE_ZERO AD5761R_SCALE_HALF AD5761R_SCALE_FULL |
int32_t ad5761r_set_reset_pin | ( | struct ad5761r_dev * | dev, |
uint8_t | value | ||
) |
Set the reset pin value.
dev | - The device structure. |
value | - The pin value. Accepted values: NO_OS_GPIO_LOW NO_OS_GPIO_HIGH |
int32_t ad5761r_software_data_reset | ( | struct ad5761r_dev * | dev | ) |
Software data reset.
dev | - The device structure. |
int32_t ad5761r_software_full_reset | ( | struct ad5761r_dev * | dev | ) |
Software full reset.
dev | - The device structure. |
int32_t ad5761r_update_dac_register | ( | struct ad5761r_dev * | dev | ) |
Update DAC register.
dev | - The device structure. |
int32_t ad5761r_write | ( | struct ad5761r_dev * | dev, |
uint8_t | reg_addr_cmd, | ||
uint16_t | reg_data | ||
) |
SPI write to device.
dev | - The device structure. |
reg_addr_cmd | - The input shift register command. Accepted values: CMD_NOP CMD_WR_TO_INPUT_REG CMD_UPDATE_DAC_REG_FROM_INPUT_REG CMD_WR_UPDATE_DAC_REG CMD_WR_CTRL_REG CMD_SW_DATA_RESET CMD_DIS_DAISY_CHAIN CMD_RD_INPUT_REG CMD_RD_DAC_REG CMD_RD_CTRL_REG CMD_SW_FULL_RESET |
reg_data | - The transmitted data. |
int32_t ad5761r_write_input_register | ( | struct ad5761r_dev * | dev, |
uint16_t | dac_data | ||
) |
Write to input register.
dev | - The device structure. |
dac_data | - The DAC data. |
int32_t ad5761r_write_update_dac_register | ( | struct ad5761r_dev * | dev, |
uint16_t | dac_data | ||
) |
Write to input register and update DAC register.
dev | - The device structure. |
dac_data | - The register data. |