no-OS
ad5754r.h
Go to the documentation of this file.
1 /***************************************************************************/
34 #ifndef __AD5754R_H__
35 #define __AD5754R_H__
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 #include <stdint.h>
41 #include "no_os_gpio.h"
42 #include "no_os_spi.h"
43 #include "no_os_util.h"
44 #include "no_os_error.h"
45 
46 /******************************************************************************/
47 /********************** Macros and Constants Definitions **********************/
48 /******************************************************************************/
49 
50 /* Maximum resolution */
51 #define AD5754R_MAX_RESOLUTION 16
52 
53 /* DAC Channel Count */
54 #define AD5754R_NUM_CHANNELS 4
55 
56 /* Register Map */
57 #define AD5754R_REG_DAC 0
58 #define AD5754R_REG_OUTPUT_RANGE_SEL 1
59 #define AD5754R_REG_PWR_CTRL 2
60 #define AD5754R_REG_CONTROL 3
61 
62 /* DAC Channel Address */
63 #define AD5754R_DAC_CH_A_ADDR 0
64 #define AD5754R_DAC_CH_B_ADDR 1
65 #define AD5754R_DAC_CH_C_ADDR 2
66 #define AD5754R_DAC_CH_D_ADDR 3
67 #define AD5754R_DAC_CH_ALL_ADDR 4
68 
69 /* Input Shift Register Masks */
70 #define AD5754R_ADDR_REG_MASK NO_OS_GENMASK(5, 3)
71 #define AD5754R_ADDR_REG(x) no_os_field_prep(AD5754R_ADDR_REG_MASK, x)
72 #define AD5754R_ADDR_DAC_CH_MASK NO_OS_GENMASK(2, 0)
73 #define AD5754R_ADDR_DAC_CH(x) no_os_field_prep(AD5754R_ADDR_DAC_CH_MASK, x)
74 #define AD5754R_PREP_INSTR_ADDR(reg, dac_ch) (AD5754R_ADDR_REG(reg) | \
75  AD5754R_ADDR_DAC_CH(dac_ch))
76 
77 /* Output Range Select Mask */
78 #define AD5754R_OUTPUT_RANGE_SEL_MASK NO_OS_GENMASK(2,0)
79 
80 /* Control Register bit Definition */
81 #define AD5754R_CTRL_NOP 0
82 #define AD5754R_CTRL_TSD_EN(x) no_os_field_prep(NO_OS_BIT(3), x)
83 #define AD5754R_CTRL_TSD_EN_MASK NO_OS_BIT(3)
84 #define AD5754R_CTRL_CLAMP_EN(X) no_os_field_prep(NO_OS_BIT(2), x)
85 #define AD5754R_CTRL_CLAMP_EN_MASK NO_OS_BIT(2)
86 #define AD5754R_CTRL_CLR_SEL(x) no_os_field_prep(NO_OS_BIT(1), x)
87 #define AD5754R_CTRL_CLR_SEL_MASK NO_OS_BIT(1)
88 #define AD5754R_CTRL_SDO_DISABLE(x) (x)
89 #define AD5754R_CTRL_SDO_DISABLE_MASK NO_OS_BIT(0)
90 #define AD5754R_CTRL_CLEAR 0
91 #define AD5754R_CTRL_LOAD 0
92 
93 /* Power Control Register bit definition */
94 #define AD5754R_PWR_UP_DAC_CH_MASK(x) NO_OS_BIT(x)
95 #define AD5754R_PWR_UP_INT_REF_MASK NO_OS_BIT(4)
96 #define AD5754R_PWR_OC_ALERT_MASK NO_OS_GENMASK(10,7)
97 #define AD5754R_PWR_OC_ALERT_CH_MASK(x) no_os_field_prep(AD5754R_PWR_OC_ALERT_MASK, \
98  NO_OS_BIT(x))
99 #define AD5754R_PWR_TSD_ALERT_MASK NO_OS_BIT(5)
100 
101 #define AD5754R_BYTE_H NO_OS_GENMASK(15, 8)
102 #define AD5754R_BYTE_L NO_OS_GENMASK(7, 0)
103 
104 #define AD5754R_READ NO_OS_BIT(7)
105 #define AD5754R_WRITE 0
106 
107 #define AD5754R_INSTR_NOP 0x18
108 #define AD5754R_INSTR_CLEAR 0x1C
109 #define AD5754R_INSTR_LOAD 0x1D
110 
111 #define AD5754R_GAIN_SCALE 1000
112 
113 /******************************************************************************/
114 /*************************** Types Declarations *******************************/
115 /******************************************************************************/
116 
126 };
127 
139 };
140 
150 };
151 
159 };
160 
168 };
169 
177 };
178 
186 };
187 
195 };
196 
204 };
205 
213 };
214 
222 };
223 
231 };
232 
238  /* SPI Init Parameters */
240  /* Clear GPIO Init Params*/
242  /* Load DAC Init Params*/
244  /* Output Range Select */
246  /* Current Clamp Enable */
248  /* TSD Enable */
250  /* Clear Setting */
252  /* SDO Disable */
254  /* Powerup States of DAC Channels */
256  /* Powerup State of Internal Reference */
258  /* Encoding scheme */
260  /* Reference voltage in millivolts */
261  uint16_t vref_mv;
262 };
263 
268 struct ad5754r_dev {
269  /* SPI Descriptor */
271  /* Clear GPIO */
273  /* Load DAC */
275  /* Output Range Select */
277  /* Current Clamp Enable */
279  /* TSD Enable */
281  /* Clear Setting */
283  /* SDO Disable */
285  /* Powerup States of DAC Channels */
287  /* Powerup State of Internal Reference */
289  /* Encoding scheme */
291  /* Reference voltage in millivolts */
292  uint16_t vref_mv;
293 };
294 
295 /******************************************************************************/
296 /********************** Variables and User Defined Data Types *****************/
297 /******************************************************************************/
298 
299 /* AD5754R gain values for different output ranges */
301  + 1];
302 
303 /******************************************************************************/
304 /************************ Functions Declarations ******************************/
305 /******************************************************************************/
306 
308 int ad5754r_write(struct ad5754r_dev *dev, uint8_t instr_addr,
309  uint16_t reg_val);
310 
312 int ad5754r_read(struct ad5754r_dev *dev, uint8_t instr_addr,
313  uint16_t *reg_val);
314 
316 int ad5754r_update_bits(struct ad5754r_dev *dev,
317  uint8_t instr_addr,
318  uint16_t mask,
319  uint16_t reg_val);
320 
322 int ad5754r_update_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn,
323  uint16_t value);
324 
327  uint16_t value);
328 
330 int ad5754r_ldac_trigger(struct ad5754r_dev *dev);
331 
333 int ad5754r_clear_async(struct ad5754r_dev *dev);
334 
336 int ad5754r_read_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn,
337  uint16_t *value);
338 
340 int ad5754r_dac_code_to_mvolts(struct ad5754r_dev *dev, uint8_t chn,
341  uint16_t code,
342  uint16_t *value);
343 
345 int ad5754r_dac_mvolts_to_code(struct ad5754r_dev *dev, uint8_t chn,
346  uint16_t mvolts, uint16_t *code);
347 
349 int ad5754r_set_ch_range(struct ad5754r_dev *dev, uint8_t chn,
350  enum ad5754r_dac_ch_range ch_range);
351 
353 int ad5754r_set_ch_pwrup(struct ad5754r_dev *dev, uint8_t chn,
354  enum ad5754r_pwr_dac_ch_pwrup ch_pwrup);
355 
358  enum ad5754r_ctrl_current_clamp_en clamp_en);
359 
361 int ad5754r_set_tsd_en(struct ad5754r_dev *dev,
362  enum ad5754r_ctrl_tsd_en tsd_en);
363 
365 int ad5754r_set_clear_mode(struct ad5754r_dev *dev,
366  enum ad5754r_ctrl_clear_sel clear_sel);
367 
369 int ad5754r_set_sdo_disable(struct ad5754r_dev *dev,
370  enum ad5754r_ctrl_sdo_dis sdo_dis);
371 
373 int ad5754r_set_int_ref_pwrup(struct ad5754r_dev *dev,
374  enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup);
375 
377 int ad5754r_get_oc_ch_alert(struct ad5754r_dev *dev, uint8_t chn,
378  enum ad5754r_pwr_oc_ch_alert *oc_ch_alert);
379 
381 int ad5754r_get_tsd_alert(struct ad5754r_dev *dev,
382  enum ad5754r_pwr_tsd_alert *tsd_alert);
383 
385 int ad5754r_spi_verify(struct ad5754r_dev* dev);
386 
388 int ad5754r_gpio_init(struct ad5754r_dev* dev,
390 
392 int ad5754r_reg_init(struct ad5754r_dev* dev,
394 
396 int ad5754r_init(struct ad5754r_dev **device,
398 
400 int ad5754r_remove_gpios(struct ad5754r_dev *dev);
401 
403 int ad5754r_remove(struct ad5754r_dev *dev);
404 
405 #endif /* __AD5754R_H__ */
AD5754R_CTRL_CLR_SEL_MASK
#define AD5754R_CTRL_CLR_SEL_MASK
Definition: ad5754r.h:87
ad5754r_set_ch_range
int ad5754r_set_ch_range(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_dac_ch_range ch_range)
Set output range for specific channel.
Definition: ad5754r.c:369
ad5754r_set_current_clamp_en
int ad5754r_set_current_clamp_en(struct ad5754r_dev *dev, enum ad5754r_ctrl_current_clamp_en clamp_en)
Apply current clamp setting for device.
Definition: ad5754r.c:425
AD5754R_PWR_OC_CH_NOT_DETECTED
@ AD5754R_PWR_OC_CH_NOT_DETECTED
Definition: ad5754r.h:220
ad5754r_set_clear_mode
int ad5754r_set_clear_mode(struct ad5754r_dev *dev, enum ad5754r_ctrl_clear_sel clear_sel)
Set clear mode setting for device.
Definition: ad5754r.c:479
ad5754r_ctrl_tsd_en
ad5754r_ctrl_tsd_en
TSD EN/DIS Modes.
Definition: ad5754r.h:165
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
ad5754r_reg_init
int ad5754r_reg_init(struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
Initialize registers based on init parameters.
Definition: ad5754r.c:698
ad5754r_remove
int ad5754r_remove(struct ad5754r_dev *dev)
Remove the device and release resources.
Definition: ad5754r.c:837
ad5754r_ctrl_sdo_dis
ad5754r_ctrl_sdo_dis
SDO EN/DIS Modes.
Definition: ad5754r.h:183
ad5754r_init_param::dac_ch_range
enum ad5754r_dac_ch_range dac_ch_range[AD5754R_NUM_CHANNELS]
Definition: ad5754r.h:245
AD5754R_READ
#define AD5754R_READ
Definition: ad5754r.h:104
ad5754r_read_dac_ch_register
int ad5754r_read_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn, uint16_t *value)
Read DAC register value for specific channel.
Definition: ad5754r.c:272
no_os_spi_write_and_read
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
AD5754R_BYTE_L
#define AD5754R_BYTE_L
Definition: ad5754r.h:102
AD5754R_DAC_CH_A
@ AD5754R_DAC_CH_A
Definition: ad5754r.h:122
ad5754r_set_int_ref_pwrup
int ad5754r_set_int_ref_pwrup(struct ad5754r_dev *dev, enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup)
Set Internal Reference Enable/Disable state for device.
Definition: ad5754r.c:533
ad5754r_dev::clear_sel
enum ad5754r_ctrl_clear_sel clear_sel
Definition: ad5754r.h:282
ad5754r_read_dac_ch_register
int ad5754r_read_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn, uint16_t *value)
Read DAC register value for specific channel.
Definition: ad5754r.c:272
no_os_spi.h
Header file of SPI Interface.
ad5754r_update_dac_ch_register
int ad5754r_update_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn, uint16_t value)
Update DAC register value for specific channel.
Definition: ad5754r.c:165
ad5754r_dev::int_ref_pwrup
enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup
Definition: ad5754r.h:288
ad5754r.h
Header file of AD5754R Driver.
ad5754r_dev::clamp_en
enum ad5754r_ctrl_current_clamp_en clamp_en
Definition: ad5754r.h:278
ad5754r_pwr_oc_ch_alert
ad5754r_pwr_oc_ch_alert
DAC Channel Overcurrent Alert State.
Definition: ad5754r.h:219
AD5754R_REG_OUTPUT_RANGE_SEL
#define AD5754R_REG_OUTPUT_RANGE_SEL
Definition: ad5754r.h:58
ad5754r_set_current_clamp_en
int ad5754r_set_current_clamp_en(struct ad5754r_dev *dev, enum ad5754r_ctrl_current_clamp_en clamp_en)
Apply current clamp setting for device.
Definition: ad5754r.c:425
ad5754r_dac_ch_range
ad5754r_dac_ch_range
DAC Channel Output Ranges.
Definition: ad5754r.h:132
AD5754R_CTRL_CLAMP_EN
#define AD5754R_CTRL_CLAMP_EN(X)
Definition: ad5754r.h:84
ad5754r_gpio_init
int ad5754r_gpio_init(struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
Do GPIO initialization and config for AD5754R.
Definition: ad5754r.c:658
ad5754r_init_param::gpio_ldac_init
struct no_os_gpio_init_param * gpio_ldac_init
Definition: ad5754r.h:243
AD5754R_PWR_OC_ALERT_CH_MASK
#define AD5754R_PWR_OC_ALERT_CH_MASK(x)
Definition: ad5754r.h:97
AD5754R_PWR_TSD_DETECTED
@ AD5754R_PWR_TSD_DETECTED
Definition: ad5754r.h:212
ad5754r_set_int_ref_pwrup
int ad5754r_set_int_ref_pwrup(struct ad5754r_dev *dev, enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup)
Set Internal Reference Enable/Disable state for device.
Definition: ad5754r.c:533
ad5754r_init_param::sdo_dis
enum ad5754r_ctrl_sdo_dis sdo_dis
Definition: ad5754r.h:253
ad5754r_init_param::tsd_en
enum ad5754r_ctrl_tsd_en tsd_en
Definition: ad5754r.h:249
AD5754R_WRITE
#define AD5754R_WRITE
Definition: ad5754r.h:105
no_os_delay.h
Header file of Delay functions.
ad5754r_dev::gpio_clear
struct no_os_gpio_desc * gpio_clear
Definition: ad5754r.h:272
ad5754r_set_ch_pwrup
int ad5754r_set_ch_pwrup(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_dac_ch_pwrup ch_pwrup)
Set power-up state for specific channel.
Definition: ad5754r.c:395
device
Definition: ad9361_util.h:69
AD5754R_CTRL_SDO_DIS
@ AD5754R_CTRL_SDO_DIS
Definition: ad5754r.h:185
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
ad5754r_encoding_scheme
ad5754r_encoding_scheme
DAC encoding scheme: Binary/2sComplement.
Definition: ad5754r.h:228
ad5754r_dac_mvolts_to_code
int ad5754r_dac_mvolts_to_code(struct ad5754r_dev *dev, uint8_t chn, uint16_t mvolts, uint16_t *code)
Convert DAC millivolts to code for specific channel.
Definition: ad5754r.c:333
AD5754R_PWR_TSD_NOT_DETECTED
@ AD5754R_PWR_TSD_NOT_DETECTED
Definition: ad5754r.h:211
AD5754R_CTRL_CLAMP_EN_MASK
#define AD5754R_CTRL_CLAMP_EN_MASK
Definition: ad5754r.h:85
ad5754r_dev
ad5754r Device structure.
Definition: ad5754r.h:268
ad5754r_set_sdo_disable
int ad5754r_set_sdo_disable(struct ad5754r_dev *dev, enum ad5754r_ctrl_sdo_dis sdo_dis)
Set SDO Enable/Disable state for device.
Definition: ad5754r.c:506
ad5754r_ctrl_current_clamp_en
ad5754r_ctrl_current_clamp_en
Current Clamp EN/DIS Modes.
Definition: ad5754r.h:156
ad5754r_gpio_init
int ad5754r_gpio_init(struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
Do GPIO initialization and config for AD5754R.
Definition: ad5754r.c:658
ad5754r_update_dac_all_ch_registers
int ad5754r_update_dac_all_ch_registers(struct ad5754r_dev *dev, uint16_t value)
Update DAC register value for all channels.
Definition: ad5754r.c:192
AD5754R_DAC_CH_D
@ AD5754R_DAC_CH_D
Definition: ad5754r.h:125
AD5754R_DAC_CH_C
@ AD5754R_DAC_CH_C
Definition: ad5754r.h:124
AD5754R_GAIN_SCALE
#define AD5754R_GAIN_SCALE
Definition: ad5754r.h:111
ad5754r_dev::tsd_en
enum ad5754r_ctrl_tsd_en tsd_en
Definition: ad5754r.h:280
AD5754R_REG_DAC
#define AD5754R_REG_DAC
Definition: ad5754r.h:57
ad5754r_set_sdo_disable
int ad5754r_set_sdo_disable(struct ad5754r_dev *dev, enum ad5754r_ctrl_sdo_dis sdo_dis)
Set SDO Enable/Disable state for device.
Definition: ad5754r.c:506
ad5754r_init_param::dac_ch_pwr_states
enum ad5754r_pwr_dac_ch_pwrup dac_ch_pwr_states[AD5754R_NUM_CHANNELS]
Definition: ad5754r.h:255
AD5754R_INSTR_CLEAR
#define AD5754R_INSTR_CLEAR
Definition: ad5754r.h:108
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
AD5754R_PWR_DAC_CH_POWERDOWN
@ AD5754R_PWR_DAC_CH_POWERDOWN
Definition: ad5754r.h:193
ad5754r_init_param
ad5754r Device initialization parameters.
Definition: ad5754r.h:237
AD5754R_DAC_CH_B
@ AD5754R_DAC_CH_B
Definition: ad5754r.h:123
ad5754r_write
int ad5754r_write(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t reg_val)
Write device register.
Definition: ad5754r.c:71
ad5754r_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad5754r.h:270
AD5754R_SPAN_M5V_TO_5V
@ AD5754R_SPAN_M5V_TO_5V
Definition: ad5754r.h:136
AD5754R_LOAD_DAC_ADDR
@ AD5754R_LOAD_DAC_ADDR
Definition: ad5754r.h:149
AD5754R_SPAN_0V_TO_5V
@ AD5754R_SPAN_0V_TO_5V
Definition: ad5754r.h:133
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ad5754r_dev::gpio_ldac
struct no_os_gpio_desc * gpio_ldac
Definition: ad5754r.h:274
ad5754r_clear_async
int ad5754r_clear_async(struct ad5754r_dev *dev)
Clear DAC output for all channels.
Definition: ad5754r.c:246
AD5754R_SPAN_0V_TO_10V8
@ AD5754R_SPAN_0V_TO_10V8
Definition: ad5754r.h:135
ad5754r_spi_verify
int ad5754r_spi_verify(struct ad5754r_dev *dev)
Write to and read back a register to verify SPI.
Definition: ad5754r.c:619
no_os_error.h
Error codes definition.
ad5754r_dev::encoding
enum ad5754r_encoding_scheme encoding
Definition: ad5754r.h:290
AD5754R_SPAN_M10V8_TO_10V8
@ AD5754R_SPAN_M10V8_TO_10V8
Definition: ad5754r.h:138
AD5754R_PWR_OC_CH_DETECTED
@ AD5754R_PWR_OC_CH_DETECTED
Definition: ad5754r.h:221
ad5754r_ctrl_clear_sel
ad5754r_ctrl_clear_sel
Clear Mode Options.
Definition: ad5754r.h:174
AD5754R_CTRL_TSD_EN
#define AD5754R_CTRL_TSD_EN(x)
Definition: ad5754r.h:82
ad5754r_dac_code_to_mvolts
int ad5754r_dac_code_to_mvolts(struct ad5754r_dev *dev, uint8_t chn, uint16_t code, uint16_t *value)
Convert DAC code to millivolts for specific channel.
Definition: ad5754r.c:292
ad5754r_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad5754r.h:239
ad5754r_remove_gpios
int ad5754r_remove_gpios(struct ad5754r_dev *dev)
Remove GPIOs and free resources.
Definition: ad5754r.c:810
AD5754R_PWR_TSD_ALERT_MASK
#define AD5754R_PWR_TSD_ALERT_MASK
Definition: ad5754r.h:99
AD5754R_MAX_RESOLUTION
#define AD5754R_MAX_RESOLUTION
Definition: ad5754r.h:51
AD5754R_TSD_CLAMP_CLR_SDO_DAC_ADDR
@ AD5754R_TSD_CLAMP_CLR_SDO_DAC_ADDR
Definition: ad5754r.h:147
ad5754r_init_param::clear_sel
enum ad5754r_ctrl_clear_sel clear_sel
Definition: ad5754r.h:251
ad5754r_init
int ad5754r_init(struct ad5754r_dev **device, struct ad5754r_init_param *init_param)
Initialize the device.
Definition: ad5754r.c:751
ad5754r_set_ch_range
int ad5754r_set_ch_range(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_dac_ch_range ch_range)
Set output range for specific channel.
Definition: ad5754r.c:369
ad5754r_read
int ad5754r_read(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t *reg_val)
Read device register.
Definition: ad5754r.c:98
AD5754R_INSTR_NOP
#define AD5754R_INSTR_NOP
Definition: ad5754r.h:107
AD5754R_ENCODING_BINARY
@ AD5754R_ENCODING_BINARY
Definition: ad5754r.h:230
ad5754r_gain_values_scaled
const unsigned int ad5754r_gain_values_scaled[AD5754R_SPAN_M10V8_TO_10V8+1]
Definition: ad5754r.c:48
ad5754r_set_clear_mode
int ad5754r_set_clear_mode(struct ad5754r_dev *dev, enum ad5754r_ctrl_clear_sel clear_sel)
Set clear mode setting for device.
Definition: ad5754r.c:479
ad5754r_get_tsd_alert
int ad5754r_get_tsd_alert(struct ad5754r_dev *dev, enum ad5754r_pwr_tsd_alert *tsd_alert)
Get Thermal Shutdown status bit.
Definition: ad5754r.c:591
AD5754R_PREP_INSTR_ADDR
#define AD5754R_PREP_INSTR_ADDR(reg, dac_ch)
Definition: ad5754r.h:74
no_os_gpio_remove
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
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:192
AD5754R_PWR_INT_REF_POWERDOWN
@ AD5754R_PWR_INT_REF_POWERDOWN
Definition: ad5754r.h:202
AD5754R_INSTR_LOAD
#define AD5754R_INSTR_LOAD
Definition: ad5754r.h:109
ad5754r_pwr_tsd_alert
ad5754r_pwr_tsd_alert
Thermal Shutdown Alert State.
Definition: ad5754r.h:210
AD5754R_CTRL_TSD_DIS
@ AD5754R_CTRL_TSD_DIS
Definition: ad5754r.h:166
ad5754r_gain_values_scaled
const unsigned int ad5754r_gain_values_scaled[AD5754R_SPAN_M10V8_TO_10V8+1]
Definition: ad5754r.c:48
ad5754r_pwr_int_ref_pwrup
ad5754r_pwr_int_ref_pwrup
Internal Reference Powerup Modes.
Definition: ad5754r.h:201
AD5754R_NOP_DAC_ADDR
@ AD5754R_NOP_DAC_ADDR
Definition: ad5754r.h:146
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
AD5754R_DAC_CH_A_ADDR
#define AD5754R_DAC_CH_A_ADDR
Definition: ad5754r.h:63
ad5754r_ldac_trigger
int ad5754r_ldac_trigger(struct ad5754r_dev *dev)
Trigger LDAC.
Definition: ad5754r.c:219
ad5754r_update_dac_all_ch_registers
int ad5754r_update_dac_all_ch_registers(struct ad5754r_dev *dev, uint16_t value)
Update DAC register value for all channels.
Definition: ad5754r.c:192
AD5754R_CTRL_SDO_EN
@ AD5754R_CTRL_SDO_EN
Definition: ad5754r.h:184
ad5754r_dev::dac_ch_pwr_states
enum ad5754r_pwr_dac_ch_pwrup dac_ch_pwr_states[AD5754R_NUM_CHANNELS]
Definition: ad5754r.h:286
ad5754r_dev::sdo_dis
enum ad5754r_ctrl_sdo_dis sdo_dis
Definition: ad5754r.h:284
ad5754r_get_oc_ch_alert
int ad5754r_get_oc_ch_alert(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_oc_ch_alert *oc_ch_alert)
Get Over-current status bit for specific channel.
Definition: ad5754r.c:563
ad5754r_dev::vref_mv
uint16_t vref_mv
Definition: ad5754r.h:292
AD5754R_CTRL_CLEAR_0V
@ AD5754R_CTRL_CLEAR_0V
Definition: ad5754r.h:175
AD5754R_DAC_CH_ALL_ADDR
#define AD5754R_DAC_CH_ALL_ADDR
Definition: ad5754r.h:67
AD5754R_SPAN_0V_TO_10V
@ AD5754R_SPAN_0V_TO_10V
Definition: ad5754r.h:134
ad5754r_read
int ad5754r_read(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t *reg_val)
Read device register.
Definition: ad5754r.c:98
no_os_malloc
void * no_os_malloc(size_t size)
Allocate memory and return a pointer to it.
Definition: chibios_alloc.c:43
ad5754r_write
int ad5754r_write(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t reg_val)
Write device register.
Definition: ad5754r.c:71
AD5754R_ENCODING_TWOSCOMPLEMENT
@ AD5754R_ENCODING_TWOSCOMPLEMENT
Definition: ad5754r.h:229
ad5754r_get_tsd_alert
int ad5754r_get_tsd_alert(struct ad5754r_dev *dev, enum ad5754r_pwr_tsd_alert *tsd_alert)
Get Thermal Shutdown status bit.
Definition: ad5754r.c:591
AD5754R_PWR_DAC_CH_POWERUP
@ AD5754R_PWR_DAC_CH_POWERUP
Definition: ad5754r.h:194
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
AD5754R_CTRL_CLAMP_EN
@ AD5754R_CTRL_CLAMP_EN
Definition: ad5754r.h:158
AD5754R_REG_CONTROL
#define AD5754R_REG_CONTROL
Definition: ad5754r.h:60
ad5754r_init_param::encoding
enum ad5754r_encoding_scheme encoding
Definition: ad5754r.h:259
ad5754r_set_tsd_en
int ad5754r_set_tsd_en(struct ad5754r_dev *dev, enum ad5754r_ctrl_tsd_en tsd_en)
Apply TSD setting for device.
Definition: ad5754r.c:452
ad5754r_clear_async
int ad5754r_clear_async(struct ad5754r_dev *dev)
Clear DAC output for all channels.
Definition: ad5754r.c:246
no_os_free
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
ad5754r_set_ch_pwrup
int ad5754r_set_ch_pwrup(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_dac_ch_pwrup ch_pwrup)
Set power-up state for specific channel.
Definition: ad5754r.c:395
AD5754R_SPAN_M10V_TO_10V
@ AD5754R_SPAN_M10V_TO_10V
Definition: ad5754r.h:137
ad5754r_pwr_dac_ch_pwrup
ad5754r_pwr_dac_ch_pwrup
DAC Channel Powerup Modes.
Definition: ad5754r.h:192
AD5754R_PWR_INT_REF_POWERUP
@ AD5754R_PWR_INT_REF_POWERUP
Definition: ad5754r.h:203
AD5754R_PWR_UP_INT_REF_MASK
#define AD5754R_PWR_UP_INT_REF_MASK
Definition: ad5754r.h:95
ad5754r_remove
int ad5754r_remove(struct ad5754r_dev *dev)
Remove the device and release resources.
Definition: ad5754r.c:837
ad5754r_dev::dac_ch_range
enum ad5754r_dac_ch_range dac_ch_range[AD5754R_NUM_CHANNELS]
Definition: ad5754r.h:276
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
ad5754r_ldac_trigger
int ad5754r_ldac_trigger(struct ad5754r_dev *dev)
Trigger LDAC.
Definition: ad5754r.c:219
AD5754R_PWR_UP_DAC_CH_MASK
#define AD5754R_PWR_UP_DAC_CH_MASK(x)
Definition: ad5754r.h:94
ad5754r_dac_mvolts_to_code
int ad5754r_dac_mvolts_to_code(struct ad5754r_dev *dev, uint8_t chn, uint16_t mvolts, uint16_t *code)
Convert DAC millivolts to code for specific channel.
Definition: ad5754r.c:333
ad5754r_update_bits
int ad5754r_update_bits(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t mask, uint16_t reg_val)
Update specific register bits.
Definition: ad5754r.c:140
AD5754R_BYTE_H
#define AD5754R_BYTE_H
Definition: ad5754r.h:101
no_os_gpio_set_value
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
ad5754r_init_param::gpio_clear_init
struct no_os_gpio_init_param * gpio_clear_init
Definition: ad5754r.h:241
ad5754r_get_oc_ch_alert
int ad5754r_get_oc_ch_alert(struct ad5754r_dev *dev, uint8_t chn, enum ad5754r_pwr_oc_ch_alert *oc_ch_alert)
Get Over-current status bit for specific channel.
Definition: ad5754r.c:563
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
AD5754R_CTRL_CLAMP_DIS
@ AD5754R_CTRL_CLAMP_DIS
Definition: ad5754r.h:157
AD5754R_CTRL_TSD_EN
@ AD5754R_CTRL_TSD_EN
Definition: ad5754r.h:167
ad5754r_update_dac_ch_register
int ad5754r_update_dac_ch_register(struct ad5754r_dev *dev, uint8_t chn, uint16_t value)
Update DAC register value for specific channel.
Definition: ad5754r.c:165
ad5754r_dac_addr_for_ctrl_settings
ad5754r_dac_addr_for_ctrl_settings
DAC Addresses for Control Register Settings.
Definition: ad5754r.h:145
no_os_spi_remove
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
ad5754r_init
int ad5754r_init(struct ad5754r_dev **device, struct ad5754r_init_param *init_param)
Initialize the device.
Definition: ad5754r.c:751
ad5754r_set_tsd_en
int ad5754r_set_tsd_en(struct ad5754r_dev *dev, enum ad5754r_ctrl_tsd_en tsd_en)
Apply TSD setting for device.
Definition: ad5754r.c:452
no_os_gpio.h
Header file of GPIO Interface.
AD5754R_CTRL_CLEAR_MIDSCALE_CODE
@ AD5754R_CTRL_CLEAR_MIDSCALE_CODE
Definition: ad5754r.h:176
AD5754R_CLEAR_DAC_ADDR
@ AD5754R_CLEAR_DAC_ADDR
Definition: ad5754r.h:148
AD5754R_REG_PWR_CTRL
#define AD5754R_REG_PWR_CTRL
Definition: ad5754r.h:59
no_os_spi_init
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
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
ad5754r_spi_verify
int ad5754r_spi_verify(struct ad5754r_dev *dev)
Write to and read back a register to verify SPI.
Definition: ad5754r.c:619
ad5754r_update_bits
int ad5754r_update_bits(struct ad5754r_dev *dev, uint8_t instr_addr, uint16_t mask, uint16_t reg_val)
Update specific register bits.
Definition: ad5754r.c:140
no_os_util.h
Header file of utility functions.
AD5754R_CTRL_TSD_EN_MASK
#define AD5754R_CTRL_TSD_EN_MASK
Definition: ad5754r.h:83
ad5754r_init_param::int_ref_pwrup
enum ad5754r_pwr_int_ref_pwrup int_ref_pwrup
Definition: ad5754r.h:257
ad5754r_init_param::vref_mv
uint16_t vref_mv
Definition: ad5754r.h:261
AD5754R_CTRL_SDO_DISABLE_MASK
#define AD5754R_CTRL_SDO_DISABLE_MASK
Definition: ad5754r.h:89
ad5754r_dac_code_to_mvolts
int ad5754r_dac_code_to_mvolts(struct ad5754r_dev *dev, uint8_t chn, uint16_t code, uint16_t *value)
Convert DAC code to millivolts for specific channel.
Definition: ad5754r.c:292
no_os_gpio_direction_output
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
AD5754R_OUTPUT_RANGE_SEL_MASK
#define AD5754R_OUTPUT_RANGE_SEL_MASK
Definition: ad5754r.h:78
ad5754r_init_param::clamp_en
enum ad5754r_ctrl_current_clamp_en clamp_en
Definition: ad5754r.h:247
ad5754r_remove_gpios
int ad5754r_remove_gpios(struct ad5754r_dev *dev)
Remove GPIOs and free resources.
Definition: ad5754r.c:810
ad5754r_dac_channels
ad5754r_dac_channels
DAC Channels.
Definition: ad5754r.h:121
AD5754R_NUM_CHANNELS
#define AD5754R_NUM_CHANNELS
Definition: ad5754r.h:54
ad5754r_reg_init
int ad5754r_reg_init(struct ad5754r_dev *dev, struct ad5754r_init_param *init_param)
Initialize registers based on init parameters.
Definition: ad5754r.c:698
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
no_os_gpio_get_optional
int32_t no_os_gpio_get_optional(struct no_os_gpio_desc **desc, const struct no_os_gpio_init_param *param)
Get the value of an optional GPIO.
Definition: no_os_gpio.c:75