no-OS
ad7606.h
Go to the documentation of this file.
1 /***************************************************************************/
40 #ifndef AD7606_H_
41 #define AD7606_H_
42 
43 /******************************************************************************/
44 /***************************** Include Files **********************************/
45 /******************************************************************************/
46 #include <stdint.h>
47 #include <stdbool.h>
48 #include "no_os_delay.h"
49 #include "no_os_gpio.h"
50 #include "no_os_spi.h"
51 #include "no_os_util.h"
52 
53 /******************************************************************************/
54 /********************** Macros and Constants Definitions **********************/
55 /******************************************************************************/
56 #define AD7606_REG_STATUS 0x01
57 #define AD7606_REG_CONFIG 0x02
58 #define AD7606_REG_RANGE_CH_ADDR(ch) (0x03 + ((ch) >> 1))
59 #define AD7606_REG_BANDWIDTH 0x07
60 #define AD7606_REG_OVERSAMPLING 0x08
61 #define AD7606_REG_GAIN_CH(ch) (0x09 + (ch))
62 #define AD7606_REG_OFFSET_CH(ch) (0x11 + (ch))
63 #define AD7606_REG_PHASE_CH(ch) (0x19 + (ch))
64 #define AD7606_REG_DIGITAL_DIAG_ENABLE 0x21
65 #define AD7606_REG_DIGITAL_DIAG_ERR 0x22
66 #define AD7606_REG_OPEN_DETECT_ENABLE 0x23
67 #define AD7606_REG_OPEN_DETECTED 0x24
68 #define AD7606_REG_AIN_OV_UV_DIAG_ENABLE 0x25
69 #define AD7606_REG_AIN_OV_DIAG_ERROR 0x26
70 #define AD7606_REG_AIN_UV_DIAG_ERROR 0x27
71 #define AD7606_REG_DIAGNOSTIC_MUX_CH(ch) (0x28 + ((ch) >> 1))
72 #define AD7606_REG_OPEN_DETECT_QUEUE 0x2C
73 #define AD7606_REG_CLK_FS_COUNTER 0x2D
74 #define AD7606_REG_CLK_OS_COUNTER 0x2E
75 #define AD7606_REG_ID 0x2F
76 
77 /* AD7606_REG_STATUS */
78 #define AD7606_STATUS_CHANNEL_MSK NO_OS_GENMASK(2,0)
79 #define AD7606_AIN_UV_ERR_MSK NO_OS_BIT(3)
80 #define AD7606_AIN_OV_ERR_MSK NO_OS_BIT(4)
81 #define AD7606_OPEN_DETECTED_MSK NO_OS_BIT(5)
82 #define AD7606_DIGITAL_ERROR_MSK NO_OS_BIT(6)
83 #define AD7606_RESET_DETECT_MSK NO_OS_BIT(7)
84 
85 /* AD7606_REG_CONFIG */
86 #define AD7606_CONFIG_OPERATION_MODE_MSK NO_OS_GENMASK(1,0)
87 #define AD7606_CONFIG_DOUT_FORMAT_MSK NO_OS_GENMASK(4,3)
88 #define AD7606_CONFIG_EXT_OS_CLOCK_MSK NO_OS_BIT(5)
89 #define AD7606_CONFIG_STATUS_HEADER_MSK NO_OS_BIT(6)
90 
91 /* AD7606_REG_RANGE_CH_X_Y */
92 #define AD7606_RANGE_CH_MSK(ch) (NO_OS_GENMASK(3, 0) << (4 * ((ch) % 2)))
93 #define AD7606_RANGE_CH_MODE(ch, mode) \
94  ((NO_OS_GENMASK(3, 0) & mode) << (4 * ((ch) % 2)))
95 
96 /* AD7606_REG_OVERSAMPLING */
97 #define AD7606_OS_PAD_MSK NO_OS_GENMASK(7,4)
98 #define AD7606_OS_RATIO_MSK NO_OS_GENMASK(3,0)
99 
100 /* AD7606_REG_ID */
101 #define AD7606_ID_DEVICE_ID_MSK NO_OS_GENMASK(7,4)
102 #define AD7606_ID_SILICON_REVISION_MSK NO_OS_GENMASK(3,0)
103 
104 /* AD7606_REG_GAIN_CH */
105 #define AD7606_GAIN_MSK NO_OS_GENMASK(5,0)
106 
107 /* AD7606_REG_DIGITAL_DIAG_ENABLE */
108 #define AD7606_ROM_CRC_ERR_EN_MSK NO_OS_BIT(0)
109 #define AD7606_MM_CRC_ERR_EN_MSK NO_OS_BIT(1)
110 #define AD7606_INT_CRC_ERR_EN_MSK NO_OS_BIT(2)
111 #define AD7606_SPI_WRITE_ERR_EN_MSK NO_OS_BIT(3)
112 #define AD7606_SPI_READ_ERR_EN_MSK NO_OS_BIT(4)
113 #define AD7606_BUSY_STUCK_HIGH_ERR_EN_MSK NO_OS_BIT(5)
114 #define AD7606_CLK_FS_OS_COUNTER_EN_MSK NO_OS_BIT(6)
115 #define AD7606_INTERFACE_CHECK_EN_MSK NO_OS_BIT(7)
116 
117 /* AD7606_REG_DIAGNOSTIC_MUX_CH */
118 #define AD7606_DIAGN_MUX_CH_MSK(ch) (NO_OS_GENMASK(2, 0) << (3 * (ch & 0x1)))
119 
120 #define AD7606_RD_FLAG_MSK(x) (NO_OS_BIT(6) | ((x) & 0x3F))
121 #define AD7606_WR_FLAG_MSK(x) ((x) & 0x3F)
122 
123 #define AD7606_MAX_CHANNELS 8
124 
148 };
149 
173 };
174 
188 };
189 
203 };
204 
218 };
219 
224 struct ad7606_range {
226  int32_t min;
228  int32_t max;
231 };
232 
239  uint8_t os_pad:4;
242 };
243 
250  bool rom_crc_err_en: 1;
252  bool mm_crc_err_en: 1;
254  bool int_crc_err_en: 1;
265 };
266 
271 struct ad7606_dev {
297  bool sw_mode;
299  bool reg_mode;
307  uint8_t num_channels;
317  uint8_t data[28];
318 };
319 
350  bool sw_mode;
363 };
364 
365 int32_t ad7606_spi_reg_read(struct ad7606_dev *dev,
366  uint8_t reg_addr,
367  uint8_t *reg_data);
368 int32_t ad7606_spi_reg_write(struct ad7606_dev *dev,
369  uint8_t reg_addr,
370  uint8_t reg_data);
371 int32_t ad7606_spi_write_mask(struct ad7606_dev *dev,
372  uint32_t addr,
373  uint32_t mask,
374  uint32_t val);
375 int32_t ad7606_spi_data_read(struct ad7606_dev *dev,
376  uint32_t *data);
377 int32_t ad7606_read(struct ad7606_dev *dev,
378  uint32_t *data);
379 int32_t ad7606_convst(struct ad7606_dev *dev);
380 int32_t ad7606_reset(struct ad7606_dev *dev);
381 int32_t ad7606_set_oversampling(struct ad7606_dev *dev,
382  struct ad7606_oversampling oversampling);
383 int32_t ad7606_set_ch_range(struct ad7606_dev *dev, uint8_t ch,
384  struct ad7606_range range);
385 int32_t ad7606_set_ch_offset(struct ad7606_dev *dev, uint8_t ch,
386  int8_t offset);
387 int32_t ad7606_set_ch_phase(struct ad7606_dev *dev, uint8_t ch,
388  uint8_t phase);
389 int32_t ad7606_set_ch_gain(struct ad7606_dev *dev, uint8_t ch,
390  uint8_t gain);
391 int32_t ad7606_set_config(struct ad7606_dev *dev,
392  struct ad7606_config config);
393 int32_t ad7606_set_digital_diag(struct ad7606_dev *dev,
394  struct ad7606_digital_diag diag);
395 int32_t ad7606_init(struct ad7606_dev **device,
396  struct ad7606_init_param *init_param);
397 int32_t ad7606_remove(struct ad7606_dev *dev);
398 #endif /* AD7606_H_ */
ad7606_digital_diag::spi_read_err_en
bool spi_read_err_en
Definition: ad7606.h:258
AD7606_4_DOUT
@ AD7606_4_DOUT
Definition: ad7606.h:200
ad7606_init_param::gpio_os0
struct no_os_gpio_init_param * gpio_os0
Definition: ad7606.h:338
ad7606_init_param::gpio_par_ser
struct no_os_gpio_init_param * gpio_par_ser
Definition: ad7606.h:344
AD7606_REG_PHASE_CH
#define AD7606_REG_PHASE_CH(ch)
Definition: ad7606.h:63
ad7606_set_ch_range
int32_t ad7606_set_ch_range(struct ad7606_dev *dev, uint8_t ch, struct ad7606_range range)
Set the channel operation range.
Definition: ad7606.c:838
ID_AD7606C_18
@ ID_AD7606C_18
Definition: ad7606.h:143
no_os_gpio_init_param
Structure holding the parameters for GPIO initialization.
Definition: no_os_gpio.h:85
ad7606_init_param::spi_init
no_os_spi_init_param spi_init
Definition: ad7606.h:326
AD7606_8_DOUT
@ AD7606_8_DOUT
Definition: ad7606.h:202
ad7606_init_param::offset_ch
int8_t offset_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:356
ad7606_reset
int32_t ad7606_reset(struct ad7606_dev *dev)
Reset the device by toggling the reset GPIO.
Definition: ad7606.c:621
NO_OS_DECLARE_CRC8_TABLE
NO_OS_DECLARE_CRC8_TABLE(ad7606_crc8)
AD7606_REG_GAIN_CH
#define AD7606_REG_GAIN_CH(ch)
Definition: ad7606.h:61
ad7606_config
AD7606_REG_CONFIG configuration parameters.
Definition: ad7606.h:209
ad7606_digital_diag::int_crc_err_en
bool int_crc_err_en
Definition: ad7606.h:254
AD7606_2_DOUT
@ AD7606_2_DOUT
Definition: ad7606.h:198
NO_OS_DECLARE_CRC16_TABLE
NO_OS_DECLARE_CRC16_TABLE(ad7606_crc16)
AD7606_MM_CRC_ERR_EN_MSK
#define AD7606_MM_CRC_ERR_EN_MSK
Definition: ad7606.h:109
ad7606_convst
int32_t ad7606_convst(struct ad7606_dev *dev)
Toggle the CONVST pin to start a conversion.
Definition: ad7606.c:416
ad7606_init_param::device_id
enum ad7606_device_id device_id
Definition: ad7606.h:346
ad7606_dev::gpio_par_ser
struct no_os_gpio_desc * gpio_par_ser
Definition: ad7606.h:291
ad7606_config::op_mode
enum ad7606_op_mode op_mode
Definition: ad7606.h:211
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:82
ID_AD7606C_16
@ ID_AD7606C_16
Definition: ad7606.h:141
AD7606_STANDBY
@ AD7606_STANDBY
Definition: ad7606.h:183
ad7606.h
Header file for the ad7606 Driver.
ad7606_init_param::gpio_reset
struct no_os_gpio_init_param * gpio_reset
Definition: ad7606.h:328
ad7606_range::min
int32_t min
Definition: ad7606.h:226
ad7606_spi_write_mask
int32_t ad7606_spi_write_mask(struct ad7606_dev *dev, uint32_t addr, uint32_t mask, uint32_t val)
Write a device register via SPI with masking.
Definition: ad7606.c:339
ad7606_chip_info
Definition: ad7606.c:54
ad7606_init
int32_t ad7606_init(struct ad7606_dev **device, struct ad7606_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7606.c:1109
no_os_spi.h
Header file of SPI Interface.
ad7606_set_ch_gain
int32_t ad7606_set_ch_gain(struct ad7606_dev *dev, uint8_t ch, uint8_t gain)
Set the channel gain.
Definition: ad7606.c:959
AD7606_REG_OVERSAMPLING
#define AD7606_REG_OVERSAMPLING
Definition: ad7606.h:60
AD7606_SPI_WRITE_ERR_EN_MSK
#define AD7606_SPI_WRITE_ERR_EN_MSK
Definition: ad7606.h:111
ID_AD7606_4
@ ID_AD7606_4
Definition: ad7606.h:133
ad7606_spi_reg_read
int32_t ad7606_spi_reg_read(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read a device register via SPI.
Definition: ad7606.c:229
no_os_gpio_get_value
int32_t no_os_gpio_get_value(struct no_os_gpio_desc *desc, uint8_t *value)
Get the value of the specified GPIO.
Definition: no_os_gpio.c:177
ad7606_oversampling
Definition: ad7606.h:237
ad7606_dev::num_channels
uint8_t num_channels
Definition: ad7606.h:307
ad7606_oversampling::os_ratio
enum ad7606_osr os_ratio
Definition: ad7606.h:241
ad7606_chip_info::hw_range_table
const struct ad7606_range * hw_range_table
Definition: ad7606.c:61
no_os_delay.h
Header file of Delay functions.
ad7606_dev::gpio_os1
struct no_os_gpio_desc * gpio_os1
Definition: ad7606.h:287
ad7606_set_digital_diag
int32_t ad7606_set_digital_diag(struct ad7606_dev *dev, struct ad7606_digital_diag diag)
Set the device digital diagnostics configuration.
Definition: ad7606.c:1064
ad7606_dev::device_id
enum ad7606_device_id device_id
Definition: ad7606.h:293
ad7606_config::dout_format
enum ad7606_dout_format dout_format
Definition: ad7606.h:213
ad7606_init_param::gpio_stby_n
struct no_os_gpio_init_param * gpio_stby_n
Definition: ad7606.h:334
AD7606_OSR_8
@ AD7606_OSR_8
Definition: ad7606.h:162
AD7606_RD_FLAG_MSK
#define AD7606_RD_FLAG_MSK(x)
Definition: ad7606.h:120
ad7606_init_param::gpio_range
struct no_os_gpio_init_param * gpio_range
Definition: ad7606.h:336
ad7606_dev::spi_desc
no_os_spi_desc * spi_desc
Definition: ad7606.h:273
ad7606_set_ch_offset
int32_t ad7606_set_ch_offset(struct ad7606_dev *dev, uint8_t ch, int8_t offset)
Set the channel offset.
Definition: ad7606.c:890
ad7606_dev::sw_mode
bool sw_mode
Definition: ad7606.h:297
device
Definition: ad9361_util.h:75
ad7606_chip_info::num_channels
uint8_t num_channels
Definition: ad7606.c:55
ad7606_osr
ad7606_osr
Oversampling ratio.
Definition: ad7606.h:154
NO_OS_GPIO_HIGH
@ NO_OS_GPIO_HIGH
Definition: no_os_gpio.h:123
ID_AD7609
@ ID_AD7609
Definition: ad7606.h:147
ad7606_dev::reg_mode
bool reg_mode
Definition: ad7606.h:299
ad7606_set_ch_offset
int32_t ad7606_set_ch_offset(struct ad7606_dev *dev, uint8_t ch, int8_t offset)
Set the channel offset.
Definition: ad7606.c:890
NO_OS_ARRAY_SIZE
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:53
AD7606_BUSY_STUCK_HIGH_ERR_EN_MSK
#define AD7606_BUSY_STUCK_HIGH_ERR_EN_MSK
Definition: ad7606.h:113
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:108
ad7606_chip_info::has_oversampling
bool has_oversampling
Definition: ad7606.c:58
ad7606_dev::gpio_reset
struct no_os_gpio_desc * gpio_reset
Definition: ad7606.h:275
ad7606_dev::gpio_busy
struct no_os_gpio_desc * gpio_busy
Definition: ad7606.h:279
ad7606_digital_diag
Oversampling settings.
Definition: ad7606.h:248
ad7606_dev::phase_ch
uint8_t phase_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:311
AD7606_AUTOSTANDBY
@ AD7606_AUTOSTANDBY
Definition: ad7606.h:185
AD7606_INTERFACE_CHECK_EN_MSK
#define AD7606_INTERFACE_CHECK_EN_MSK
Definition: ad7606.h:115
AD7606_REG_DIGITAL_DIAG_ENABLE
#define AD7606_REG_DIGITAL_DIAG_ENABLE
Definition: ad7606.h:64
NO_OS_GPIO_LOW
@ NO_OS_GPIO_LOW
Definition: no_os_gpio.h:121
ad7606_dev::gain_ch
uint8_t gain_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:313
ad7606_set_ch_phase
int32_t ad7606_set_ch_phase(struct ad7606_dev *dev, uint8_t ch, uint8_t phase)
Set the channel phase.
Definition: ad7606.c:925
no_os_field_prep
uint32_t no_os_field_prep(uint32_t mask, uint32_t val)
AD7606_CONFIG_OPERATION_MODE_MSK
#define AD7606_CONFIG_OPERATION_MODE_MSK
Definition: ad7606.h:86
ad7606_digital_diag::busy_stuck_high_err_en
bool busy_stuck_high_err_en
Definition: ad7606.h:260
AD7606_CONFIG_DOUT_FORMAT_MSK
#define AD7606_CONFIG_DOUT_FORMAT_MSK
Definition: ad7606.h:87
ad7606_chip_info::hw_range_table_sz
uint32_t hw_range_table_sz
Definition: ad7606.c:62
AD7606_OS_PAD_MSK
#define AD7606_OS_PAD_MSK
Definition: ad7606.h:97
ad7606_range::max
int32_t max
Definition: ad7606.h:228
ad7606_digital_diag::rom_crc_err_en
bool rom_crc_err_en
Definition: ad7606.h:250
ad7606_dev::gpio_range
struct no_os_gpio_desc * gpio_range
Definition: ad7606.h:283
no_os_error.h
Error codes definition.
AD7606_SHUTDOWN
@ AD7606_SHUTDOWN
Definition: ad7606.h:187
ad7606_read
int32_t ad7606_read(struct ad7606_dev *dev, uint32_t *data)
Blocking conversion start and data read.
Definition: ad7606.c:542
AD7606_MAX_CHANNELS
#define AD7606_MAX_CHANNELS
Definition: ad7606.h:123
ad7606_convst
int32_t ad7606_convst(struct ad7606_dev *dev)
Toggle the CONVST pin to start a conversion.
Definition: ad7606.c:416
ad7606_spi_data_read
int32_t ad7606_spi_data_read(struct ad7606_dev *dev, uint32_t *data)
Read conversion data.
Definition: ad7606.c:459
ad7606_init_param::config
struct ad7606_config config
Definition: ad7606.h:352
AD7606_INT_CRC_ERR_EN_MSK
#define AD7606_INT_CRC_ERR_EN_MSK
Definition: ad7606.h:110
ad7606_set_oversampling
int32_t ad7606_set_oversampling(struct ad7606_dev *dev, struct ad7606_oversampling oversampling)
Set the oversampling ratio.
Definition: ad7606.c:758
ad7606_digital_diag::mm_crc_err_en
bool mm_crc_err_en
Definition: ad7606.h:252
no_os_crc8_populate_msb
void no_os_crc8_populate_msb(uint8_t *table, const uint8_t polynomial)
ad7606_dev::offset_ch
int8_t offset_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:309
ad7606_dev::gpio_stby_n
struct no_os_gpio_desc * gpio_stby_n
Definition: ad7606.h:281
ad7606_chip_info::has_registers
bool has_registers
Definition: ad7606.c:59
ad7606_spi_reg_write
int32_t ad7606_spi_reg_write(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write a device register via SPI.
Definition: ad7606.c:291
ad7606_config::ext_os_clock
bool ext_os_clock
Definition: ad7606.h:215
ad7606_dev::data
uint8_t data[28]
Definition: ad7606.h:317
AD7606_CLK_FS_OS_COUNTER_EN_MSK
#define AD7606_CLK_FS_OS_COUNTER_EN_MSK
Definition: ad7606.h:114
ad7606_init_param
Definition: ad7606.h:324
AD7606_ID_DEVICE_ID_MSK
#define AD7606_ID_DEVICE_ID_MSK
Definition: ad7606.h:101
ad7606_init_param::gain_ch
uint8_t gain_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:360
AD7606_OSR_16
@ AD7606_OSR_16
Definition: ad7606.h:164
ad7606_dev::gpio_os0
struct no_os_gpio_desc * gpio_os0
Definition: ad7606.h:285
AD7606_RANGE_CH_MSK
#define AD7606_RANGE_CH_MSK(ch)
Definition: ad7606.h:92
ad7606_init_param::phase_ch
uint8_t phase_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:358
ad7606_remove
int32_t ad7606_remove(struct ad7606_dev *dev)
Free any resource used by the driver.
Definition: ad7606.c:1236
ad7606_dev::range_ch
struct ad7606_range range_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:315
ad7606_op_mode
ad7606_op_mode
Operation mode.
Definition: ad7606.h:179
ad7606_init_param::range_ch
struct ad7606_range range_ch[AD7606_MAX_CHANNELS]
Definition: ad7606.h:362
ad7606_spi_data_read
int32_t ad7606_spi_data_read(struct ad7606_dev *dev, uint32_t *data)
Read conversion data.
Definition: ad7606.c:459
ad7606_device_id
ad7606_device_id
Device ID definitions.
Definition: ad7606.h:129
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:95
no_os_spi_desc
Structure holding SPI descriptor.
Definition: no_os_spi.h:132
ad7606_dev::gpio_os2
struct no_os_gpio_desc * gpio_os2
Definition: ad7606.h:289
ad7606_chip_info::sw_range_table_sz
uint32_t sw_range_table_sz
Definition: ad7606.c:64
no_os_crc.h
Generic header file for all CRC computation algorithms.
ad7606_init_param::oversampling
struct ad7606_oversampling oversampling
Definition: ad7606.h:348
ad7606_init_param::gpio_os2
struct no_os_gpio_init_param * gpio_os2
Definition: ad7606.h:342
AD7606_CONFIG_EXT_OS_CLOCK_MSK
#define AD7606_CONFIG_EXT_OS_CLOCK_MSK
Definition: ad7606.h:88
ID_AD7608
@ ID_AD7608
Definition: ad7606.h:145
no_os_gpio_desc
Structure holding the GPIO descriptor.
Definition: no_os_gpio.h:102
AD7606_GAIN_MSK
#define AD7606_GAIN_MSK
Definition: ad7606.h:105
AD7606_REG_OFFSET_CH
#define AD7606_REG_OFFSET_CH(ch)
Definition: ad7606.h:62
ad7606_spi_write_mask
int32_t ad7606_spi_write_mask(struct ad7606_dev *dev, uint32_t addr, uint32_t mask, uint32_t val)
Write a device register via SPI with masking.
Definition: ad7606.c:339
AD7606_RANGE_CH_MODE
#define AD7606_RANGE_CH_MODE(ch, mode)
Definition: ad7606.h:93
ad7606_oversampling::os_pad
uint8_t os_pad
Definition: ad7606.h:239
ad7606_remove
int32_t ad7606_remove(struct ad7606_dev *dev)
Free any resource used by the driver.
Definition: ad7606.c:1236
ad7606_spi_reg_read
int32_t ad7606_spi_reg_read(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t *reg_data)
Read a device register via SPI.
Definition: ad7606.c:229
AD7606_REG_RANGE_CH_ADDR
#define AD7606_REG_RANGE_CH_ADDR(ch)
Definition: ad7606.h:58
ad7606_set_config
int32_t ad7606_set_config(struct ad7606_dev *dev, struct ad7606_config config)
Set the device config register.
Definition: ad7606.c:995
AD7606_REG_ID
#define AD7606_REG_ID
Definition: ad7606.h:75
no_os_field_get
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
ad7606_dev::digital_diag_enable
struct ad7606_digital_diag digital_diag_enable
Definition: ad7606.h:305
ad7606_init_param::digital_diag_enable
struct ad7606_digital_diag digital_diag_enable
Definition: ad7606.h:354
ad7606_dev::oversampling
struct ad7606_oversampling oversampling
Definition: ad7606.h:295
AD7606_OSR_2
@ AD7606_OSR_2
Definition: ad7606.h:158
ad7606_set_digital_diag
int32_t ad7606_set_digital_diag(struct ad7606_dev *dev, struct ad7606_digital_diag diag)
Set the device digital diagnostics configuration.
Definition: ad7606.c:1064
no_os_crc8
uint8_t no_os_crc8(const uint8_t *table, const uint8_t *pdata, size_t nbytes, uint8_t crc)
no_os_crc16
uint16_t no_os_crc16(const uint16_t *table, const uint8_t *pdata, size_t nbytes, uint16_t crc)
ad7606_chip_info::sw_range_table
const struct ad7606_range * sw_range_table
Definition: ad7606.c:63
ad7606_set_ch_range
int32_t ad7606_set_ch_range(struct ad7606_dev *dev, uint8_t ch, struct ad7606_range range)
Set the channel operation range.
Definition: ad7606.c:838
ad7606_dev::gpio_convst
struct no_os_gpio_desc * gpio_convst
Definition: ad7606.h:277
AD7606_OSR_32
@ AD7606_OSR_32
Definition: ad7606.h:166
AD7606_1_DOUT
@ AD7606_1_DOUT
Definition: ad7606.h:196
ad7606_set_oversampling
int32_t ad7606_set_oversampling(struct ad7606_dev *dev, struct ad7606_oversampling oversampling)
Set the oversampling ratio.
Definition: ad7606.c:758
AD7606_OS_RATIO_MSK
#define AD7606_OS_RATIO_MSK
Definition: ad7606.h:98
no_os_udelay
void no_os_udelay(uint32_t usecs)
Wait until usecs microseconds passed.
Definition: delay.c:118
NULL
#define NULL
Definition: wrapper.h:64
ad7606_init_param::gpio_busy
struct no_os_gpio_init_param * gpio_busy
Definition: ad7606.h:332
ad7606_range::differential
bool differential
Definition: ad7606.h:230
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:160
AD7606_OSR_4
@ AD7606_OSR_4
Definition: ad7606.h:160
init_param
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:96
AD7606_REG_CONFIG
#define AD7606_REG_CONFIG
Definition: ad7606.h:57
ID_AD7606_8
@ ID_AD7606_8
Definition: ad7606.h:137
AD7606_NORMAL
@ AD7606_NORMAL
Definition: ad7606.h:181
ad7606_digital_diag::interface_check_en
bool interface_check_en
Definition: ad7606.h:264
ad7606_init_param::gpio_convst
struct no_os_gpio_init_param * gpio_convst
Definition: ad7606.h:330
ad7606_chip_info::bits
uint8_t bits
Definition: ad7606.c:56
AD7606_OSR_256
@ AD7606_OSR_256
Definition: ad7606.h:172
ad7606_init
int32_t ad7606_init(struct ad7606_dev **device, struct ad7606_init_param *init_param)
Initialize the ad7606 device structure.
Definition: ad7606.c:1109
ad7606_digital_diag::clk_fs_os_counter_en
bool clk_fs_os_counter_en
Definition: ad7606.h:262
AD7606_WR_FLAG_MSK
#define AD7606_WR_FLAG_MSK(x)
Definition: ad7606.h:121
ad7606_dev::config
struct ad7606_config config
Definition: ad7606.h:303
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:70
ad7606_config::status_header
bool status_header
Definition: ad7606.h:217
no_os_gpio.h
Header file of GPIO Interface.
ad7606_chip_info::max_dout_lines
uint8_t max_dout_lines
Definition: ad7606.c:57
ad7606_range
Operation range as specified in datasheet (in uV)
Definition: ad7606.h:224
ad7606_set_ch_phase
int32_t ad7606_set_ch_phase(struct ad7606_dev *dev, uint8_t ch, uint8_t phase)
Set the channel phase.
Definition: ad7606.c:925
ad7606_digital_diag::spi_write_err_en
bool spi_write_err_en
Definition: ad7606.h:256
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:51
no_os_crc16_populate_msb
void no_os_crc16_populate_msb(uint16_t *table, const uint16_t polynomial)
AD7606_SPI_READ_ERR_EN_MSK
#define AD7606_SPI_READ_ERR_EN_MSK
Definition: ad7606.h:112
AD7606_CONFIG_STATUS_HEADER_MSK
#define AD7606_CONFIG_STATUS_HEADER_MSK
Definition: ad7606.h:89
ad7606_dev::max_dout_lines
enum ad7606_dout_format max_dout_lines
Definition: ad7606.h:301
ad7606_read
int32_t ad7606_read(struct ad7606_dev *dev, uint32_t *data)
Blocking conversion start and data read.
Definition: ad7606.c:542
no_os_util.h
Implementation of utility functions.
ID_AD7606_6
@ ID_AD7606_6
Definition: ad7606.h:135
AD7606_ROM_CRC_ERR_EN_MSK
#define AD7606_ROM_CRC_ERR_EN_MSK
Definition: ad7606.h:108
AD7606_OSR_128
@ AD7606_OSR_128
Definition: ad7606.h:170
ad7606_chip_info::device_id
uint8_t device_id
Definition: ad7606.c:60
AD7606_OSR_64
@ AD7606_OSR_64
Definition: ad7606.h:168
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:124
ad7606_spi_reg_write
int32_t ad7606_spi_reg_write(struct ad7606_dev *dev, uint8_t reg_addr, uint8_t reg_data)
Write a device register via SPI.
Definition: ad7606.c:291
ID_AD7605_4
@ ID_AD7605_4
Definition: ad7606.h:131
ad7606_init_param::sw_mode
bool sw_mode
Definition: ad7606.h:350
ad7606_dout_format
ad7606_dout_format
Number of DOUT lines.
Definition: ad7606.h:194
errno.h
Error macro definition for ARM Compiler.
ad7606_init_param::gpio_os1
struct no_os_gpio_init_param * gpio_os1
Definition: ad7606.h:340
ID_AD7606B
@ ID_AD7606B
Definition: ad7606.h:139
AD7606_OSR_1
@ AD7606_OSR_1
Definition: ad7606.h:156
ad7606_set_config
int32_t ad7606_set_config(struct ad7606_dev *dev, struct ad7606_config config)
Set the device config register.
Definition: ad7606.c:995
no_os_spi_init_param
Structure holding the parameters for SPI initialization.
Definition: no_os_spi.h:112
ad7606_reset
int32_t ad7606_reset(struct ad7606_dev *dev)
Reset the device by toggling the reset GPIO.
Definition: ad7606.c:621
ad7606_dev
Device driver structure.
Definition: ad7606.h:271
ad7606_set_ch_gain
int32_t ad7606_set_ch_gain(struct ad7606_dev *dev, uint8_t ch, uint8_t gain)
Set the channel gain.
Definition: ad7606.c:959
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