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  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright notice,
16  * this list of conditions and the following disclaimer in the documentation
17  * and/or other materials provided with the distribution.
18  *
19  * 3. Neither the name of Analog Devices, Inc. nor the names of its
20  * contributors may be used to endorse or promote products derived from this
21  * software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
24  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
25  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
26  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
27  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
29  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
30  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
31  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
32  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 *******************************************************************************/
34 
35 #ifndef __AD405X_H__
36 #define __AD405X_H__
37 
38 /******************************************************************************/
39 /***************************** Include Files **********************************/
40 /******************************************************************************/
41 
42 #include <stdint.h>
43 #include <string.h>
44 #include "no_os_util.h"
45 #include "no_os_spi.h"
46 #include "no_os_gpio.h"
47 
48 /******************************************************************************/
49 /********************** Macros and Constants Definitions **********************/
50 /******************************************************************************/
51 
53 #define AD405X_REG_INTERFACE_CONFIG_A 0x00
54 #define AD405X_REG_INTERFACE_CONFIG_B 0x01
55 #define AD405X_REG_DEVICE_CONFIG 0x02
56 #define AD405X_REG_DEVICE_TYPE 0x03
57 #define AD405X_REG_PRODUCT_ID_L 0x04
58 #define AD405X_REG_PRODUCT_ID_H 0x05
59 #define AD405X_REG_CHIP_GRADE 0x06
60 #define AD405X_REG_SCRATCH_PAD 0x0A
61 #define AD405X_REG_SPI_REVISION 0x0B
62 #define AD405X_REG_VENDOR_L 0x0C
63 #define AD405X_REG_VENDOR_H 0x0D
64 #define AD405X_REG_STREAM_MODE 0x0E
65 #define AD405X_REG_TRANSFER_CONFIG 0x0F
66 #define AD405X_REG_INTERFACE_CONFIG_C 0x10
67 #define AD405X_REG_INTERFACE_STATUS 0x11
68 #define AD405X_REG_MODE_SET 0x20
69 #define AD405X_REG_ADC_MODES 0x21
70 #define AD405X_REG_ADC_CONFIG 0x22
71 #define AD405X_REG_AVG_CONFIG 0x23
72 #define AD405X_REG_GPIO_CONFIG 0x24
73 #define AD405X_REG_INTR_CONFIG 0x25
74 #define AD405X_REG_CHOP_CONFIG 0x26
75 #define AD405X_REG_TIMER_CONFIG 0x27
76 #define AD405X_REG_MAX_THRESH 0x28
77 #define AD405X_REG_MIN_THRESH 0x2A
78 #define AD405X_REG_MAX_HYST 0x2C
79 #define AD405X_REG_MIN_HYST 0x2D
80 #define AD405X_REG_MON_VAL 0x2E
81 #define AD405X_REG_FUSE_CRC 0x40
82 #define AD405X_REG_DEVICE_STATUS 0x41
83 #define AD405X_REG_MAX_INTR 0x42
84 #define AD405X_REG_MIN_INTR 0x44
85 
87 #define AD405X_SW_RESET_MSK NO_OS_BIT(7) | NO_OS_BIT(0)
88 
90 #define AD405X_SINGLE_INST_MSK NO_OS_BIT(7) /* Should be set to 0. */
91 #define AD405X_SHORT_INST_MSK NO_OS_BIT(3)
92 
94 #define AD405X_STRICT_REG_ACCESS_MSK NO_OS_BIT(5)
95 
97 #define AD405X_ADC_DATA_FORMAT_MSK NO_OS_BIT(7)
98 #define AD405X_ADC_MODES_MSK NO_OS_GENMASK(1, 0)
99 #define AD405X_SAMPLE_MODE 0x00
100 #define AD405X_BURST_AVERAGING_MODE NO_OS_BIT(0)
101 #define AD405X_AVERAGING_MODE NO_OS_BIT(1)
102 #define AD405X_AUTONOMOUS_MODE NO_OS_GENMASK(1, 0)
103 
105 #define AD405X_ENTER_ADC_MODE_MSK NO_OS_BIT(0)
106 #define AD405X_ENTER_ADC_MODE NO_OS_BIT(0)
107 
109 #define AD405X_FS_BURST_AUTO_MSK NO_OS_GENMASK(7, 4)
110 
112 #define AD405X_AVG_WIN_LEN_MSK NO_OS_GENMASK(3, 0)
113 
115 #define AD405X_DEV_EN_POL_MSK NO_OS_BIT(7)
116 #define AD405X_GP1_MODE_MSK NO_OS_GENMASK(6, 4)
117 #define AD405X_INVERT_ON_CHOP_MSK NO_OS_BIT(3)
118 #define AD405X_GP0_MODE_MSK NO_OS_GENMASK(2, 0)
119 
120 #define AD405X_DEV_EN_POL_LOW ~NO_OS_BIT(7)
121 #define AD405X_DEV_EN_POL_HIGH NO_OS_BIT(7)
122 
123 #define AD405X_INVERT_ON_CHOP_OFF ~NO_OS_BIT(3)
124 #define AD405X_INVERT_ON_CHOP_ON NO_OS_BIT(3)
125 
127 #define AD405X_SW_RESET NO_OS_BIT(7) | NO_OS_BIT(0)
128 #define AD405X_SPI_READ NO_OS_BIT(7)
129 #define BYTE_ADDR_H NO_OS_GENMASK(15, 8)
130 #define BYTE_ADDR_L NO_OS_GENMASK(7, 0)
131 #define AD405X_DEVICE_TYPE NO_OS_GENMASK(2, 0)
132 
133 /******************************************************************************/
134 /************************ Types Declarations **********************************/
135 /******************************************************************************/
136 
145 };
146 
165 };
166 
181 };
182 
187 };
188 
193 };
194 
205 };
206 
211 };
212 
217 };
218 
223 };
224 
229 };
230 
235 struct ad405x_dev {
262 };
263 
285 };
286 
287 /******************************************************************************/
288 /************************ Functions Declarations ******************************/
289 /******************************************************************************/
290 
292 int ad405x_write(struct ad405x_dev *dev,
293  uint8_t reg_addr,
294  uint8_t reg_val);
295 
297 int ad405x_read(struct ad405x_dev *dev,
298  uint8_t reg_addr,
299  uint8_t *reg_val);
300 
302 int ad405x_update_bits(struct ad405x_dev *dev,
303  uint8_t reg_addr,
304  uint8_t mask,
305  uint8_t reg_val);
306 
308 int ad405x_exit_command(struct ad405x_dev *dev);
309 
312 
314 int ad405x_soft_reset(struct ad405x_dev *dev);
315 
317 int ad405x_set_adc_mode(struct ad405x_dev *dev);
318 
321 
323 int ad405x_set_config_mode(struct ad405x_dev *dev);
324 
326 int ad405x_set_operation_mode(struct ad405x_dev *dev,
327  enum ad405x_operation_mode mode);
328 
330 int ad405x_convst(struct ad405x_dev *dev);
331 
333 int ad405x_spi_data_read(struct ad405x_dev *dev,
334  int32_t *data);
335 
337 int ad405x_read_val(struct ad405x_dev *dev, int32_t *data);
338 
340 int ad405x_set_sample_rate(struct ad405x_dev *dev,
341  enum ad405x_sample_rate rate);
342 
345  enum ad405x_avg_filter_l length);
346 
349  struct ad405x_dev *dev);
350 
352 int ad405x_set_dev_en_polarity(struct ad405x_dev *dev,
353  enum ad405x_dev_en_polarity polarity);
354 
357 
360 
363 
366  struct ad405x_dev *dev);
367 
369 int ad405x_set_gp_mode(struct ad405x_dev *dev,
370  enum ad405x_gp_select gp,
371  enum ad405x_gp_mode mode);
372 
375  struct ad405x_dev *dev, enum ad405x_gp_select gp);
376 
378 int ad405x_set_data_format(struct ad405x_dev *dev,
379  enum ad405x_out_data_format data_format);
380 
382 int ad405x_init(struct ad405x_dev **device,
384 
386 int ad405x_remove(struct ad405x_dev *dev);
387 
388 #endif /* __AD405X_H__ */
AD405X_TWOS_COMPLEMENT
@ AD405X_TWOS_COMPLEMENT
Definition: ad405x.h:216
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:545
ad405x_dev::operation_mode
enum ad405x_operation_mode operation_mode
Definition: ad405x.h:241
AD405X_GP_MODE_LOW
@ AD405X_GP_MODE_LOW
Definition: ad405x.h:202
ad405x_read
int ad405x_read(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t *reg_val)
Read device register.
Definition: ad405x.c:105
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:79
AD405X_INVERT_ON_CHOP_ENABLED
@ AD405X_INVERT_ON_CHOP_ENABLED
Definition: ad405x.h:192
AD405X_SPI_READ
#define AD405X_SPI_READ
Definition: ad405x.h:128
AD405X_REG_INTERFACE_CONFIG_A
#define AD405X_REG_INTERFACE_CONFIG_A
Definition: ad405x.h:53
ad405x_operation_mode
ad405x_operation_mode
Definition: ad405x.h:138
AD405X_INVERT_ON_CHOP_MSK
#define AD405X_INVERT_ON_CHOP_MSK
Definition: ad405x.h:117
AD405X_LENGTH_2
@ AD405X_LENGTH_2
Definition: ad405x.h:169
ad405x_dev::gpio_gpio1
struct no_os_gpio_desc * gpio_gpio1
Definition: ad405x.h:247
ad405x_init_param
Definition: ad405x.h:268
ad405x_init_param::rate
enum ad405x_sample_rate rate
Definition: ad405x.h:282
ad405x_convst
int ad405x_convst(struct ad405x_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad405x.c:383
ad405x_dev::gpio_cnv
struct no_os_gpio_desc * gpio_cnv
Definition: ad405x.h:243
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
AD405X_250_SPS
@ AD405X_250_SPS
Definition: ad405x.h:159
AD405X_BURST_AVERAGING_MODE
#define AD405X_BURST_AVERAGING_MODE
Definition: ad405x.h:100
AD405X_LENGTH_32
@ AD405X_LENGTH_32
Definition: ad405x.h:173
ad405x_avg_filter_l
ad405x_avg_filter_l
Definition: ad405x.h:168
ad405x_soft_reset
int ad405x_soft_reset(struct ad405x_dev *dev)
Software reset the device.
Definition: ad405x.c:199
no_os_spi.h
Header file of SPI Interface.
AD405X_INVERT_ON_CHOP_DISABLED
@ AD405X_INVERT_ON_CHOP_DISABLED
Definition: ad405x.h:191
AD405X_LENGTH_8
@ AD405X_LENGTH_8
Definition: ad405x.h:171
AD405X_GP_1
@ AD405X_GP_1
Definition: ad405x.h:210
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:132
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:545
AD405X_LENGTH_16
@ AD405X_LENGTH_16
Definition: ad405x.h:172
AD405X_BURST_AVERAGING_MODE_OP
@ AD405X_BURST_AVERAGING_MODE_OP
Definition: ad405x.h:142
AD405X_GP_MODE_HIGH
@ AD405X_GP_MODE_HIGH
Definition: ad405x.h:203
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:482
ad405x_remove
int ad405x_remove(struct ad405x_dev *dev)
Remove the device and release resources.
Definition: ad405x.c:890
AD405X_AVERAGING_MODE_OP
@ AD405X_AVERAGING_MODE_OP
Definition: ad405x.h:141
AD405X_LENGTH_2048
@ AD405X_LENGTH_2048
Definition: ad405x.h:179
AD405X_LENGTH_4
@ AD405X_LENGTH_4
Definition: ad405x.h:170
no_os_delay.h
Header file of Delay functions.
AD405X_200_SPS
@ AD405X_200_SPS
Definition: ad405x.h:160
AD405X_GP_MODE_CHOP
@ AD405X_GP_MODE_CHOP
Definition: ad405x.h:201
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:737
AD405X_LENGTH_512
@ AD405X_LENGTH_512
Definition: ad405x.h:177
AD405X_GP_MODE_DEV_RDY
@ AD405X_GP_MODE_DEV_RDY
Definition: ad405x.h:204
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:560
pr_info
#define pr_info(fmt, args...)
Definition: no_os_print_log.h:115
AD405X_125_SPS
@ AD405X_125_SPS
Definition: ad405x.h:163
AD405X_REG_TIMER_CONFIG
#define AD405X_REG_TIMER_CONFIG
Definition: ad405x.h:75
AD405X_NON_PERSISTENT_AUTO_MODE_OP
@ AD405X_NON_PERSISTENT_AUTO_MODE_OP
Definition: ad405x.h:144
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:662
ad405x_init
int ad405x_init(struct ad405x_dev **device, struct ad405x_init_param init_param)
Initialize the device.
Definition: ad405x.c:806
ad405x_init_param::gpio_gpio1
struct no_os_gpio_init_param * gpio_gpio1
Definition: ad405x.h:280
ad405x_set_averaging_mode
int ad405x_set_averaging_mode(struct ad405x_dev *dev)
Enter Averaging Mode.
Definition: ad405x.c:290
device
Definition: ad9361_util.h:69
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:117
no_os_print_log.h
Print messages helpers.
AD405X_REG_ADC_MODES
#define AD405X_REG_ADC_MODES
Definition: ad405x.h:69
ad405x_gp_mode
ad405x_gp_mode
Definition: ad405x.h:196
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:646
ad405x_set_operation_mode
int ad405x_set_operation_mode(struct ad405x_dev *dev, enum ad405x_operation_mode mode)
Set operation mode.
Definition: ad405x.c:346
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:124
ad405x_set_config_mode
int ad405x_set_config_mode(struct ad405x_dev *dev)
Enter Config Mode.
Definition: ad405x.c:323
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:508
AD405X_166_SPS
@ AD405X_166_SPS
Definition: ad405x.h:161
ad405x_remove
int ad405x_remove(struct ad405x_dev *dev)
Remove the device and release resources.
Definition: ad405x.c:890
ad405x_spi_data_read
int ad405x_spi_data_read(struct ad405x_dev *dev, int32_t *data)
Read conversion data.
Definition: ad405x.c:410
ad405x_init_param::operation_mode
enum ad405x_operation_mode operation_mode
Definition: ad405x.h:274
AD405X_DEV_EN_POL_MSK
#define AD405X_DEV_EN_POL_MSK
Definition: ad405x.h:115
AD405X_CONFIG_MODE_OP
@ AD405X_CONFIG_MODE_OP
Definition: ad405x.h:139
ad405x_set_config_mode
int ad405x_set_config_mode(struct ad405x_dev *dev)
Enter Config Mode.
Definition: ad405x.c:323
ad405x_init_param::gpio_gpio0
struct no_os_gpio_init_param * gpio_gpio0
Definition: ad405x.h:278
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:115
AD405X_ADC_MODE_OP
@ AD405X_ADC_MODE_OP
Definition: ad405x.h:140
AD405X_LENGTH_4096
@ AD405X_LENGTH_4096
Definition: ad405x.h:180
AD405X_140_SPS
@ AD405X_140_SPS
Definition: ad405x.h:162
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:482
no_os_mdelay
void no_os_mdelay(uint32_t msecs)
Wait until msecs milliseconds passed.
Definition: aducm3029_delay.c:126
ad405x_init
int ad405x_init(struct ad405x_dev **device, struct ad405x_init_param init_param)
Initialize the device.
Definition: ad405x.c:806
ad405x_write
int ad405x_write(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t reg_val)
Write device register.
Definition: ad405x.c:83
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:150
ad405x_convst
int ad405x_convst(struct ad405x_dev *dev)
Toggle the CNV pin to start a conversion.
Definition: ad405x.c:383
AD405X_GP0_MODE_MSK
#define AD405X_GP0_MODE_MSK
Definition: ad405x.h:118
AD405X_LENGTH_256
@ AD405X_LENGTH_256
Definition: ad405x.h:176
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:646
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:560
AD405X_ADC_MODES_MSK
#define AD405X_ADC_MODES_MSK
Definition: ad405x.h:98
ad405x_soft_reset
int ad405x_soft_reset(struct ad405x_dev *dev)
Software reset the device.
Definition: ad405x.c:199
ad405x_read_val
int ad405x_read_val(struct ad405x_dev *dev, int32_t *data)
Trigger conversion and read data.
Definition: ad405x.c:460
AD405X_GP_MODE_DRDY
@ AD405X_GP_MODE_DRDY
Definition: ad405x.h:199
AD405X_1_KSPS
@ AD405X_1_KSPS
Definition: ad405x.h:156
ad405x_dev::rate
enum ad405x_sample_rate rate
Definition: ad405x.h:249
AD405X_AVERAGING_MODE
#define AD405X_AVERAGING_MODE
Definition: ad405x.h:101
ad405x_init_param::active_device
enum ad405x_device_type active_device
Definition: ad405x.h:272
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:198
AD405X_DEV_EN_ACTIVE_LOW
@ AD405X_DEV_EN_ACTIVE_LOW
Definition: ad405x.h:185
ID_AD4050
@ ID_AD4050
Definition: ad405x.h:221
AD405X_333_KSPS
@ AD405X_333_KSPS
Definition: ad405x.h:151
ad405x_reset_pattern_command
int ad405x_reset_pattern_command(struct ad405x_dev *dev)
Definition: ad405x.c:178
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:714
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
PROD_ID_AD4052
@ PROD_ID_AD4052
Definition: ad405x.h:228
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:585
AD405X_REG_GPIO_CONFIG
#define AD405X_REG_GPIO_CONFIG
Definition: ad405x.h:72
ad405x_dev::data_format
enum ad405x_out_data_format data_format
Definition: ad405x.h:261
ad405x_exit_command
int ad405x_exit_command(struct ad405x_dev *dev)
Send EXIT command.
Definition: ad405x.c:158
AD405X_DEV_EN_ACTIVE_HIGH
@ AD405X_DEV_EN_ACTIVE_HIGH
Definition: ad405x.h:186
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:96
ID_AD4052
@ ID_AD4052
Definition: ad405x.h:222
AD405X_GP_MODE_HIGH_Z
@ AD405X_GP_MODE_HIGH_Z
Definition: ad405x.h:197
ad405x_read_val
int ad405x_read_val(struct ad405x_dev *dev, int32_t *data)
Trigger conversion and read data.
Definition: ad405x.c:460
ad405x_dev::gp0_mode
enum ad405x_gp_mode gp0_mode
Definition: ad405x.h:259
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:662
ad405x_dev::gp1_mode
enum ad405x_gp_mode gp1_mode
Definition: ad405x.h:255
AD405X_LENGTH_128
@ AD405X_LENGTH_128
Definition: ad405x.h:175
AD405X_111_SPS
@ AD405X_111_SPS
Definition: ad405x.h:164
ad405x_gp_select
ad405x_gp_select
Definition: ad405x.h:208
AD405X_SW_RESET
#define AD405X_SW_RESET
Definition: ad405x.h:127
AD405X_500_SPS
@ AD405X_500_SPS
Definition: ad405x.h:157
ad405x_dev::spi_desc
struct no_os_spi_desc * spi_desc
Definition: ad405x.h:237
ad405x_dev_en_polarity
ad405x_dev_en_polarity
Definition: ad405x.h:184
AD405X_GP_0
@ AD405X_GP_0
Definition: ad405x.h:209
ad405x_sample_rate
ad405x_sample_rate
Definition: ad405x.h:148
ad405x_spi_data_read
int ad405x_spi_data_read(struct ad405x_dev *dev, int32_t *data)
Read conversion data.
Definition: ad405x.c:410
AD405X_ENTER_ADC_MODE_MSK
#define AD405X_ENTER_ADC_MODE_MSK
Definition: ad405x.h:105
AD405X_2_MSPS
@ AD405X_2_MSPS
Definition: ad405x.h:149
ad405x_set_burst_averaging_mode
int ad405x_set_burst_averaging_mode(struct ad405x_dev *dev)
Enter Burst Averaging Mode.
Definition: ad405x.c:257
AD405X_FS_BURST_AUTO_MSK
#define AD405X_FS_BURST_AUTO_MSK
Definition: ad405x.h:109
ad405x_set_adc_mode
int ad405x_set_adc_mode(struct ad405x_dev *dev)
Enter ADC Mode.
Definition: ad405x.c:224
ad405x_disable_invert_on_chop
int ad405x_disable_invert_on_chop(struct ad405x_dev *dev)
Disable INVERT_ON_CHOP.
Definition: ad405x.c:622
ad405x_dev
AD405X Device structure.
Definition: ad405x.h:235
AD405X_33_KSPS
@ AD405X_33_KSPS
Definition: ad405x.h:153
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: aducm3029_delay.c:114
ad405x_dev::gpio_gpio0
struct no_os_gpio_desc * gpio_gpio0
Definition: ad405x.h:245
ad405x_init_param::spi_init
struct no_os_spi_init_param * spi_init
Definition: ad405x.h:270
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
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
ad405x_dev::invert_on_chop_status
enum ad405x_invert_on_chop invert_on_chop_status
Definition: ad405x.h:257
ad405x_enable_invert_on_chop
int ad405x_enable_invert_on_chop(struct ad405x_dev *dev)
Enable INVERT_ON_CHOP.
Definition: ad405x.c:598
AD405X_AVG_WIN_LEN_MSK
#define AD405X_AVG_WIN_LEN_MSK
Definition: ad405x.h:112
AD405X_STRAIGHT_BINARY
@ AD405X_STRAIGHT_BINARY
Definition: ad405x.h:215
AD405X_GP_MODE_DEV_EN
@ AD405X_GP_MODE_DEV_EN
Definition: ad405x.h:200
ad405x_init_param::gpio_cnv
struct no_os_gpio_init_param * gpio_cnv
Definition: ad405x.h:276
AD405X_100_KSPS
@ AD405X_100_KSPS
Definition: ad405x.h:152
AD405X_GP1_MODE_MSK
#define AD405X_GP1_MODE_MSK
Definition: ad405x.h:116
ad405x_set_operation_mode
int ad405x_set_operation_mode(struct ad405x_dev *dev, enum ad405x_operation_mode mode)
Set operation mode.
Definition: ad405x.c:346
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:714
PROD_ID_AD4050
@ PROD_ID_AD4050
Definition: ad405x.h:227
AD405X_333_SPS
@ AD405X_333_SPS
Definition: ad405x.h:158
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:585
AD405X_REG_PRODUCT_ID_L
#define AD405X_REG_PRODUCT_ID_L
Definition: ad405x.h:57
ad405x_enable_invert_on_chop
int ad405x_enable_invert_on_chop(struct ad405x_dev *dev)
Enable INVERT_ON_CHOP.
Definition: ad405x.c:598
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
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:622
AD405X_REG_PRODUCT_ID_H
#define AD405X_REG_PRODUCT_ID_H
Definition: ad405x.h:58
ad405x_dev::filter_length
enum ad405x_avg_filter_l filter_length
Definition: ad405x.h:251
ad405x_device_type
ad405x_device_type
Definition: ad405x.h:220
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:508
AD405X_LENGTH_64
@ AD405X_LENGTH_64
Definition: ad405x.h:174
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)
ad405x_product_id
ad405x_product_id
Definition: ad405x.h:226
ad405x_init_param::filter_length
enum ad405x_avg_filter_l filter_length
Definition: ad405x.h:284
AD405X_3_KSPS
@ AD405X_3_KSPS
Definition: ad405x.h:155
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:132
AD405X_REG_MODE_SET
#define AD405X_REG_MODE_SET
Definition: ad405x.h:68
AD405X_PERSISTENT_AUTO_MODE_OP
@ AD405X_PERSISTENT_AUTO_MODE_OP
Definition: ad405x.h:143
ad405x_invert_on_chop
ad405x_invert_on_chop
Definition: ad405x.h:190
ad405x_dev::active_device
enum ad405x_device_type active_device
Definition: ad405x.h:239
AD405X_SW_RESET_MSK
#define AD405X_SW_RESET_MSK
Definition: ad405x.h:87
ad405x_set_burst_averaging_mode
int ad405x_set_burst_averaging_mode(struct ad405x_dev *dev)
Enter Burst Averaging Mode.
Definition: ad405x.c:257
ad405x_out_data_format
ad405x_out_data_format
Definition: ad405x.h:214
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
ad405x_set_adc_mode
int ad405x_set_adc_mode(struct ad405x_dev *dev)
Enter ADC Mode.
Definition: ad405x.c:224
ad405x_reset_pattern_command
int ad405x_reset_pattern_command(struct ad405x_dev *dev)
Definition: ad405x.c:178
AD405X_10_KSPS
@ AD405X_10_KSPS
Definition: ad405x.h:154
AD405X_ADC_DATA_FORMAT_MSK
#define AD405X_ADC_DATA_FORMAT_MSK
Definition: ad405x.h:97
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:737
ad405x.h
errno.h
Error macro definition for ARM Compiler.
AD405X_SAMPLE_MODE
#define AD405X_SAMPLE_MODE
Definition: ad405x.h:99
ad405x_read
int ad405x_read(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t *reg_val)
Read device register.
Definition: ad405x.c:105
ad405x_write
int ad405x_write(struct ad405x_dev *dev, uint8_t reg_addr, uint8_t reg_val)
Write device register.
Definition: ad405x.c:83
ad405x_exit_command
int ad405x_exit_command(struct ad405x_dev *dev)
Send EXIT command.
Definition: ad405x.c:158
ad405x_dev::polarity
enum ad405x_dev_en_polarity polarity
Definition: ad405x.h:253
AD405X_REG_AVG_CONFIG
#define AD405X_REG_AVG_CONFIG
Definition: ad405x.h:71
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:140
AD405X_LENGTH_1024
@ AD405X_LENGTH_1024
Definition: ad405x.h:178
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