no-OS
ad405x.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file ad405x.h
3  * @brief Header file of AD405X Driver.
4  * @author George Mois (george.mois@analog.com)
5  * @author Ribhu Das Purkayastha (ribhu.daspurkayastha@analog.com)
6 ********************************************************************************
7  * Copyright 2024(c) Analog Devices, Inc.
8  *
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions are met:
13  * - Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  * - Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in
17  * the documentation and/or other materials provided with the
18  * distribution.
19  * - Neither the name of Analog Devices, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived
21  * from this software without specific prior written permission.
22  * - The use of this software may or may not infringe the patent rights
23  * of one or more patent holders. This license does not release you
24  * from the requirement that you obtain separate licenses from these
25  * patent holders to use this software.
26  * - Use of the software either in source or binary form, must be run
27  * on or directly connected to an Analog Devices Inc. component.
28  *
29  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
30  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
31  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
32  * IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
33  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
34  * LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
35  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
36  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
37  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
38  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 *******************************************************************************/
40 
41 #ifndef __AD405X_H__
42 #define __AD405X_H__
43 
44 /******************************************************************************/
45 /***************************** Include Files **********************************/
46 /******************************************************************************/
47 
48 #include <stdint.h>
49 #include <string.h>
50 #include "no_os_util.h"
51 #include "no_os_spi.h"
52 #include "no_os_gpio.h"
53 
54 /******************************************************************************/
55 /********************** Macros and Constants Definitions **********************/
56 /******************************************************************************/
57 
59 #define AD405X_REG_INTERFACE_CONFIG_A 0x00
60 #define AD405X_REG_INTERFACE_CONFIG_B 0x01
61 #define AD405X_REG_DEVICE_CONFIG 0x02
62 #define AD405X_REG_DEVICE_TYPE 0x03
63 #define AD405X_REG_PRODUCT_ID_L 0x04
64 #define AD405X_REG_PRODUCT_ID_H 0x05
65 #define AD405X_REG_CHIP_GRADE 0x06
66 #define AD405X_REG_SCRATCH_PAD 0x0A
67 #define AD405X_REG_SPI_REVISION 0x0B
68 #define AD405X_REG_VENDOR_L 0x0C
69 #define AD405X_REG_VENDOR_H 0x0D
70 #define AD405X_REG_STREAM_MODE 0x0E
71 #define AD405X_REG_TRANSFER_CONFIG 0x0F
72 #define AD405X_REG_INTERFACE_CONFIG_C 0x10
73 #define AD405X_REG_INTERFACE_STATUS 0x11
74 #define AD405X_REG_MODE_SET 0x20
75 #define AD405X_REG_ADC_MODES 0x21
76 #define AD405X_REG_ADC_CONFIG 0x22
77 #define AD405X_REG_AVG_CONFIG 0x23
78 #define AD405X_REG_GPIO_CONFIG 0x24
79 #define AD405X_REG_INTR_CONFIG 0x25
80 #define AD405X_REG_CHOP_CONFIG 0x26
81 #define AD405X_REG_TIMER_CONFIG 0x27
82 #define AD405X_REG_MAX_THRESH 0x28
83 #define AD405X_REG_MIN_THRESH 0x2A
84 #define AD405X_REG_MAX_HYST 0x2C
85 #define AD405X_REG_MIN_HYST 0x2D
86 #define AD405X_REG_MON_VAL 0x2E
87 #define AD405X_REG_FUSE_CRC 0x40
88 #define AD405X_REG_DEVICE_STATUS 0x41
89 #define AD405X_REG_MAX_INTR 0x42
90 #define AD405X_REG_MIN_INTR 0x44
91 
93 #define AD405X_SW_RESET_MSK NO_OS_BIT(7) | NO_OS_BIT(0)
94 
96 #define AD405X_SINGLE_INST_MSK NO_OS_BIT(7) /* Should be set to 0. */
97 #define AD405X_SHORT_INST_MSK NO_OS_BIT(3)
98 
100 #define AD405X_STRICT_REG_ACCESS_MSK NO_OS_BIT(5)
101 
103 #define AD405X_ADC_DATA_FORMAT_MSK NO_OS_BIT(7)
104 #define AD405X_ADC_MODES_MSK NO_OS_GENMASK(1, 0)
105 #define AD405X_SAMPLE_MODE 0x00
106 #define AD405X_BURST_AVERAGING_MODE NO_OS_BIT(0)
107 #define AD405X_AVERAGING_MODE NO_OS_BIT(1)
108 #define AD405X_AUTONOMOUS_MODE NO_OS_GENMASK(1, 0)
109 
111 #define AD405X_ENTER_ADC_MODE_MSK NO_OS_BIT(0)
112 #define AD405X_ENTER_ADC_MODE NO_OS_BIT(0)
113 
115 #define AD405X_FS_BURST_AUTO_MSK NO_OS_GENMASK(7, 4)
116 
118 #define AD405X_AVG_WIN_LEN_MSK NO_OS_GENMASK(3, 0)
119 
121 #define AD405X_DEV_EN_POL_MSK NO_OS_BIT(7)
122 #define AD405X_GP1_MODE_MSK NO_OS_GENMASK(6, 4)
123 #define AD405X_INVERT_ON_CHOP_MSK NO_OS_BIT(3)
124 #define AD405X_GP0_MODE_MSK NO_OS_GENMASK(2, 0)
125 
126 #define AD405X_DEV_EN_POL_LOW ~NO_OS_BIT(7)
127 #define AD405X_DEV_EN_POL_HIGH NO_OS_BIT(7)
128 
129 #define AD405X_INVERT_ON_CHOP_OFF ~NO_OS_BIT(3)
130 #define AD405X_INVERT_ON_CHOP_ON NO_OS_BIT(3)
131 
133 #define AD405X_SW_RESET NO_OS_BIT(7) | NO_OS_BIT(0)
134 #define AD405X_SPI_READ NO_OS_BIT(7)
135 #define BYTE_ADDR_H NO_OS_GENMASK(15, 8)
136 #define BYTE_ADDR_L NO_OS_GENMASK(7, 0)
137 #define AD405X_DEVICE_TYPE NO_OS_GENMASK(2, 0)
138 
139 /******************************************************************************/
140 /************************ Types Declarations **********************************/
141 /******************************************************************************/
142 
151 };
152 
171 };
172 
187 };
188 
193 };
194 
199 };
200 
211 };
212 
217 };
218 
223 };
224 
229 };
230 
234 };
235 
240 struct ad405x_dev {
267 };
268 
290 };
291 
292 /******************************************************************************/
293 /************************ Functions Declarations ******************************/
294 /******************************************************************************/
295 
297 int ad405x_write(struct ad405x_dev *dev,
298  uint8_t reg_addr,
299  uint8_t reg_val);
300 
302 int ad405x_read(struct ad405x_dev *dev,
303  uint8_t reg_addr,
304  uint8_t *reg_val);
305 
307 int ad405x_update_bits(struct ad405x_dev *dev,
308  uint8_t reg_addr,
309  uint8_t mask,
310  uint8_t reg_val);
311 
313 int ad405x_exit_command(struct ad405x_dev *dev);
314 
317 
319 int ad405x_soft_reset(struct ad405x_dev *dev);
320 
322 int ad405x_set_adc_mode(struct ad405x_dev *dev);
323 
326 
328 int ad405x_set_config_mode(struct ad405x_dev *dev);
329 
331 int ad405x_set_operation_mode(struct ad405x_dev *dev,
332  enum ad405x_operation_mode mode);
333 
335 int ad405x_convst(struct ad405x_dev *dev);
336 
338 int ad405x_spi_data_read(struct ad405x_dev *dev,
339  int32_t *data);
340 
342 int ad405x_read_val(struct ad405x_dev *dev, int32_t *data);
343 
345 int ad405x_set_sample_rate(struct ad405x_dev *dev,
346  enum ad405x_sample_rate rate);
347 
350  enum ad405x_avg_filter_l length);
351 
354  struct ad405x_dev *dev);
355 
357 int ad405x_set_dev_en_polarity(struct ad405x_dev *dev,
358  enum ad405x_dev_en_polarity polarity);
359 
362 
365 
368 
371  struct ad405x_dev *dev);
372 
374 int ad405x_set_gp_mode(struct ad405x_dev *dev,
375  enum ad405x_gp_select gp,
376  enum ad405x_gp_mode mode);
377 
380  struct ad405x_dev *dev, enum ad405x_gp_select gp);
381 
383 int ad405x_set_data_format(struct ad405x_dev *dev,
384  enum ad405x_out_data_format data_format);
385 
387 int ad405x_init(struct ad405x_dev **device,
389 
391 int ad405x_remove(struct ad405x_dev *dev);
392 
393 #endif /* __AD405X_H__ */
AD405X_TWOS_COMPLEMENT
@ AD405X_TWOS_COMPLEMENT
Definition: ad405x.h:222
ad405x_get_averaging_filter_length
enum ad405x_avg_filter_l ad405x_get_averaging_filter_length(struct ad405x_dev *dev)
Get averaging filter window length.
Definition: ad405x.c:507
ad405x_dev::operation_mode
enum ad405x_operation_mode operation_mode
Definition: ad405x.h:246
AD405X_GP_MODE_LOW
@ AD405X_GP_MODE_LOW
Definition: ad405x.h:208
ad405x_read
int ad405x_read(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t *reg_val)
Read device register.
Definition: ad405x.c:111
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
AD405X_INVERT_ON_CHOP_ENABLED
@ AD405X_INVERT_ON_CHOP_ENABLED
Definition: ad405x.h:198
AD405X_SPI_READ
#define AD405X_SPI_READ
Definition: ad405x.h:134
AD405X_REG_INTERFACE_CONFIG_A
#define AD405X_REG_INTERFACE_CONFIG_A
Definition: ad405x.h:59
ad405x_operation_mode
ad405x_operation_mode
Definition: ad405x.h:144
AD405X_INVERT_ON_CHOP_MSK
#define AD405X_INVERT_ON_CHOP_MSK
Definition: ad405x.h:123
AD405X_LENGTH_2
@ AD405X_LENGTH_2
Definition: ad405x.h:175
ad405x_dev::gpio_gpio1
struct no_os_gpio_desc * gpio_gpio1
Definition: ad405x.h:252
ad405x_init_param
Definition: ad405x.h:273
ad405x_init_param::rate
enum ad405x_sample_rate rate
Definition: ad405x.h:287
ad405x_convst
int ad405x_convst(struct ad405x_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad405x.c:352
ad405x_dev::gpio_cnv
struct no_os_gpio_desc * gpio_cnv
Definition: ad405x.h:248
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
AD405X_250_SPS
@ AD405X_250_SPS
Definition: ad405x.h:165
AD405X_BURST_AVERAGING_MODE
#define AD405X_BURST_AVERAGING_MODE
Definition: ad405x.h:106
AD405X_LENGTH_32
@ AD405X_LENGTH_32
Definition: ad405x.h:179
ad405x_avg_filter_l
ad405x_avg_filter_l
Definition: ad405x.h:174
ad405x_soft_reset
int ad405x_soft_reset(struct ad405x_dev *dev)
Software reset the device.
Definition: ad405x.c:203
no_os_spi.h
Header file of SPI Interface.
AD405X_INVERT_ON_CHOP_DISABLED
@ AD405X_INVERT_ON_CHOP_DISABLED
Definition: ad405x.h:197
AD405X_LENGTH_8
@ AD405X_LENGTH_8
Definition: ad405x.h:177
AD405X_GP_1
@ AD405X_GP_1
Definition: ad405x.h:216
ad405x_update_bits
int ad405x_update_bits(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_val)
Update specific register bits.
Definition: ad405x.c:138
ad405x_get_averaging_filter_length
enum ad405x_avg_filter_l ad405x_get_averaging_filter_length(struct ad405x_dev *dev)
Get averaging filter window length.
Definition: ad405x.c:507
AD405X_LENGTH_16
@ AD405X_LENGTH_16
Definition: ad405x.h:178
AD405X_BURST_AVERAGING_MODE_OP
@ AD405X_BURST_AVERAGING_MODE_OP
Definition: ad405x.h:148
AD405X_GP_MODE_HIGH
@ AD405X_GP_MODE_HIGH
Definition: ad405x.h:209
ad405x_set_sample_rate
int ad405x_set_sample_rate(struct ad405x_dev *dev, enum ad405x_sample_rate rate)
Select sample rate for Burst and Autonomous Modes.
Definition: ad405x.c:444
ad405x_remove
int ad405x_remove(struct ad405x_dev *dev)
Remove the device and release resources.
Definition: ad405x.c:847
AD405X_AVERAGING_MODE_OP
@ AD405X_AVERAGING_MODE_OP
Definition: ad405x.h:147
AD405X_LENGTH_2048
@ AD405X_LENGTH_2048
Definition: ad405x.h:185
AD405X_LENGTH_4
@ AD405X_LENGTH_4
Definition: ad405x.h:176
no_os_delay.h
Header file of Delay functions.
AD405X_200_SPS
@ AD405X_200_SPS
Definition: ad405x.h:166
AD405X_GP_MODE_CHOP
@ AD405X_GP_MODE_CHOP
Definition: ad405x.h:207
ad405x_set_data_format
int ad405x_set_data_format(struct ad405x_dev *dev, enum ad405x_out_data_format data_format)
Set output data format.
Definition: ad405x.c:699
AD405X_LENGTH_512
@ AD405X_LENGTH_512
Definition: ad405x.h:183
AD405X_GP_MODE_DEV_RDY
@ AD405X_GP_MODE_DEV_RDY
Definition: ad405x.h:210
ad405x_set_dev_en_polarity
int ad405x_set_dev_en_polarity(struct ad405x_dev *dev, enum ad405x_dev_en_polarity polarity)
Set DEV_EN signal polarity.
Definition: ad405x.c:522
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:121
AD405X_125_SPS
@ AD405X_125_SPS
Definition: ad405x.h:169
AD405X_REG_TIMER_CONFIG
#define AD405X_REG_TIMER_CONFIG
Definition: ad405x.h:81
AD405X_NON_PERSISTENT_AUTO_MODE_OP
@ AD405X_NON_PERSISTENT_AUTO_MODE_OP
Definition: ad405x.h:150
ad405x_set_gp_mode
int ad405x_set_gp_mode(struct ad405x_dev *dev, enum ad405x_gp_select gp, enum ad405x_gp_mode mode)
Set GP mode.
Definition: ad405x.c:624
ad405x_init
int ad405x_init(struct ad405x_dev **device, struct ad405x_init_param init_param)
Initialize the device.
Definition: ad405x.c:768
ad405x_init_param::gpio_gpio1
struct no_os_gpio_init_param * gpio_gpio1
Definition: ad405x.h:285
device
Definition: ad9361_util.h:75
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
no_os_print_log.h
Print messages helpers.
AD405X_REG_ADC_MODES
#define AD405X_REG_ADC_MODES
Definition: ad405x.h:75
ad405x_gp_mode
ad405x_gp_mode
Definition: ad405x.h:202
ad405x_get_invert_on_chop_state
enum ad405x_invert_on_chop ad405x_get_invert_on_chop_state(struct ad405x_dev *dev)
Get INVERT_ON_CHOP setting.
Definition: ad405x.c:608
ad405x_set_operation_mode
int ad405x_set_operation_mode(struct ad405x_dev *dev, enum ad405x_operation_mode mode)
Set operation mode.
Definition: ad405x.c:317
no_os_gpio_direction_input
int32_t no_os_gpio_direction_input(struct no_os_gpio_desc *desc)
Enable the input direction of the specified GPIO.
Definition: no_os_gpio.c:130
ad405x_set_config_mode
int ad405x_set_config_mode(struct ad405x_dev *dev)
Enter Config Mode.
Definition: ad405x.c:294
ad405x_set_averaging_filter_length
int ad405x_set_averaging_filter_length(struct ad405x_dev *dev, enum ad405x_avg_filter_l length)
Set averaging filter window length.
Definition: ad405x.c:470
AD405X_166_SPS
@ AD405X_166_SPS
Definition: ad405x.h:167
ad405x_remove
int ad405x_remove(struct ad405x_dev *dev)
Remove the device and release resources.
Definition: ad405x.c:847
ad405x_spi_data_read
int ad405x_spi_data_read(struct ad405x_dev *dev, int32_t *data)
Read conversion data.
Definition: ad405x.c:379
ad405x_init_param::operation_mode
enum ad405x_operation_mode operation_mode
Definition: ad405x.h:279
AD405X_DEV_EN_POL_MSK
#define AD405X_DEV_EN_POL_MSK
Definition: ad405x.h:121
AD405X_CONFIG_MODE_OP
@ AD405X_CONFIG_MODE_OP
Definition: ad405x.h:145
ad405x_set_config_mode
int ad405x_set_config_mode(struct ad405x_dev *dev)
Enter Config Mode.
Definition: ad405x.c:294
ad405x_init_param::gpio_gpio0
struct no_os_gpio_init_param * gpio_gpio0
Definition: ad405x.h:283
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
AD405X_ADC_MODE_OP
@ AD405X_ADC_MODE_OP
Definition: ad405x.h:146
AD405X_LENGTH_4096
@ AD405X_LENGTH_4096
Definition: ad405x.h:186
AD405X_140_SPS
@ AD405X_140_SPS
Definition: ad405x.h:168
ad405x_set_sample_rate
int ad405x_set_sample_rate(struct ad405x_dev *dev, enum ad405x_sample_rate rate)
Select sample rate for Burst and Autonomous Modes.
Definition: ad405x.c:444
ad405x_init
int ad405x_init(struct ad405x_dev **device, struct ad405x_init_param init_param)
Initialize the device.
Definition: ad405x.c:768
ad405x_write
int ad405x_write(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t reg_val)
Write device register.
Definition: ad405x.c:89
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
AD405X_1_MSPS
@ AD405X_1_MSPS
Definition: ad405x.h:156
ad405x_convst
int ad405x_convst(struct ad405x_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad405x.c:352
AD405X_GP0_MODE_MSK
#define AD405X_GP0_MODE_MSK
Definition: ad405x.h:124
AD405X_LENGTH_256
@ AD405X_LENGTH_256
Definition: ad405x.h:182
ad405x_get_invert_on_chop_state
enum ad405x_invert_on_chop ad405x_get_invert_on_chop_state(struct ad405x_dev *dev)
Get INVERT_ON_CHOP setting.
Definition: ad405x.c:608
ad405x_set_dev_en_polarity
int ad405x_set_dev_en_polarity(struct ad405x_dev *dev, enum ad405x_dev_en_polarity polarity)
Set DEV_EN signal polarity.
Definition: ad405x.c:522
AD405X_ADC_MODES_MSK
#define AD405X_ADC_MODES_MSK
Definition: ad405x.h:104
ad405x_soft_reset
int ad405x_soft_reset(struct ad405x_dev *dev)
Software reset the device.
Definition: ad405x.c:203
ad405x_read_val
int ad405x_read_val(struct ad405x_dev *dev, int32_t *data)
Trigger conversion and read data.
Definition: ad405x.c:422
AD405X_GP_MODE_DRDY
@ AD405X_GP_MODE_DRDY
Definition: ad405x.h:205
AD405X_1_KSPS
@ AD405X_1_KSPS
Definition: ad405x.h:162
ad405x_dev::rate
enum ad405x_sample_rate rate
Definition: ad405x.h:254
ad405x_init_param::active_device
enum ad405x_device_type active_device
Definition: ad405x.h:277
no_os_get_unaligned_be24
uint32_t no_os_get_unaligned_be24(uint8_t *buf)
AD405X_GP_MODE_INTR
@ AD405X_GP_MODE_INTR
Definition: ad405x.h:204
AD405X_DEV_EN_ACTIVE_LOW
@ AD405X_DEV_EN_ACTIVE_LOW
Definition: ad405x.h:191
ID_AD4050
@ ID_AD4050
Definition: ad405x.h:227
AD405X_333_KSPS
@ AD405X_333_KSPS
Definition: ad405x.h:157
ad405x_reset_pattern_command
int ad405x_reset_pattern_command(struct ad405x_dev *dev)
Definition: ad405x.c:184
ad405x_get_gp_mode
enum ad405x_gp_mode ad405x_get_gp_mode(struct ad405x_dev *dev, enum ad405x_gp_select gp)
Get GP mode setting.
Definition: ad405x.c:676
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
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:177
PROD_ID_AD4052
@ PROD_ID_AD4052
Definition: ad405x.h:233
ad405x_get_dev_en_polarity
enum ad405x_dev_en_polarity ad405x_get_dev_en_polarity(struct ad405x_dev *dev)
Get DEV_EN signal polarity.
Definition: ad405x.c:547
AD405X_REG_GPIO_CONFIG
#define AD405X_REG_GPIO_CONFIG
Definition: ad405x.h:78
ad405x_dev::data_format
enum ad405x_out_data_format data_format
Definition: ad405x.h:266
ad405x_exit_command
int ad405x_exit_command(struct ad405x_dev *dev)
Send EXIT command.
Definition: ad405x.c:164
AD405X_DEV_EN_ACTIVE_HIGH
@ AD405X_DEV_EN_ACTIVE_HIGH
Definition: ad405x.h:192
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
ID_AD4052
@ ID_AD4052
Definition: ad405x.h:228
AD405X_GP_MODE_HIGH_Z
@ AD405X_GP_MODE_HIGH_Z
Definition: ad405x.h:203
ad405x_read_val
int ad405x_read_val(struct ad405x_dev *dev, int32_t *data)
Trigger conversion and read data.
Definition: ad405x.c:422
ad405x_dev::gp0_mode
enum ad405x_gp_mode gp0_mode
Definition: ad405x.h:264
ad405x_set_gp_mode
int ad405x_set_gp_mode(struct ad405x_dev *dev, enum ad405x_gp_select gp, enum ad405x_gp_mode mode)
Set GP mode.
Definition: ad405x.c:624
ad405x_dev::gp1_mode
enum ad405x_gp_mode gp1_mode
Definition: ad405x.h:260
AD405X_LENGTH_128
@ AD405X_LENGTH_128
Definition: ad405x.h:181
AD405X_111_SPS
@ AD405X_111_SPS
Definition: ad405x.h:170
ad405x_gp_select
ad405x_gp_select
Definition: ad405x.h:214
AD405X_SW_RESET
#define AD405X_SW_RESET
Definition: ad405x.h:133
AD405X_500_SPS
@ AD405X_500_SPS
Definition: ad405x.h:163
ad405x_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad405x.h:242
ad405x_dev_en_polarity
ad405x_dev_en_polarity
Definition: ad405x.h:190
AD405X_GP_0
@ AD405X_GP_0
Definition: ad405x.h:215
ad405x_sample_rate
ad405x_sample_rate
Definition: ad405x.h:154
ad405x_spi_data_read
int ad405x_spi_data_read(struct ad405x_dev *dev, int32_t *data)
Read conversion data.
Definition: ad405x.c:379
AD405X_ENTER_ADC_MODE_MSK
#define AD405X_ENTER_ADC_MODE_MSK
Definition: ad405x.h:111
AD405X_2_MSPS
@ AD405X_2_MSPS
Definition: ad405x.h:155
ad405x_set_burst_averaging_mode
int ad405x_set_burst_averaging_mode(struct ad405x_dev *dev)
Enter Burst Averaging Mode.
Definition: ad405x.c:261
AD405X_FS_BURST_AUTO_MSK
#define AD405X_FS_BURST_AUTO_MSK
Definition: ad405x.h:115
ad405x_set_adc_mode
int ad405x_set_adc_mode(struct ad405x_dev *dev)
Enter ADC Mode.
Definition: ad405x.c:228
ad405x_disable_invert_on_chop
int ad405x_disable_invert_on_chop(struct ad405x_dev *dev)
Disable INVERT_ON_CHOP.
Definition: ad405x.c:584
ad405x_dev
AD405X Device structure.
Definition: ad405x.h:240
AD405X_33_KSPS
@ AD405X_33_KSPS
Definition: ad405x.h:159
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:120
ad405x_dev::gpio_gpio0
struct no_os_gpio_desc * gpio_gpio0
Definition: ad405x.h:250
ad405x_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad405x.h:275
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
ad405x_dev::invert_on_chop_status
enum ad405x_invert_on_chop invert_on_chop_status
Definition: ad405x.h:262
ad405x_enable_invert_on_chop
int ad405x_enable_invert_on_chop(struct ad405x_dev *dev)
Enable INVERT_ON_CHOP.
Definition: ad405x.c:560
AD405X_AVG_WIN_LEN_MSK
#define AD405X_AVG_WIN_LEN_MSK
Definition: ad405x.h:118
AD405X_STRAIGHT_BINARY
@ AD405X_STRAIGHT_BINARY
Definition: ad405x.h:221
AD405X_GP_MODE_DEV_EN
@ AD405X_GP_MODE_DEV_EN
Definition: ad405x.h:206
ad405x_init_param::gpio_cnv
struct no_os_gpio_init_param * gpio_cnv
Definition: ad405x.h:281
AD405X_100_KSPS
@ AD405X_100_KSPS
Definition: ad405x.h:158
AD405X_GP1_MODE_MSK
#define AD405X_GP1_MODE_MSK
Definition: ad405x.h:122
ad405x_set_operation_mode
int ad405x_set_operation_mode(struct ad405x_dev *dev, enum ad405x_operation_mode mode)
Set operation mode.
Definition: ad405x.c:317
ad405x_get_gp_mode
enum ad405x_gp_mode ad405x_get_gp_mode(struct ad405x_dev *dev, enum ad405x_gp_select gp)
Get GP mode setting.
Definition: ad405x.c:676
AD405X_333_SPS
@ AD405X_333_SPS
Definition: ad405x.h:164
ad405x_get_dev_en_polarity
enum ad405x_dev_en_polarity ad405x_get_dev_en_polarity(struct ad405x_dev *dev)
Get DEV_EN signal polarity.
Definition: ad405x.c:547
AD405X_REG_PRODUCT_ID_L
#define AD405X_REG_PRODUCT_ID_L
Definition: ad405x.h:63
ad405x_enable_invert_on_chop
int ad405x_enable_invert_on_chop(struct ad405x_dev *dev)
Enable INVERT_ON_CHOP.
Definition: ad405x.c:560
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.
ad405x_disable_invert_on_chop
int ad405x_disable_invert_on_chop(struct ad405x_dev *dev)
Disable INVERT_ON_CHOP.
Definition: ad405x.c:584
AD405X_REG_PRODUCT_ID_H
#define AD405X_REG_PRODUCT_ID_H
Definition: ad405x.h:64
ad405x_dev::filter_length
enum ad405x_avg_filter_l filter_length
Definition: ad405x.h:256
ad405x_device_type
ad405x_device_type
Definition: ad405x.h:226
ad405x_set_averaging_filter_length
int ad405x_set_averaging_filter_length(struct ad405x_dev *dev, enum ad405x_avg_filter_l length)
Set averaging filter window length.
Definition: ad405x.c:470
AD405X_LENGTH_64
@ AD405X_LENGTH_64
Definition: ad405x.h:180
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)
ad405x_product_id
ad405x_product_id
Definition: ad405x.h:232
ad405x_init_param::filter_length
enum ad405x_avg_filter_l filter_length
Definition: ad405x.h:289
AD405X_3_KSPS
@ AD405X_3_KSPS
Definition: ad405x.h:161
no_os_util.h
Header file of utility functions.
ad405x_update_bits
int ad405x_update_bits(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_val)
Update specific register bits.
Definition: ad405x.c:138
AD405X_REG_MODE_SET
#define AD405X_REG_MODE_SET
Definition: ad405x.h:74
AD405X_PERSISTENT_AUTO_MODE_OP
@ AD405X_PERSISTENT_AUTO_MODE_OP
Definition: ad405x.h:149
ad405x_invert_on_chop
ad405x_invert_on_chop
Definition: ad405x.h:196
ad405x_dev::active_device
enum ad405x_device_type active_device
Definition: ad405x.h:244
AD405X_SW_RESET_MSK
#define AD405X_SW_RESET_MSK
Definition: ad405x.h:93
ad405x_set_burst_averaging_mode
int ad405x_set_burst_averaging_mode(struct ad405x_dev *dev)
Enter Burst Averaging Mode.
Definition: ad405x.c:261
ad405x_out_data_format
ad405x_out_data_format
Definition: ad405x.h:220
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
ad405x_set_adc_mode
int ad405x_set_adc_mode(struct ad405x_dev *dev)
Enter ADC Mode.
Definition: ad405x.c:228
ad405x_reset_pattern_command
int ad405x_reset_pattern_command(struct ad405x_dev *dev)
Definition: ad405x.c:184
AD405X_10_KSPS
@ AD405X_10_KSPS
Definition: ad405x.h:160
AD405X_ADC_DATA_FORMAT_MSK
#define AD405X_ADC_DATA_FORMAT_MSK
Definition: ad405x.h:103
ad405x_set_data_format
int ad405x_set_data_format(struct ad405x_dev *dev, enum ad405x_out_data_format data_format)
Set output data format.
Definition: ad405x.c:699
ad405x.h
errno.h
Error macro definition for ARM Compiler.
AD405X_SAMPLE_MODE
#define AD405X_SAMPLE_MODE
Definition: ad405x.h:105
ad405x_read
int ad405x_read(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t *reg_val)
Read device register.
Definition: ad405x.c:111
ad405x_write
int ad405x_write(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t reg_val)
Write device register.
Definition: ad405x.c:89
ad405x_exit_command
int ad405x_exit_command(struct ad405x_dev *dev)
Send EXIT command.
Definition: ad405x.c:164
ad405x_dev::polarity
enum ad405x_dev_en_polarity polarity
Definition: ad405x.h:258
AD405X_REG_AVG_CONFIG
#define AD405X_REG_AVG_CONFIG
Definition: ad405x.h:77
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:131
AD405X_LENGTH_1024
@ AD405X_LENGTH_1024
Definition: ad405x.h:184
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