Go to the documentation of this file.
49 #define AD5761R_INPUT_ZERO_BIT (1 << 20)
50 #define AD5761R_INPUT_ADDR_CMD(x) (((x) & 0xF) << 16)
51 #define AD5761R_INPUT_DATA(x) (((x) & 0xFFFF) << 0)
53 #define AD5761R_DATA(x) (((x) & 0xFFFF) << 0)
54 #define AD5721R_DATA(x) (((x) & 0xFFF) << 4)
58 #define CMD_WR_TO_INPUT_REG 0x1
59 #define CMD_UPDATE_DAC_REG 0x2
60 #define CMD_WR_UPDATE_DAC_REG 0x3
61 #define CMD_WR_CTRL_REG 0x4
62 #define CMD_NOP_ALT_1 0x5
63 #define CMD_NOP_ALT_2 0x6
64 #define CMD_SW_DATA_RESET 0x7
65 #define CMD_RESERVED 0x8
66 #define CMD_DIS_DAISY_CHAIN 0x9
67 #define CMD_RD_INPUT_REG 0xA
68 #define CMD_RD_DAC_REG 0xB
69 #define CMD_RD_CTRL_REG 0xC
70 #define CMD_NOP_ALT_3 0xD
71 #define CMD_NOP_ALT_4 0xE
72 #define CMD_SW_FULL_RESET 0xF
75 #define AD5761R_CTRL_SC (1 << 12) // RO
76 #define AD5761R_CTRL_BO (1 << 11) // RO
77 #define AD5761R_CTRL_CV(x) (((x) & 0x3) << 9) // RW
78 #define AD5761R_CTRL_OVR (1 << 8) // RW
79 #define AD5761R_CTRL_B2C (1 << 7) // RW
80 #define AD5761R_CTRL_ETS (1 << 6) // RW
81 #define AD5761R_CTRL_IRO (1 << 5) // RW
82 #define AD5761R_CTRL_PV(x) (((x) & 0x3) << 3) // RW
83 #define AD5761R_CTRL_RA(x) (((x) & 0x7) << 0) // RW
86 #define AD5761R_DIS_DAISY_CHAIN_DDC(x) (((x) & 0x1) << 0)
174 uint8_t reg_addr_cmd,
178 uint8_t reg_addr_cmd,
struct no_os_spi_desc * spi_desc
Definition: ad5761r.h:122
#define CMD_WR_CTRL_REG
Definition: ad5761r.h:61
int32_t ad5761r_write_update_dac_register(struct ad5761r_dev *dev, uint16_t reg_data)
Definition: ad5761r.c:614
@ AD5761R_RANGE_M_3V_TO_P_3V
Definition: ad5761r.h:115
#define CMD_RD_CTRL_REG
Definition: ad5761r.h:69
int32_t ad5761r_set_clear_voltage(struct ad5761r_dev *dev, enum ad5761r_scale cv)
Definition: ad5761r.c:290
@ AD5761R_SCALE_HALF
Definition: ad5761r.h:105
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
int32_t ad5761r_update_dac_register(struct ad5761r_dev *dev)
Definition: ad5761r.c:603
enum ad5761r_scale clr_voltage
Definition: ad5761r.h:156
Definition: ad5761r.h:120
int32_t ad5761r_set_exceed_temp_shutdown_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:350
int32_t ad5761r_set_clr_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:517
@ AD5761R_RANGE_0_V_TO_P_10V
Definition: ad5761r.h:111
int32_t ad5761r_get_ldac_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:569
int32_t ad5761r_set_power_up_voltage(struct ad5761r_dev *dev, enum ad5761r_scale pv)
Definition: ad5761r.c:259
@ AD5761R_RANGE_M_2V5_TO_P_7V5
Definition: ad5761r.h:114
int32_t ad5761r_set_2c_bipolar_range_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:381
#define CMD_DIS_DAISY_CHAIN
Definition: ad5761r.h:66
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
int32_t ad5761r_set_reset_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:482
enum ad5761r_scale pv
Definition: ad5761r.h:133
int32_t ad5761r_get_2c_bipolar_range_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:396
int32_t ad5761r_register_readback(struct ad5761r_dev *dev, enum ad5761r_reg reg, uint16_t *reg_data)
Definition: ad5761r.c:127
int32_t ad5761r_get_clr_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:534
ad5761r_reg
Definition: ad5761r.h:97
Header file of SPI Interface.
@ AD5761R_SCALE_ZERO
Definition: ad5761r.h:104
int32_t ad5761r_set_overrange_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:412
bool exc_temp_sd_en
Definition: ad5761r.h:136
uint8_t gpio_clr_value
Definition: ad5761r.h:127
#define AD5761R_CTRL_PV(x)
Definition: ad5761r.h:82
#define CMD_WR_UPDATE_DAC_REG
Definition: ad5761r.h:60
int32_t ad5761r_get_short_circuit_condition(struct ad5761r_dev *dev, bool *sc)
Definition: ad5761r.c:442
int32_t ad5761r_get_ldac_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:569
#define CMD_SW_FULL_RESET
Definition: ad5761r.h:72
int32_t ad5761r_config(struct ad5761r_dev *dev)
Definition: ad5761r.c:168
#define AD5761R_DATA(x)
Definition: ad5761r.h:53
int32_t ad5761r_set_power_up_voltage(struct ad5761r_dev *dev, enum ad5761r_scale pv)
Definition: ad5761r.c:259
bool daisy_chain_en
Definition: ad5761r.h:161
#define CMD_RD_INPUT_REG
Definition: ad5761r.h:67
Definition: ad9361_util.h:69
int32_t ad5761r_get_exceed_temp_shutdown_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:364
int32_t ad5761r_get_clr_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:534
#define AD5721R_DATA(x)
Definition: ad5761r.h:54
int32_t ad5761r_get_power_up_voltage(struct ad5761r_dev *dev, enum ad5761r_scale *pv)
Definition: ad5761r.c:273
int32_t ad5761r_read(struct ad5761r_dev *dev, uint8_t reg_addr_cmd, uint16_t *reg_data)
Definition: ad5761r.c:99
Definition: ad5761r.h:142
ad5761r_range
Definition: ad5761r.h:109
@ AD5761R_SCALE_FULL
Definition: ad5761r.h:106
#define AD5761R_CTRL_BO
Definition: ad5761r.h:76
struct no_os_gpio_init_param gpio_ldac
Definition: ad5761r.h:150
bool daisy_chain_en
Definition: ad5761r.h:139
bool ovr_en
Definition: ad5761r.h:160
#define AD5761R_CTRL_RA(x)
Definition: ad5761r.h:83
int32_t ad5761r_get_clear_voltage(struct ad5761r_dev *dev, enum ad5761r_scale *cv)
Definition: ad5761r.c:304
@ AD5761R_REG_DAC
Definition: ad5761r.h:99
#define AD5761R_CTRL_IRO
Definition: ad5761r.h:81
bool ovr_en
Definition: ad5761r.h:138
int32_t ad5761r_config(struct ad5761r_dev *dev)
Definition: ad5761r.c:168
#define AD5761R_CTRL_SC
Definition: ad5761r.h:75
uint8_t gpio_ldac_value
Definition: ad5761r.h:151
int32_t ad5761r_init(struct ad5761r_dev **device, struct ad5761r_init_param init_param)
Definition: ad5761r.c:654
Header file of AD5761R Driver.
int32_t ad5761r_remove(struct ad5761r_dev *dev)
Free the resources allocated by ad5761r_init().
Definition: ad5761r.c:711
enum ad5761r_scale cv
Definition: ad5761r.h:134
#define CMD_RD_DAC_REG
Definition: ad5761r.h:68
int32_t ad5761r_write_input_register(struct ad5761r_dev *dev, uint16_t reg_data)
Definition: ad5761r.c:585
int32_t ad5761r_software_full_reset(struct ad5761r_dev *dev)
Definition: ad5761r.c:642
struct no_os_gpio_init_param gpio_clr
Definition: ad5761r.h:148
enum ad5761r_type type
Definition: ad5761r.h:131
int32_t ad5761r_write_input_register(struct ad5761r_dev *dev, uint16_t dac_data)
Definition: ad5761r.c:585
enum ad5761r_range ra
Definition: ad5761r.h:132
int32_t ad5761r_get_brownout_condition(struct ad5761r_dev *dev, bool *bo)
Definition: ad5761r.c:462
int32_t ad5761r_register_readback(struct ad5761r_dev *dev, enum ad5761r_reg reg, uint16_t *reg_data)
Definition: ad5761r.c:127
int32_t ad5761r_get_daisy_chain_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:206
int32_t ad5761r_set_overrange_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:412
int32_t ad5761r_get_internal_reference_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:334
@ AD5761R
Definition: ad5761r.h:93
ad5761r_type
Definition: ad5761r.h:92
int32_t ad5761r_get_output_range(struct ad5761r_dev *dev, enum ad5761r_range *out_range)
Definition: ad5761r.c:242
#define CMD_UPDATE_DAC_REG
Definition: ad5761r.h:59
int32_t ad5761r_set_output_range(struct ad5761r_dev *dev, enum ad5761r_range out_range)
Definition: ad5761r.c:228
uint8_t gpio_ldac_value
Definition: ad5761r.h:129
int32_t ad5761r_get_short_circuit_condition(struct ad5761r_dev *dev, bool *sc)
Definition: ad5761r.c:442
int32_t ad5761r_get_internal_reference_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:334
int32_t ad5761r_write_update_dac_register(struct ad5761r_dev *dev, uint16_t dac_data)
Definition: ad5761r.c:614
int32_t ad5761r_set_internal_reference_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:320
int32_t ad5761r_set_clear_voltage(struct ad5761r_dev *dev, enum ad5761r_scale cv)
Definition: ad5761r.c:290
int32_t ad5761r_software_full_reset(struct ad5761r_dev *dev)
Definition: ad5761r.c:642
bool b2c_range_en
Definition: ad5761r.h:159
#define AD5761R_CTRL_OVR
Definition: ad5761r.h:78
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
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
int32_t ad5761r_set_exceed_temp_shutdown_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:350
ad5761r_scale
Definition: ad5761r.h:103
int32_t ad5761r_get_brownout_condition(struct ad5761r_dev *dev, bool *bo)
Definition: ad5761r.c:462
int32_t ad5761r_set_internal_reference_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:320
int32_t ad5761r_software_data_reset(struct ad5761r_dev *dev)
Definition: ad5761r.c:632
int32_t ad5761r_get_power_up_voltage(struct ad5761r_dev *dev, enum ad5761r_scale *pv)
Definition: ad5761r.c:273
enum ad5761r_scale pwr_voltage
Definition: ad5761r.h:155
@ AD5761R_RANGE_0V_TO_P_20V
Definition: ad5761r.h:117
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
int32_t ad5761r_get_overrange_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:426
int32_t ad5761r_get_2c_bipolar_range_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:396
#define AD5761R_DIS_DAISY_CHAIN_DDC(x)
Definition: ad5761r.h:86
@ AD5761R_RANGE_M_10V_TO_P_10V
Definition: ad5761r.h:110
int32_t ad5761r_set_daisy_chain_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:191
int32_t ad5761r_set_output_range(struct ad5761r_dev *dev, enum ad5761r_range out_range)
Definition: ad5761r.c:228
@ AD5761R_REG_INPUT
Definition: ad5761r.h:98
int32_t ad5761r_write(struct ad5761r_dev *dev, uint8_t reg_addr_cmd, uint16_t reg_data)
Definition: ad5761r.c:65
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
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
@ AD5761R_RANGE_0V_TO_P_5V
Definition: ad5761r.h:113
enum ad5761r_range out_range
Definition: ad5761r.h:154
struct no_os_spi_init_param spi_init
Definition: ad5761r.h:144
struct no_os_gpio_desc * gpio_ldac
Definition: ad5761r.h:128
int32_t ad5761r_get_reset_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:499
#define CMD_WR_TO_INPUT_REG
Definition: ad5761r.h:58
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
#define AD5761R_CTRL_ETS
Definition: ad5761r.h:80
int32_t ad5761r_get_reset_pin(struct ad5761r_dev *dev, uint8_t *value)
Definition: ad5761r.c:499
int32_t ad5761r_get_overrange_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:426
int32_t ad5761r_set_ldac_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:552
@ AD5761R_REG_CTRL
Definition: ad5761r.h:100
int32_t ad5761r_get_exceed_temp_shutdown_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:364
@ AD5721R
Definition: ad5761r.h:94
int32_t ad5761r_read(struct ad5761r_dev *dev, uint8_t reg_addr_cmd, uint16_t *reg_data)
Definition: ad5761r.c:99
@ AD5761R_RANGE_M_5V_TO_P_5V
Definition: ad5761r.h:112
bool int_ref_en
Definition: ad5761r.h:135
int32_t no_os_gpio_set_value(struct no_os_gpio_desc *desc, uint8_t value)
Set the value of the specified GPIO.
Definition: no_os_gpio.c:197
#define CMD_SW_DATA_RESET
Definition: ad5761r.h:64
int32_t ad5761r_set_2c_bipolar_range_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:381
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
int32_t ad5761r_set_daisy_chain_en_dis(struct ad5761r_dev *dev, bool en_dis)
Definition: ad5761r.c:191
uint8_t gpio_clr_value
Definition: ad5761r.h:149
#define AD5761R_CTRL_CV(x)
Definition: ad5761r.h:77
struct no_os_gpio_init_param gpio_reset
Definition: ad5761r.h:146
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.
#define AD5761R_CTRL_B2C
Definition: ad5761r.h:79
bool int_ref_en
Definition: ad5761r.h:157
bool exc_temp_sd_en
Definition: ad5761r.h:158
bool b2c_range_en
Definition: ad5761r.h:137
enum ad5761r_type type
Definition: ad5761r.h:153
struct no_os_gpio_desc * gpio_clr
Definition: ad5761r.h:126
struct no_os_gpio_desc * gpio_reset
Definition: ad5761r.h:124
int32_t ad5761r_init(struct ad5761r_dev **device, struct ad5761r_init_param init_param)
Definition: ad5761r.c:654
int32_t ad5761r_set_ldac_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:552
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
int32_t ad5761r_remove(struct ad5761r_dev *dev)
Free the resources allocated by ad5761r_init().
Definition: ad5761r.c:711
@ AD5761R_RANGE_0V_TO_P_16V
Definition: ad5761r.h:116
int32_t ad5761r_software_data_reset(struct ad5761r_dev *dev)
Definition: ad5761r.c:632
int32_t ad5761r_set_clr_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:517
int32_t ad5761r_get_daisy_chain_en_dis(struct ad5761r_dev *dev, bool *en_dis)
Definition: ad5761r.c:206
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
int32_t ad5761r_write(struct ad5761r_dev *dev, uint8_t reg_addr_cmd, uint16_t reg_data)
Definition: ad5761r.c:65
int32_t ad5761r_set_reset_pin(struct ad5761r_dev *dev, uint8_t value)
Definition: ad5761r.c:482
uint8_t gpio_reset_value
Definition: ad5761r.h:125
int32_t ad5761r_get_clear_voltage(struct ad5761r_dev *dev, enum ad5761r_scale *cv)
Definition: ad5761r.c:304
int32_t ad5761r_get_output_range(struct ad5761r_dev *dev, enum ad5761r_range *out_range)
Definition: ad5761r.c:242
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
int32_t ad5761r_update_dac_register(struct ad5761r_dev *dev)
Definition: ad5761r.c:603
uint8_t gpio_reset_value
Definition: ad5761r.h:147