no-OS
ad5460.h
Go to the documentation of this file.
1 /***************************************************************************/
39 #ifndef _AD5460_H
40 #define _AD5460_H
41 
42 /******************************************************************************/
43 /***************************** Include Files **********************************/
44 /******************************************************************************/
45 
46 #include "stdint.h"
47 #include "stdbool.h"
48 #include "no_os_spi.h"
49 #include "no_os_gpio.h"
50 
51 /******************************************************************************/
52 /********************** Macros and Constants Definitions **********************/
53 /******************************************************************************/
54 
55 #define AD5460_NOP 0x00
56 #define AD5460_CH_FUNC_SETUP(x) (0x01 + (x * 6))
57 #define AD5460_OUTPUT_CONFIG(x) (0x02 + (x * 6))
58 #define AD5460_DAC_SLEW_CONFIG(x) (0x03 + (x * 6))
59 #define AD5460_DAC_CODE(x) (0x04 + (x * 6))
60 #define AD5460_DAC_CLR_CODE(x) (0x05 + (x * 6))
61 #define AD5460_DAC_ACTIVE(x) (0x06 + (x * 6))
62 #define AD5460_GPIO_CONFIG(x) (0x19 + x)
63 #define AD5460_WTD_CONFIG 0x1D
64 #define AD5460_DIAG_CONFIG 0x1E
65 #define AD5460_PWR_CONFIG 0x1F
66 #define AD5460_LIVE_STATUS 0x20
67 #define AD5460_DIGITAL_ALERT_STATUS 0x21
68 #define AD5460_ANALOG_ALERT_STATUS 0x22
69 #define AD5460_DIGITAL_ALERT_MSK 0x23
70 #define AD5460_ANALOG_ALERT_MSK 0x24
71 #define AD5460_READ_SELECT 0x73
72 #define AD5460_THERM_RST 0x74
73 #define AD5460_CMD_KEY 0x75
74 #define AD5460_BROADCAST_CMD_KEY 0x76
75 #define AD5460_SCRATCH(x) (0x77 + x)
76 #define AD5460_GENERIC_ID 0x7B
77 #define AD5460_SILICON_REV 0x7C
78 #define AD5460_SILICON_ID0 0x7D
79 #define AD5460_SILICON_ID1 0x7E
80 #define AD5460_SILICON_ID2 0x7F
81 
83 #define AD5460_CMD_KEY_RESET_1 0x9A17
84 #define AD5460_CMD_KEY_RESET_2 0xE9C1
85 
86 /* AD5460_CH_FUNC_SETUP */
87 #define AD5460_CH_FUNC_SETUP_MSK NO_OS_GENMASK(3, 0)
88 
90 #define AD5460_AVDD_SELECT_MSK NO_OS_GENMASK(13, 12)
91 #define AD5460_CLR_EN_MSK NO_OS_BIT(11)
92 #define AD5460_WAIT_LDAC_CMD_MSK NO_OS_BIT(10)
93 #define AD5460_IOUT_RANGE_MSK NO_OS_GENMASK(9, 8)
94 #define AD5460_I_LIMIT_MSK NO_OS_BIT(7)
95 #define AD5460_ALARM_DEG_PERIOD_MSK NO_OS_BIT(6)
96 #define AD5460_VOUT_RANGE_MSK NO_OS_BIT(5)
97 #define AD5460_VIOUT_DRV_EN_DLY_MSK NO_OS_GENMASK(4, 3)
98 #define AD5460_VOUT_4W_EN_MSK NO_OS_BIT(2)
99 #define AD5460_VIOUT_GLITCH_MSK NO_OS_GENMASK(1, 0)
100 
102 #define AD5460_SLEW_EN_MSK NO_OS_GENMASK(5, 4)
103 #define AD5460_SLEW_LIN_STEP_MSK NO_OS_GENMASK(3, 2)
104 #define AD5460_SLEW_LIN_RATE_MSK NO_OS_GENMASK(1, 0)
105 
107 #define AD5460_DAC_CODE_MSK NO_OS_GENMASK(15, 0)
108 
110 #define AD5460_DAC_CLR_CODE_MSK NO_OS_GENMASK(15, 0)
111 
113 #define AD5460_DAC_ACTIVE_MSK NO_OS_GENMASK(15, 0)
114 
116 #define AD5460_GPI_DATA_MSK NO_OS_BIT(5)
117 #define AD5460_GPO_DATA_MSK NO_OS_BIT(4)
118 #define AD5460_GP_WK_PD_EN_MSK NO_OS_BIT(3)
119 #define AD5460_GPIO_SELECT_MSK NO_OS_GENMASK(2, 0)
120 
122 #define AD5460_DIAG_SELECT_MSK NO_OS_GENMASK(4, 0)
123 
125 #define AD5460_REF_EN_MSK NO_OS_BIT(0)
126 
128 #define AD5460_TEMP_ALERT_STATUS_MSK NO_OS_BIT(9)
129 #define AD5460_SUPPLY_STATUS_MSK NO_OS_BIT(8)
130 #define AD5460_ANALOG_IO_SC_STATUS_D_MSK NO_OS_BIT(7)
131 #define AD5460_ANALOG_IO_SC_STATUS_C_MSK NO_OS_BIT(6)
132 #define AD5460_ANALOG_IO_SC_STATUS_B_MSK NO_OS_BIT(5)
133 #define AD5460_ANALOG_IO_SC_STATUS_A_MSK NO_OS_BIT(4)
134 #define AD5460_ANALOG_IO_OC_STATUS_D_MSK NO_OS_BIT(3)
135 #define AD5460_ANALOG_IO_OC_STATUS_C_MSK NO_OS_BIT(2)
136 #define AD5460_ANALOG_IO_OC_STATUS_B_MSK NO_OS_BIT(1)
137 #define AD5460_ANALOG_IO_OC_STATUS_A_MSK NO_OS_BIT(0)
138 
140 #define AD5460_TEMP_ALERT_MSK NO_OS_BIT(4)
141 #define AD5460_CAL_MEM_ERR_MSK NO_OS_BIT(3)
142 #define AD5460_SPI_ERR_MSK NO_OS_BIT(2)
143 #define AD5460_WDT_RESET_OCCURRED_MSK NO_OS_BIT(1)
144 #define AD5460_RESET_OCCURRED_MSK NO_OS_BIT(0)
145 
146 /* ANALOG_ALERT_STATUS Register */
147 #define AD5460_AVDD_HI_ERR_MSK NO_OS_BIT(12)
148 #define AD5460_AVDD_LO_ERR_MSK NO_OS_BIT(11)
149 #define AD5460_AVCC_ERR_MSK NO_OS_BIT(10)
150 #define AD5460_IODVCC_ERR_MSK NO_OS_BIT(9)
151 #define AD5460_AVSS_ERR_MSK NO_OS_BIT(8)
152 #define AD5460_ANALOG_IO_SC_D_MSK NO_OS_BIT(7)
153 #define AD5460_ANALOG_IO_SC_C_MSK NO_OS_BIT(6)
154 #define AD5460_ANALOG_IO_SC_B_MSK NO_OS_BIT(5)
155 #define AD5460_ANALOG_IO_SC_A_MSK NO_OS_BIT(4)
156 #define AD5460_ANALOG_IO_OC_D_MSK NO_OS_BIT(3)
157 #define AD5460_ANALOG_IO_OC_C_MSK NO_OS_BIT(2)
158 #define AD5460_ANALOG_IO_OC_B_MSK NO_OS_BIT(1)
159 #define AD5460_ANALOG_IO_OC_A_MSK NO_OS_BIT(0)
160 
161 /* AD5460 READ_SELECT Register */
162 #define AD5460_READBACK_SELECT_MODE_MSK NO_OS_GENMASK(8, 0)
163 #define AD5460_READBACK_ADDR_MSK NO_OS_GENMASK(8, 0)
164 
165 /* THERM_RST Register */
166 #define AD5460_THERM_RST_MSK NO_OS_GENMASK(8, 0)
167 
168 /* CMD_KEY Register */
169 #define AD5460_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
170 
171 /* BROADCAST_CMD_KEY Register */
172 #define AD5460_BROADCAST_CMD_KEY_MSK NO_OS_GENMASK(15, 0)
173 
174 /* SCRATCH Register */
175 #define AD5460_SCRATCH_BITS_MSK NO_OS_GENMASK(15, 0)
176 
177 /* GENERIC_ID Register */
178 #define AD5460_GENERIC_ID_MSK NO_OS_GENMASK(2, 0)
179 
180 /* SILICON_REV Register */
181 #define AD5460_SILICON_REV_ID_MSK NO_OS_GENMASK(7, 0)
182 
183 /* SILICON_ID0 Register */
184 #define AD5460_LOT_MSK NO_OS_GENMASK(6, 0)
185 
186 /* SILICON_ID1 Register */
187 #define AD5460_Y_COORDS_MSK NO_OS_GENMASK(13, 7)
188 #define AD5460_X_COORDS_MSK NO_OS_GENMASK(6, 0)
189 
190 /* SILICON_ID2 Register */
191 #define AD5460_WAFER_NUM_MSK NO_OS_GENMASK(4, 0)
192 
193 #define AD5460_FRAME_SIZE 5
194 #define AD5460_N_CHANNELS 4
195 #define AD5460_CH_A 0
196 #define AD5460_CH_B 1
197 #define AD5460_CH_C 2
198 #define AD5460_CH_D 3
199 #define AD5460_DAC_RANGE 12000
200 #define AD5460_DAC_CURRENT_RANGE_25MA 25000
201 #define AD5460_DAC_CURRENT_RANGE_20MA 20000
202 #define AD5460_DAC_CURRENT_RANGE_4MA 4000
203 #define AD5460_DAC_RESOLUTION 16
204 
205 /******************************************************************************/
206 /*************************** Types Declarations *******************************/
207 /******************************************************************************/
208 
217 
218 };
219 
226 };
227 
235 };
236 
243 };
244 
253 };
254 
263 };
264 
272 };
273 
305 };
306 
319  uint8_t SUPPLY_STATUS: 1;
320  uint8_t TEMP_ALERT_STATUS: 1;
321 };
322 
328  uint16_t value;
329 };
330 
332  uint8_t dev_addr;
335 };
336 
342  bool enabled;
343  enum ad5460_op_mode function;
347 };
348 
352 struct ad5460_desc {
353  uint8_t dev_addr;
358 };
359 
360 /******************************************************************************/
361 /************************ Functions Declarations ******************************/
362 /******************************************************************************/
363 
365 int ad5460_dac_voltage_to_code(struct ad5460_desc *, int32_t,
366  uint16_t *, uint32_t);
367 
369 int ad5460_dac_current_to_code(struct ad5460_desc *, uint32_t, uint16_t *,
370  uint32_t);
371 
373 int ad5460_reg_write(struct ad5460_desc *, uint32_t, uint16_t);
374 
376 int ad5460_reg_read_raw(struct ad5460_desc *, uint32_t, uint8_t *);
377 
379 int ad5460_reg_read(struct ad5460_desc *, uint32_t, uint16_t *);
380 
382 int ad5460_reg_update(struct ad5460_desc *, uint32_t, uint16_t,
383  uint16_t);
384 
387  uint32_t, enum ad5460_op_mode);
388 
390 int ad5460_set_channel_vout_range(struct ad5460_desc *, uint32_t,
391  enum ad5460_vout_range);
392 
394 int ad5460_set_channel_iout_range(struct ad5460_desc *, uint32_t,
395  enum ad5460_iout_range);
396 
398 int ad5460_set_channel_i_limit(struct ad5460_desc *, uint32_t,
399  enum ad5460_i_limit);
400 
402 int ad5460_set_channel_dac_code(struct ad5460_desc *, uint32_t, uint16_t);
403 
405 int ad5460_set_diag(struct ad5460_desc *, uint32_t,
406  enum ad5460_diag_mode);
407 
409 int ad5460_gpio_get(struct ad5460_desc *, uint32_t, uint8_t *);
410 
412 int ad5460_set_gpio_config(struct ad5460_desc *, uint32_t,
413  enum ad5460_gpio_select);
414 
416 int ad5460_gpio_set(struct ad5460_desc *, uint32_t, uint8_t);
417 
419 int ad5460_get_live(struct ad5460_desc *,
420  union ad5460_live_status *);
421 
423 int ad5460_dac_slew_enable(struct ad5460_desc *, uint32_t,
425  enum ad5460_lin_rate);
426 
428 int ad5460_dac_slew_disable(struct ad5460_desc *, uint32_t);
429 
431 int ad5460_set_therm_rst(struct ad5460_desc *, bool);
432 
434 int ad5460_reset(struct ad5460_desc *);
435 
437 int ad5460_init(struct ad5460_desc **, struct ad5460_init_param *);
438 
440 int ad5460_remove(struct ad5460_desc *desc);
441 
442 #endif // _AD5460_H
ad5460.h
Header file of AD5460 Driver.
ad5460_set_therm_rst
int ad5460_set_therm_rst(struct ad5460_desc *desc, bool enable)
Enable or disable the higher thermal reset.
Definition: ad5460.c:489
ad5460_reg_write
int ad5460_reg_write(struct ad5460_desc *desc, uint32_t addr, uint16_t val)
Write a register's value.
Definition: ad5460.c:196
AD5460_CMD_KEY_RESET_1
#define AD5460_CMD_KEY_RESET_1
Definition: ad5460.h:83
no_os_put_unaligned_be16
void no_os_put_unaligned_be16(uint16_t val, uint8_t *buf)
no_os_alloc.h
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad5460_reg_write
int ad5460_reg_write(struct ad5460_desc *, uint32_t, uint16_t)
Write a register's value.
Definition: ad5460.c:196
AD5460_SLEW_LIN_STEP_MSK
#define AD5460_SLEW_LIN_STEP_MSK
Definition: ad5460.h:103
AD5460_GPI_DATA_MSK
#define AD5460_GPI_DATA_MSK
Definition: ad5460.h:116
AD5460_CH_FUNC_SETUP
#define AD5460_CH_FUNC_SETUP(x)
Definition: ad5460.h:56
AD5460_FRAME_SIZE
#define AD5460_FRAME_SIZE
Definition: ad5460.h:193
AD5460_VOUT_RANGE_NEG12_12V
@ AD5460_VOUT_RANGE_NEG12_12V
Definition: ad5460.h:225
AD5460_CH_FUNC_SETUP_MSK
#define AD5460_CH_FUNC_SETUP_MSK
Definition: ad5460.h:87
ad5460_channel_config::iout_range
enum ad5460_iout_range iout_range
Definition: ad5460.h:345
ad5460_init
int ad5460_init(struct ad5460_desc **, struct ad5460_init_param *)
Initialize the device structure.
Definition: ad5460.c:560
ad5460_set_diag
int ad5460_set_diag(struct ad5460_desc *desc, uint32_t ch, enum ad5460_diag_mode diag_code)
Set which diagnostic value to be loaded in the DIAG_RESULT register.
Definition: ad5460.c:369
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:165
AD5460_READ_SELECT
#define AD5460_READ_SELECT
Definition: ad5460.h:71
ad5460_set_channel_function
int ad5460_set_channel_function(struct ad5460_desc *, uint32_t, enum ad5460_op_mode)
Set the operation mode for a specific channel.
Definition: ad5460.c:261
ad5460_set_channel_dac_code
int ad5460_set_channel_dac_code(struct ad5460_desc *, uint32_t, uint16_t)
Set and load a code for the DAC on a specific channel.
Definition: ad5460.c:356
ad5460_desc
AD5460 device descriptor.
Definition: ad5460.h:352
AD5460_DIAG_SENSE_AVDD_CH_A
@ AD5460_DIAG_SENSE_AVDD_CH_A
Definition: ad5460.h:301
_ad5460_live_status
Bitfield struct which maps on the LIVE_STATUS register.
Definition: ad5460.h:310
ad5460_remove
int ad5460_remove(struct ad5460_desc *desc)
Free the device descriptor.
Definition: ad5460.c:613
ad5460_set_therm_rst
int ad5460_set_therm_rst(struct ad5460_desc *, bool)
Enable or disable the higher thermal reset.
Definition: ad5460.c:489
no_os_spi.h
Header file of SPI Interface.
ad5460_set_channel_i_limit
int ad5460_set_channel_i_limit(struct ad5460_desc *, uint32_t, enum ad5460_i_limit)
Set the current limit for a specific DAC channel in vout mode.
Definition: ad5460.c:335
AD5460_DAC_CURRENT_RANGE_25MA
#define AD5460_DAC_CURRENT_RANGE_25MA
Definition: ad5460.h:200
ad5460_gpio_get
int ad5460_gpio_get(struct ad5460_desc *desc, uint32_t ch, uint8_t *val)
Get the GPO value for a specific channel.
Definition: ad5460.c:415
_ad5460_live_status::ANALOG_IO_OC_STATUS_B
uint8_t ANALOG_IO_OC_STATUS_B
Definition: ad5460.h:312
AD5460_IOUT_RANGE_4_20MA
@ AD5460_IOUT_RANGE_4_20MA
Definition: ad5460.h:234
AD5460_DIAG_SENSE_N_CH_B
@ AD5460_DIAG_SENSE_N_CH_B
Definition: ad5460.h:288
ad5460_live_status
Used to store the live status bit fields.
Definition: ad5460.h:326
ad5460_set_channel_iout_range
int ad5460_set_channel_iout_range(struct ad5460_desc *, uint32_t, enum ad5460_iout_range)
Set the current range for a specific channel.
Definition: ad5460.c:313
AD5460_LIN_RATE_76KHZ8
@ AD5460_LIN_RATE_76KHZ8
Definition: ad5460.h:260
ad5460_slew_lin_step
ad5460_slew_lin_step
The voltage step size of Full Scale DAC Voltage.
Definition: ad5460.h:248
_ad5460_live_status::SUPPLY_STATUS
uint8_t SUPPLY_STATUS
Definition: ad5460.h:319
ad5460_lin_rate
ad5460_lin_rate
Possible update rates for a DAC when slew control is enabled.
Definition: ad5460.h:258
no_os_delay.h
Header file of Delay functions.
AD5460_DIAG_NO_DIAG
@ AD5460_DIAG_NO_DIAG
Definition: ad5460.h:278
AD5460_GPIO_SEL_GPIO
@ AD5460_GPIO_SEL_GPIO
Definition: ad5460.h:270
ad5460_channel_config::i_limit
enum ad5460_i_limit i_limit
Definition: ad5460.h:346
_ad5460_live_status::ANALOG_IO_OC_STATUS_C
uint8_t ANALOG_IO_OC_STATUS_C
Definition: ad5460.h:313
ad5460_reg_read
int ad5460_reg_read(struct ad5460_desc *, uint32_t, uint16_t *)
Read a register's value.
Definition: ad5460.c:211
_ad5460_live_status::ANALOG_IO_SC_STATUS_D
uint8_t ANALOG_IO_SC_STATUS_D
Definition: ad5460.h:318
ad5460_dac_slew_enable
int ad5460_dac_slew_enable(struct ad5460_desc *, uint32_t, enum ad5460_slew_lin_step, enum ad5460_lin_rate)
Configure and enable slew rate control for a DAC on a specific channel.
Definition: ad5460.c:449
ad5460_gpio_set
int ad5460_gpio_set(struct ad5460_desc *desc, uint32_t ch, uint8_t val)
Set the logic value of a GPO pin.
Definition: ad5460.c:396
AD5460_VOLTAGE_OUT
@ AD5460_VOLTAGE_OUT
Definition: ad5460.h:214
ad5460_set_channel_i_limit
int ad5460_set_channel_i_limit(struct ad5460_desc *desc, uint32_t ch, enum ad5460_i_limit i_limit)
Set the current limit for a specific DAC channel in vout mode.
Definition: ad5460.c:335
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
AD5460_CMD_KEY
#define AD5460_CMD_KEY
Definition: ad5460.h:73
AD5460_STEP_0_8_PERCENT
@ AD5460_STEP_0_8_PERCENT
Definition: ad5460.h:249
AD5460_DIAG_SENSE_P_CH_A
@ AD5460_DIAG_SENSE_P_CH_A
Definition: ad5460.h:283
ad5460_desc::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad5460.h:354
_ad5460_live_status::ANALOG_IO_OC_STATUS_A
uint8_t ANALOG_IO_OC_STATUS_A
Definition: ad5460.h:311
AD77416H_DEV_ADDRESS_MSK
#define AD77416H_DEV_ADDRESS_MSK
Definition: ad5460.c:55
AD5460_I_LIMIT1
@ AD5460_I_LIMIT1
Definition: ad5460.h:242
_ad5460_live_status::ANALOG_IO_SC_STATUS_A
uint8_t ANALOG_IO_SC_STATUS_A
Definition: ad5460.h:315
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:60
AD5460_DIAG_SENSE_CH_B
@ AD5460_DIAG_SENSE_CH_B
Definition: ad5460.h:284
ad5460_iout_range
ad5460_iout_range
Possible current output ranges for the DAC.
Definition: ad5460.h:231
AD5460_I_LIMIT_MSK
#define AD5460_I_LIMIT_MSK
Definition: ad5460.h:94
AD5460_IOUT_RANGE_0_20MA
@ AD5460_IOUT_RANGE_0_20MA
Definition: ad5460.h:233
AD5460_STEP_22_2_PERCENT
@ AD5460_STEP_22_2_PERCENT
Definition: ad5460.h:252
AD5460_LIN_RATE_4KHZ8
@ AD5460_LIN_RATE_4KHZ8
Definition: ad5460.h:259
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
AD5460_DIAG_SENSE_AVDD_LO
@ AD5460_DIAG_SENSE_AVDD_LO
Definition: ad5460.h:299
AD5460_DIAG_INT_BG_V
@ AD5460_DIAG_INT_BG_V
Definition: ad5460.h:282
AD5460_GPIO_SEL_HIGH_Z
@ AD5460_GPIO_SEL_HIGH_Z
Definition: ad5460.h:269
AD5460_N_CHANNELS
#define AD5460_N_CHANNELS
Definition: ad5460.h:194
ad5460_remove
int ad5460_remove(struct ad5460_desc *desc)
Free the device descriptor.
Definition: ad5460.c:613
NO_OS_DECLARE_CRC8_TABLE
NO_OS_DECLARE_CRC8_TABLE(_crc_table)
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:132
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
ad5460_set_channel_iout_range
int ad5460_set_channel_iout_range(struct ad5460_desc *desc, uint32_t ch, enum ad5460_iout_range iout_range)
Set the current range for a specific channel.
Definition: ad5460.c:313
ad5460_desc::reset_gpio
struct no_os_gpio_desc * reset_gpio
Definition: ad5460.h:357
AD5460_DIAG_SENSE_AVDD_CH_B
@ AD5460_DIAG_SENSE_AVDD_CH_B
Definition: ad5460.h:302
AD5460_DIAG_SENSE_DGND
@ AD5460_DIAG_SENSE_DGND
Definition: ad5460.h:297
AD5460_DAC_CURRENT_RANGE_20MA
#define AD5460_DAC_CURRENT_RANGE_20MA
Definition: ad5460.h:201
no_os_error.h
Error codes definition.
ad5460_get_live
int ad5460_get_live(struct ad5460_desc *, union ad5460_live_status *)
Read the live status bits.
Definition: ad5460.c:435
ad5460_init_param::dev_addr
uint8_t dev_addr
Definition: ad5460.h:332
ad5460_set_gpio_config
int ad5460_set_gpio_config(struct ad5460_desc *, uint32_t, enum ad5460_gpio_select)
Set the GPIO operation mode.
Definition: ad5460.c:382
no_os_crc8_populate_msb
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
ad5460_dac_slew_disable
int ad5460_dac_slew_disable(struct ad5460_desc *, uint32_t)
Disable the slew rate control.
Definition: ad5460.c:475
ad5460_gpio_select
ad5460_gpio_select
GPO operation modes.
Definition: ad5460.h:268
AD5460_VOUT_RANGE_0_12V
@ AD5460_VOUT_RANGE_0_12V
Definition: ad5460.h:224
AD5460_SLEW_LIN_RATE_MSK
#define AD5460_SLEW_LIN_RATE_MSK
Definition: ad5460.h:104
AD5460_DIAG_SENSE_P_CH_C
@ AD5460_DIAG_SENSE_P_CH_C
Definition: ad5460.h:285
AD5460_CRC_POLYNOMIAL
#define AD5460_CRC_POLYNOMIAL
Definition: ad5460.c:53
ad5460_reset
int ad5460_reset(struct ad5460_desc *)
Perform software or hardware reset and wait for device reset time.
Definition: ad5460.c:499
AD5460_DAC_CODE
#define AD5460_DAC_CODE(x)
Definition: ad5460.h:59
AD5460_GPIO_CONFIG
#define AD5460_GPIO_CONFIG(x)
Definition: ad5460.h:62
AD5460_GPO_DATA_MSK
#define AD5460_GPO_DATA_MSK
Definition: ad5460.h:117
AD5460_DIAG_REFIN
@ AD5460_DIAG_REFIN
Definition: ad5460.h:280
AD5460_LIN_RATE_230KHZ4
@ AD5460_LIN_RATE_230KHZ4
Definition: ad5460.h:262
AD5460_DIAG_PTAT
@ AD5460_DIAG_PTAT
Definition: ad5460.h:279
ad5460_channel_config::function
enum ad5460_op_mode function
Definition: ad5460.h:343
ad5460_init_param::spi_ip
struct no_os_spi_init_param spi_ip
Definition: ad5460.h:333
ad5460_reset
int ad5460_reset(struct ad5460_desc *desc)
Perform software or hardware reset and wait for device reset time.
Definition: ad5460.c:499
AD5460_DAC_CURRENT_RANGE_4MA
#define AD5460_DAC_CURRENT_RANGE_4MA
Definition: ad5460.h:202
AD5460_DIAG_SENSE_AGND3
@ AD5460_DIAG_SENSE_AGND3
Definition: ad5460.h:296
AD5460_THERM_RST
#define AD5460_THERM_RST
Definition: ad5460.h:72
ad5460_desc::comm_buff
uint8_t comm_buff[AD5460_FRAME_SIZE]
Definition: ad5460.h:355
_ad5460_live_status::ANALOG_IO_SC_STATUS_C
uint8_t ANALOG_IO_SC_STATUS_C
Definition: ad5460.h:317
AD5460_DIAG_SENSE_AVCC
@ AD5460_DIAG_SENSE_AVCC
Definition: ad5460.h:291
AD5460_OUTPUT_CONFIG
#define AD5460_OUTPUT_CONFIG(x)
Definition: ad5460.h:57
_ad5460_live_status::ANALOG_IO_OC_STATUS_D
uint8_t ANALOG_IO_OC_STATUS_D
Definition: ad5460.h:314
ad5460_diag_mode
ad5460_diag_mode
Possible values to be loaded in the DIAG_RESULT register.
Definition: ad5460.h:277
ad5460_init_param
Definition: ad5460.h:331
ad5460_set_diag
int ad5460_set_diag(struct ad5460_desc *, uint32_t, enum ad5460_diag_mode)
Set which diagnostic value to be loaded in the DIAG_RESULT register.
Definition: ad5460.c:369
AD5460_CURRENT_OUT_HART
@ AD5460_CURRENT_OUT_HART
Definition: ad5460.h:216
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:110
AD5460_IOUT_RANGE_MSK
#define AD5460_IOUT_RANGE_MSK
Definition: ad5460.h:93
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
AD5460_DIAG_REFOUT
@ AD5460_DIAG_REFOUT
Definition: ad5460.h:281
AD5460_DIAG_SENSE_N_CH_C
@ AD5460_DIAG_SENSE_N_CH_C
Definition: ad5460.h:289
AD5460_DIAG_SENSE_DVCC
@ AD5460_DIAG_SENSE_DVCC
Definition: ad5460.h:293
AD5460_SLEW_EN_MSK
#define AD5460_SLEW_EN_MSK
Definition: ad5460.h:102
ad5460_reg_read_raw
int ad5460_reg_read_raw(struct ad5460_desc *, uint32_t, uint8_t *)
Read a raw communication frame.
Definition: ad5460.c:165
ad5460_i_limit
ad5460_i_limit
DAC Current limits in Vout mode.
Definition: ad5460.h:240
ad5460_set_channel_vout_range
int ad5460_set_channel_vout_range(struct ad5460_desc *desc, uint32_t ch, enum ad5460_vout_range vout_range)
Set the voltage range for a specific channel.
Definition: ad5460.c:291
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ad5460_set_channel_vout_range
int ad5460_set_channel_vout_range(struct ad5460_desc *, uint32_t, enum ad5460_vout_range)
Set the voltage range for a specific channel.
Definition: ad5460.c:291
ad5460_init_param::reset_gpio_param
struct no_os_gpio_init_param * reset_gpio_param
Definition: ad5460.h:334
ad5460_desc::dev_addr
uint8_t dev_addr
Definition: ad5460.h:353
ad5460_channel_config
Device channel state.
Definition: ad5460.h:341
AD5460_CURRENT_OUT
@ AD5460_CURRENT_OUT
Definition: ad5460.h:215
ad5460_vout_range
ad5460_vout_range
Possible voltage output ranges for the DAC.
Definition: ad5460.h:223
AD5460_LIVE_STATUS
#define AD5460_LIVE_STATUS
Definition: ad5460.h:66
ad5460_channel_config::vout_range
enum ad5460_vout_range vout_range
Definition: ad5460.h:344
ad5460_dac_slew_enable
int ad5460_dac_slew_enable(struct ad5460_desc *desc, uint32_t ch, enum ad5460_slew_lin_step step, enum ad5460_lin_rate rate)
Configure and enable slew rate control for a DAC on a specific channel.
Definition: ad5460.c:449
AD5460_GPIO_SEL_GPI
@ AD5460_GPIO_SEL_GPI
Definition: ad5460.h:271
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ad5460_gpio_set
int ad5460_gpio_set(struct ad5460_desc *, uint32_t, uint8_t)
Set the logic value of a GPO pin.
Definition: ad5460.c:396
AD5460_DIAG_SENSE_AVSS
@ AD5460_DIAG_SENSE_AVSS
Definition: ad5460.h:300
AD5460_DIAG_SENSE_LDO
@ AD5460_DIAG_SENSE_LDO
Definition: ad5460.h:292
ad5460_reg_update
int ad5460_reg_update(struct ad5460_desc *desc, uint32_t addr, uint16_t mask, uint16_t val)
Update a register's field.
Definition: ad5460.c:237
NO_OS_BIT
#define NO_OS_BIT(x)
Definition: no_os_util.h:51
AD5460_DIAG_SENSE_AVDD_CH_D
@ AD5460_DIAG_SENSE_AVDD_CH_D
Definition: ad5460.h:304
no_os_crc8
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
AD5460_LIN_RATE_153KHZ6
@ AD5460_LIN_RATE_153KHZ6
Definition: ad5460.h:261
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:75
AD5460_STEP_1_5_PERCENT
@ AD5460_STEP_1_5_PERCENT
Definition: ad5460.h:250
AD5460_SCRATCH
#define AD5460_SCRATCH(x)
Definition: ad5460.h:75
AD5460_VOUT_RANGE_MSK
#define AD5460_VOUT_RANGE_MSK
Definition: ad5460.h:96
ad5460_dac_current_to_code
int ad5460_dac_current_to_code(struct ad5460_desc *desc, uint32_t uamps, uint16_t *code, uint32_t ch)
Convers a microamp value in the corresponding DAC 16 bit code.
Definition: ad5460.c:109
ad5460_live_status::status_bits
struct _ad5460_live_status status_bits
Definition: ad5460.h:327
AD5460_DIAG_SENSE_P_CH_D
@ AD5460_DIAG_SENSE_P_CH_D
Definition: ad5460.h:286
_ad5460_live_status::ANALOG_IO_SC_STATUS_B
uint8_t ANALOG_IO_SC_STATUS_B
Definition: ad5460.h:316
AD5460_I_LIMIT0
@ AD5460_I_LIMIT0
Definition: ad5460.h:241
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
NULL
#define NULL
Definition: wrapper.h:64
ad5460_op_mode
ad5460_op_mode
Operation modes of the device.
Definition: ad5460.h:212
ad5460_channel_config::enabled
bool enabled
Definition: ad5460.h:342
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:203
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:119
AD5460_DIAG_SENSE_N_CH_A
@ AD5460_DIAG_SENSE_N_CH_A
Definition: ad5460.h:287
ad5460_reg_read_raw
int ad5460_reg_read_raw(struct ad5460_desc *desc, uint32_t addr, uint8_t *val)
Read a raw communication frame.
Definition: ad5460.c:165
ad5460_dac_voltage_to_code
int ad5460_dac_voltage_to_code(struct ad5460_desc *, int32_t, uint16_t *, uint32_t)
Converts a millivolt value in the corresponding DAC 16 bit code.
Definition: ad5460.c:74
AD5460_NOP
#define AD5460_NOP
Definition: ad5460.h:55
AD5460_CMD_KEY_RESET_2
#define AD5460_CMD_KEY_RESET_2
Definition: ad5460.h:84
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:122
no_os_gpio.h
Header file of GPIO Interface.
ad5460_live_status::value
uint16_t value
Definition: ad5460.h:328
AD5460_DIAG_SENSE_AVDD_CH_C
@ AD5460_DIAG_SENSE_AVDD_CH_C
Definition: ad5460.h:303
AD5460_DIAG_SENSE_AVDD_HI
@ AD5460_DIAG_SENSE_AVDD_HI
Definition: ad5460.h:298
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:58
no_os_get_unaligned_be16
uint16_t no_os_get_unaligned_be16(uint8_t *buf)
AD5460_DIAG_SENSE_AGND1
@ AD5460_DIAG_SENSE_AGND1
Definition: ad5460.h:294
ad5460_set_channel_function
int ad5460_set_channel_function(struct ad5460_desc *desc, uint32_t ch, enum ad5460_op_mode ch_func)
Set the operation mode for a specific channel.
Definition: ad5460.c:261
AD5460_DIAG_SENSE_AGND2
@ AD5460_DIAG_SENSE_AGND2
Definition: ad5460.h:295
AD5460_DAC_RANGE
#define AD5460_DAC_RANGE
Definition: ad5460.h:199
ad5460_dac_slew_disable
int ad5460_dac_slew_disable(struct ad5460_desc *desc, uint32_t ch)
Disable the slew rate control.
Definition: ad5460.c:475
ad5460_set_channel_dac_code
int ad5460_set_channel_dac_code(struct ad5460_desc *desc, uint32_t ch, uint16_t dac_code)
Set and load a code for the DAC on a specific channel.
Definition: ad5460.c:356
ad5460_get_live
int ad5460_get_live(struct ad5460_desc *desc, union ad5460_live_status *status)
Read the live status bits.
Definition: ad5460.c:435
no_os_util.h
Header file of utility functions.
ad5460_init
int ad5460_init(struct ad5460_desc **desc, struct ad5460_init_param *init_param)
Initialize the device structure.
Definition: ad5460.c:560
AD5460_HIGH_Z
@ AD5460_HIGH_Z
Definition: ad5460.h:213
AD5460_GPIO_SELECT_MSK
#define AD5460_GPIO_SELECT_MSK
Definition: ad5460.h:119
ad5460_dac_voltage_to_code
int ad5460_dac_voltage_to_code(struct ad5460_desc *desc, int32_t mvolts, uint16_t *code, uint32_t ch)
Converts a millivolt value in the corresponding DAC 16 bit code.
Definition: ad5460.c:74
AD5460_STEP_6_1_PERCENT
@ AD5460_STEP_6_1_PERCENT
Definition: ad5460.h:251
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:153
ad5460_set_gpio_config
int ad5460_set_gpio_config(struct ad5460_desc *desc, uint32_t ch, enum ad5460_gpio_select config)
Set the GPIO operation mode.
Definition: ad5460.c:382
ad5460_reg_update
int ad5460_reg_update(struct ad5460_desc *, uint32_t, uint16_t, uint16_t)
Update a register's field.
Definition: ad5460.c:237
ad5460_gpio_get
int ad5460_gpio_get(struct ad5460_desc *, uint32_t, uint8_t *)
Get the GPO value for a specific channel.
Definition: ad5460.c:415
AD5460_DIAG_SENSE_N_CH_D
@ AD5460_DIAG_SENSE_N_CH_D
Definition: ad5460.h:290
ad5460_reg_read
int ad5460_reg_read(struct ad5460_desc *desc, uint32_t addr, uint16_t *val)
Read a register's value.
Definition: ad5460.c:211
no_os_crc8.h
Header file of CRC-8 computation.
ad5460_desc::channel_configs
struct ad5460_channel_config channel_configs[AD5460_N_CHANNELS]
Definition: ad5460.h:356
AD5460_DIAG_CONFIG
#define AD5460_DIAG_CONFIG
Definition: ad5460.h:64
AD5460_DAC_RESOLUTION
#define AD5460_DAC_RESOLUTION
Definition: ad5460.h:203
ad5460_dac_current_to_code
int ad5460_dac_current_to_code(struct ad5460_desc *, uint32_t, uint16_t *, uint32_t)
Convers a microamp value in the corresponding DAC 16 bit code.
Definition: ad5460.c:109
AD5460_IOUT_RANGE_0_25MA
@ AD5460_IOUT_RANGE_0_25MA
Definition: ad5460.h:232
_ad5460_live_status::TEMP_ALERT_STATUS
uint8_t TEMP_ALERT_STATUS
Definition: ad5460.h:320
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
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:81