no-OS
Classes | Macros | Enumerations | Functions
ad405x.h File Reference
#include <stdint.h>
#include <string.h>
#include "no_os_util.h"
#include "no_os_spi.h"
#include "no_os_gpio.h"
Include dependency graph for ad405x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad405x_dev
 AD405X Device structure. More...
 
struct  ad405x_init_param
 

Macros

#define AD405X_REG_INTERFACE_CONFIG_A   0x00
 
#define AD405X_REG_INTERFACE_CONFIG_B   0x01
 
#define AD405X_REG_DEVICE_CONFIG   0x02
 
#define AD405X_REG_DEVICE_TYPE   0x03
 
#define AD405X_REG_PRODUCT_ID_L   0x04
 
#define AD405X_REG_PRODUCT_ID_H   0x05
 
#define AD405X_REG_CHIP_GRADE   0x06
 
#define AD405X_REG_SCRATCH_PAD   0x0A
 
#define AD405X_REG_SPI_REVISION   0x0B
 
#define AD405X_REG_VENDOR_L   0x0C
 
#define AD405X_REG_VENDOR_H   0x0D
 
#define AD405X_REG_STREAM_MODE   0x0E
 
#define AD405X_REG_TRANSFER_CONFIG   0x0F
 
#define AD405X_REG_INTERFACE_CONFIG_C   0x10
 
#define AD405X_REG_INTERFACE_STATUS   0x11
 
#define AD405X_REG_MODE_SET   0x20
 
#define AD405X_REG_ADC_MODES   0x21
 
#define AD405X_REG_ADC_CONFIG   0x22
 
#define AD405X_REG_AVG_CONFIG   0x23
 
#define AD405X_REG_GPIO_CONFIG   0x24
 
#define AD405X_REG_INTR_CONFIG   0x25
 
#define AD405X_REG_CHOP_CONFIG   0x26
 
#define AD405X_REG_TIMER_CONFIG   0x27
 
#define AD405X_REG_MAX_THRESH   0x28
 
#define AD405X_REG_MIN_THRESH   0x2A
 
#define AD405X_REG_MAX_HYST   0x2C
 
#define AD405X_REG_MIN_HYST   0x2D
 
#define AD405X_REG_MON_VAL   0x2E
 
#define AD405X_REG_FUSE_CRC   0x40
 
#define AD405X_REG_DEVICE_STATUS   0x41
 
#define AD405X_REG_MAX_INTR   0x42
 
#define AD405X_REG_MIN_INTR   0x44
 
#define AD405X_SW_RESET_MSK   NO_OS_BIT(7) | NO_OS_BIT(0)
 
#define AD405X_SINGLE_INST_MSK   NO_OS_BIT(7) /* Should be set to 0. */
 
#define AD405X_SHORT_INST_MSK   NO_OS_BIT(3)
 
#define AD405X_STRICT_REG_ACCESS_MSK   NO_OS_BIT(5)
 
#define AD405X_ADC_DATA_FORMAT_MSK   NO_OS_BIT(7)
 
#define AD405X_ADC_MODES_MSK   NO_OS_GENMASK(1, 0)
 
#define AD405X_SAMPLE_MODE   0x00
 
#define AD405X_BURST_AVERAGING_MODE   NO_OS_BIT(0)
 
#define AD405X_AVERAGING_MODE   NO_OS_BIT(1)
 
#define AD405X_AUTONOMOUS_MODE   NO_OS_GENMASK(1, 0)
 
#define AD405X_ENTER_ADC_MODE_MSK   NO_OS_BIT(0)
 
#define AD405X_ENTER_ADC_MODE   NO_OS_BIT(0)
 
#define AD405X_FS_BURST_AUTO_MSK   NO_OS_GENMASK(7, 4)
 
#define AD405X_AVG_WIN_LEN_MSK   NO_OS_GENMASK(3, 0)
 
#define AD405X_DEV_EN_POL_MSK   NO_OS_BIT(7)
 
#define AD405X_GP1_MODE_MSK   NO_OS_GENMASK(6, 4)
 
#define AD405X_INVERT_ON_CHOP_MSK   NO_OS_BIT(3)
 
#define AD405X_GP0_MODE_MSK   NO_OS_GENMASK(2, 0)
 
#define AD405X_DEV_EN_POL_LOW   ~NO_OS_BIT(7)
 
#define AD405X_DEV_EN_POL_HIGH   NO_OS_BIT(7)
 
#define AD405X_INVERT_ON_CHOP_OFF   ~NO_OS_BIT(3)
 
#define AD405X_INVERT_ON_CHOP_ON   NO_OS_BIT(3)
 
#define AD405X_SW_RESET   NO_OS_BIT(7) | NO_OS_BIT(0)
 
#define AD405X_SPI_READ   NO_OS_BIT(7)
 
#define BYTE_ADDR_H   NO_OS_GENMASK(15, 8)
 
#define BYTE_ADDR_L   NO_OS_GENMASK(7, 0)
 
#define AD405X_DEVICE_TYPE   NO_OS_GENMASK(2, 0)
 

Enumerations

enum  ad405x_operation_mode {
  AD405X_CONFIG_MODE_OP,
  AD405X_ADC_MODE_OP,
  AD405X_AVERAGING_MODE_OP,
  AD405X_BURST_AVERAGING_MODE_OP,
  AD405X_PERSISTENT_AUTO_MODE_OP,
  AD405X_NON_PERSISTENT_AUTO_MODE_OP
}
 
enum  ad405x_sample_rate {
  AD405X_2_MSPS,
  AD405X_1_MSPS,
  AD405X_333_KSPS,
  AD405X_100_KSPS,
  AD405X_33_KSPS,
  AD405X_10_KSPS,
  AD405X_3_KSPS,
  AD405X_1_KSPS,
  AD405X_500_SPS,
  AD405X_333_SPS,
  AD405X_250_SPS,
  AD405X_200_SPS,
  AD405X_166_SPS,
  AD405X_140_SPS,
  AD405X_125_SPS,
  AD405X_111_SPS
}
 
enum  ad405x_avg_filter_l {
  AD405X_LENGTH_2,
  AD405X_LENGTH_4,
  AD405X_LENGTH_8,
  AD405X_LENGTH_16,
  AD405X_LENGTH_32,
  AD405X_LENGTH_64,
  AD405X_LENGTH_128,
  AD405X_LENGTH_256,
  AD405X_LENGTH_512,
  AD405X_LENGTH_1024,
  AD405X_LENGTH_2048,
  AD405X_LENGTH_4096
}
 
enum  ad405x_dev_en_polarity {
  AD405X_DEV_EN_ACTIVE_LOW,
  AD405X_DEV_EN_ACTIVE_HIGH
}
 
enum  ad405x_invert_on_chop {
  AD405X_INVERT_ON_CHOP_DISABLED,
  AD405X_INVERT_ON_CHOP_ENABLED
}
 
enum  ad405x_gp_mode {
  AD405X_GP_MODE_HIGH_Z,
  AD405X_GP_MODE_INTR,
  AD405X_GP_MODE_DRDY,
  AD405X_GP_MODE_DEV_EN,
  AD405X_GP_MODE_CHOP,
  AD405X_GP_MODE_LOW,
  AD405X_GP_MODE_HIGH,
  AD405X_GP_MODE_DEV_RDY
}
 
enum  ad405x_gp_select {
  AD405X_GP_0,
  AD405X_GP_1
}
 
enum  ad405x_out_data_format {
  AD405X_STRAIGHT_BINARY,
  AD405X_TWOS_COMPLEMENT
}
 
enum  ad405x_device_type {
  ID_AD4050,
  ID_AD4052
}
 
enum  ad405x_product_id { PROD_ID_AD4052 = 0x70 }
 

Functions

int ad405x_write (struct ad405x_dev *dev, uint8_t reg_addr, uint8_t reg_val)
 Write device register. More...
 
int ad405x_read (struct ad405x_dev *dev, uint8_t reg_addr, uint8_t *reg_val)
 Read device register. More...
 
int ad405x_update_bits (struct ad405x_dev *dev, uint8_t reg_addr, uint8_t mask, uint8_t reg_val)
 Update specific register bits. More...
 
int ad405x_exit_command (struct ad405x_dev *dev)
 Send EXIT command. More...
 
int ad405x_reset_pattern_command (struct ad405x_dev *dev)
 
int ad405x_soft_reset (struct ad405x_dev *dev)
 Software reset the device. More...
 
int ad405x_set_adc_mode (struct ad405x_dev *dev)
 Enter ADC Mode. More...
 
int ad405x_set_burst_averaging_mode (struct ad405x_dev *dev)
 Enter Burst Averaging Mode. More...
 
int ad405x_set_config_mode (struct ad405x_dev *dev)
 Enter Config Mode. More...
 
int ad405x_set_operation_mode (struct ad405x_dev *dev, enum ad405x_operation_mode mode)
 Set operation mode. More...
 
int ad405x_convst (struct ad405x_dev *dev)
 Toggle the CNV pin to start a conversion. More...
 
int ad405x_spi_data_read (struct ad405x_dev *dev, int32_t *data)
 Read conversion data. More...
 
int ad405x_read_val (struct ad405x_dev *dev, int32_t *data)
 Trigger conversion and read data. More...
 
int ad405x_set_sample_rate (struct ad405x_dev *dev, enum ad405x_sample_rate rate)
 Select sample rate for Burst and Autonomous Modes. More...
 
int ad405x_set_averaging_filter_length (struct ad405x_dev *dev, enum ad405x_avg_filter_l length)
 Set averaging filter window length. More...
 
enum ad405x_avg_filter_l ad405x_get_averaging_filter_length (struct ad405x_dev *dev)
 Get averaging filter window length. More...
 
int ad405x_set_dev_en_polarity (struct ad405x_dev *dev, enum ad405x_dev_en_polarity polarity)
 Set DEV_EN signal polarity. More...
 
enum ad405x_dev_en_polarity ad405x_get_dev_en_polarity (struct ad405x_dev *dev)
 Get DEV_EN signal polarity. More...
 
int ad405x_enable_invert_on_chop (struct ad405x_dev *dev)
 Enable INVERT_ON_CHOP. More...
 
int ad405x_disable_invert_on_chop (struct ad405x_dev *dev)
 Disable INVERT_ON_CHOP. More...
 
enum ad405x_invert_on_chop ad405x_get_invert_on_chop_state (struct ad405x_dev *dev)
 Get INVERT_ON_CHOP setting. More...
 
int ad405x_set_gp_mode (struct ad405x_dev *dev, enum ad405x_gp_select gp, enum ad405x_gp_mode mode)
 Set GP mode. More...
 
enum ad405x_gp_mode ad405x_get_gp_mode (struct ad405x_dev *dev, enum ad405x_gp_select gp)
 Get GP mode setting. More...
 
int ad405x_set_data_format (struct ad405x_dev *dev, enum ad405x_out_data_format data_format)
 Set output data format. More...
 
int ad405x_init (struct ad405x_dev **device, struct ad405x_init_param init_param)
 Initialize the device. More...
 
int ad405x_remove (struct ad405x_dev *dev)
 Remove the device and release resources. More...
 

Macro Definition Documentation

◆ AD405X_ADC_DATA_FORMAT_MSK

#define AD405X_ADC_DATA_FORMAT_MSK   NO_OS_BIT(7)

AD405X_REG_ADC_MODES Bit definition

◆ AD405X_ADC_MODES_MSK

#define AD405X_ADC_MODES_MSK   NO_OS_GENMASK(1, 0)

◆ AD405X_AUTONOMOUS_MODE

#define AD405X_AUTONOMOUS_MODE   NO_OS_GENMASK(1, 0)

◆ AD405X_AVERAGING_MODE

#define AD405X_AVERAGING_MODE   NO_OS_BIT(1)

◆ AD405X_AVG_WIN_LEN_MSK

#define AD405X_AVG_WIN_LEN_MSK   NO_OS_GENMASK(3, 0)

AD405X_REG_AVG_CONFIG Bit Definitions

◆ AD405X_BURST_AVERAGING_MODE

#define AD405X_BURST_AVERAGING_MODE   NO_OS_BIT(0)

◆ AD405X_DEV_EN_POL_HIGH

#define AD405X_DEV_EN_POL_HIGH   NO_OS_BIT(7)

◆ AD405X_DEV_EN_POL_LOW

#define AD405X_DEV_EN_POL_LOW   ~NO_OS_BIT(7)

◆ AD405X_DEV_EN_POL_MSK

#define AD405X_DEV_EN_POL_MSK   NO_OS_BIT(7)

AD405X_REG_GPIO_CONFIG Bit Definitions

◆ AD405X_DEVICE_TYPE

#define AD405X_DEVICE_TYPE   NO_OS_GENMASK(2, 0)

◆ AD405X_ENTER_ADC_MODE

#define AD405X_ENTER_ADC_MODE   NO_OS_BIT(0)

◆ AD405X_ENTER_ADC_MODE_MSK

#define AD405X_ENTER_ADC_MODE_MSK   NO_OS_BIT(0)

AD405X_REG_MODE_SET Bit definition

◆ AD405X_FS_BURST_AUTO_MSK

#define AD405X_FS_BURST_AUTO_MSK   NO_OS_GENMASK(7, 4)

AD405X_REG_TIMER_CONFIG Bit Definitions

◆ AD405X_GP0_MODE_MSK

#define AD405X_GP0_MODE_MSK   NO_OS_GENMASK(2, 0)

◆ AD405X_GP1_MODE_MSK

#define AD405X_GP1_MODE_MSK   NO_OS_GENMASK(6, 4)

◆ AD405X_INVERT_ON_CHOP_MSK

#define AD405X_INVERT_ON_CHOP_MSK   NO_OS_BIT(3)

◆ AD405X_INVERT_ON_CHOP_OFF

#define AD405X_INVERT_ON_CHOP_OFF   ~NO_OS_BIT(3)

◆ AD405X_INVERT_ON_CHOP_ON

#define AD405X_INVERT_ON_CHOP_ON   NO_OS_BIT(3)

◆ AD405X_REG_ADC_CONFIG

#define AD405X_REG_ADC_CONFIG   0x22

◆ AD405X_REG_ADC_MODES

#define AD405X_REG_ADC_MODES   0x21

◆ AD405X_REG_AVG_CONFIG

#define AD405X_REG_AVG_CONFIG   0x23

◆ AD405X_REG_CHIP_GRADE

#define AD405X_REG_CHIP_GRADE   0x06

◆ AD405X_REG_CHOP_CONFIG

#define AD405X_REG_CHOP_CONFIG   0x26

◆ AD405X_REG_DEVICE_CONFIG

#define AD405X_REG_DEVICE_CONFIG   0x02

◆ AD405X_REG_DEVICE_STATUS

#define AD405X_REG_DEVICE_STATUS   0x41

◆ AD405X_REG_DEVICE_TYPE

#define AD405X_REG_DEVICE_TYPE   0x03

◆ AD405X_REG_FUSE_CRC

#define AD405X_REG_FUSE_CRC   0x40

◆ AD405X_REG_GPIO_CONFIG

#define AD405X_REG_GPIO_CONFIG   0x24

◆ AD405X_REG_INTERFACE_CONFIG_A

#define AD405X_REG_INTERFACE_CONFIG_A   0x00

Register Definition

◆ AD405X_REG_INTERFACE_CONFIG_B

#define AD405X_REG_INTERFACE_CONFIG_B   0x01

◆ AD405X_REG_INTERFACE_CONFIG_C

#define AD405X_REG_INTERFACE_CONFIG_C   0x10

◆ AD405X_REG_INTERFACE_STATUS

#define AD405X_REG_INTERFACE_STATUS   0x11

◆ AD405X_REG_INTR_CONFIG

#define AD405X_REG_INTR_CONFIG   0x25

◆ AD405X_REG_MAX_HYST

#define AD405X_REG_MAX_HYST   0x2C

◆ AD405X_REG_MAX_INTR

#define AD405X_REG_MAX_INTR   0x42

◆ AD405X_REG_MAX_THRESH

#define AD405X_REG_MAX_THRESH   0x28

◆ AD405X_REG_MIN_HYST

#define AD405X_REG_MIN_HYST   0x2D

◆ AD405X_REG_MIN_INTR

#define AD405X_REG_MIN_INTR   0x44

◆ AD405X_REG_MIN_THRESH

#define AD405X_REG_MIN_THRESH   0x2A

◆ AD405X_REG_MODE_SET

#define AD405X_REG_MODE_SET   0x20

◆ AD405X_REG_MON_VAL

#define AD405X_REG_MON_VAL   0x2E

◆ AD405X_REG_PRODUCT_ID_H

#define AD405X_REG_PRODUCT_ID_H   0x05

◆ AD405X_REG_PRODUCT_ID_L

#define AD405X_REG_PRODUCT_ID_L   0x04

◆ AD405X_REG_SCRATCH_PAD

#define AD405X_REG_SCRATCH_PAD   0x0A

◆ AD405X_REG_SPI_REVISION

#define AD405X_REG_SPI_REVISION   0x0B

◆ AD405X_REG_STREAM_MODE

#define AD405X_REG_STREAM_MODE   0x0E

◆ AD405X_REG_TIMER_CONFIG

#define AD405X_REG_TIMER_CONFIG   0x27

◆ AD405X_REG_TRANSFER_CONFIG

#define AD405X_REG_TRANSFER_CONFIG   0x0F

◆ AD405X_REG_VENDOR_H

#define AD405X_REG_VENDOR_H   0x0D

◆ AD405X_REG_VENDOR_L

#define AD405X_REG_VENDOR_L   0x0C

◆ AD405X_SAMPLE_MODE

#define AD405X_SAMPLE_MODE   0x00

◆ AD405X_SHORT_INST_MSK

#define AD405X_SHORT_INST_MSK   NO_OS_BIT(3)

◆ AD405X_SINGLE_INST_MSK

#define AD405X_SINGLE_INST_MSK   NO_OS_BIT(7) /* Should be set to 0. */

AD405X_REG_INTERFACE_CONFIG_B Bit Definition

◆ AD405X_SPI_READ

#define AD405X_SPI_READ   NO_OS_BIT(7)

◆ AD405X_STRICT_REG_ACCESS_MSK

#define AD405X_STRICT_REG_ACCESS_MSK   NO_OS_BIT(5)

AD405X_REG_INTERFACE_CONFIG_C Bit Definition

◆ AD405X_SW_RESET

#define AD405X_SW_RESET   NO_OS_BIT(7) | NO_OS_BIT(0)

Miscellaneous Definitions

◆ AD405X_SW_RESET_MSK

#define AD405X_SW_RESET_MSK   NO_OS_BIT(7) | NO_OS_BIT(0)

AD405X_REG_INTERFACE_CONFIG_A Bit Definition

◆ BYTE_ADDR_H

#define BYTE_ADDR_H   NO_OS_GENMASK(15, 8)

◆ BYTE_ADDR_L

#define BYTE_ADDR_L   NO_OS_GENMASK(7, 0)

Enumeration Type Documentation

◆ ad405x_avg_filter_l

AD405X averaging filter window length

Enumerator
AD405X_LENGTH_2 
AD405X_LENGTH_4 
AD405X_LENGTH_8 
AD405X_LENGTH_16 
AD405X_LENGTH_32 
AD405X_LENGTH_64 
AD405X_LENGTH_128 
AD405X_LENGTH_256 
AD405X_LENGTH_512 
AD405X_LENGTH_1024 
AD405X_LENGTH_2048 
AD405X_LENGTH_4096 

◆ ad405x_dev_en_polarity

AD405X DEV_EN polarity

Enumerator
AD405X_DEV_EN_ACTIVE_LOW 
AD405X_DEV_EN_ACTIVE_HIGH 

◆ ad405x_device_type

AD405X device type section

Enumerator
ID_AD4050 
ID_AD4052 

◆ ad405x_gp_mode

AD405X GP0, GP1 mode

Enumerator
AD405X_GP_MODE_HIGH_Z 
AD405X_GP_MODE_INTR 
AD405X_GP_MODE_DRDY 
AD405X_GP_MODE_DEV_EN 
AD405X_GP_MODE_CHOP 
AD405X_GP_MODE_LOW 
AD405X_GP_MODE_HIGH 
AD405X_GP_MODE_DEV_RDY 

◆ ad405x_gp_select

AD405X GP selection

Enumerator
AD405X_GP_0 
AD405X_GP_1 

◆ ad405x_invert_on_chop

AD405X INVERT_ON_CHOP status

Enumerator
AD405X_INVERT_ON_CHOP_DISABLED 
AD405X_INVERT_ON_CHOP_ENABLED 

◆ ad405x_operation_mode

AD405X modes of operations

Enumerator
AD405X_CONFIG_MODE_OP 
AD405X_ADC_MODE_OP 
AD405X_AVERAGING_MODE_OP 
AD405X_BURST_AVERAGING_MODE_OP 
AD405X_PERSISTENT_AUTO_MODE_OP 
AD405X_NON_PERSISTENT_AUTO_MODE_OP 

◆ ad405x_out_data_format

AD405X output data format selection

Enumerator
AD405X_STRAIGHT_BINARY 
AD405X_TWOS_COMPLEMENT 

◆ ad405x_product_id

AD405X product ID

Enumerator
PROD_ID_AD4052 

◆ ad405x_sample_rate

AD405X sample rate for burst and autonomous modes

Enumerator
AD405X_2_MSPS 
AD405X_1_MSPS 
AD405X_333_KSPS 
AD405X_100_KSPS 
AD405X_33_KSPS 
AD405X_10_KSPS 
AD405X_3_KSPS 
AD405X_1_KSPS 
AD405X_500_SPS 
AD405X_333_SPS 
AD405X_250_SPS 
AD405X_200_SPS 
AD405X_166_SPS 
AD405X_140_SPS 
AD405X_125_SPS 
AD405X_111_SPS 

Function Documentation

◆ ad405x_convst()

int ad405x_convst ( struct ad405x_dev dev)

Toggle the CNV pin to start a conversion.

Toggle the CNV pin to start a conversion.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

CNV High Time 10 ns

Here is the caller graph for this function:

◆ ad405x_disable_invert_on_chop()

int ad405x_disable_invert_on_chop ( struct ad405x_dev dev)

Disable INVERT_ON_CHOP.

Disable INVERT_ON_CHOP

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_enable_invert_on_chop()

int ad405x_enable_invert_on_chop ( struct ad405x_dev dev)

Enable INVERT_ON_CHOP.

Enable INVERT_ON_CHOP

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_exit_command()

int ad405x_exit_command ( struct ad405x_dev dev)

Send EXIT command.

Send EXIT command.

Parameters
dev-The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad405x_get_averaging_filter_length()

enum ad405x_avg_filter_l ad405x_get_averaging_filter_length ( struct ad405x_dev dev)

Get averaging filter window length.

Get averaging filter window length

Parameters
dev- The device structure.
Returns
Average filter value

◆ ad405x_get_dev_en_polarity()

enum ad405x_dev_en_polarity ad405x_get_dev_en_polarity ( struct ad405x_dev dev)

Get DEV_EN signal polarity.

Get DEV_EN signal polarity

Parameters
dev- The device structure.
Returns
DEV_EN signal polarity

◆ 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.

Get GP mode setting

G

Parameters
dev- The device structure.
gp- GP1/GP0 select.
Returns
GP mode.

◆ 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.

Get INVERT_ON_CHOP setting

Parameters
dev- The device structure.
Returns
INVERT_ON_CHOP setting

◆ ad405x_init()

int ad405x_init ( struct ad405x_dev **  device,
struct ad405x_init_param  init_param 
)

Initialize the device.

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_read()

int ad405x_read ( struct ad405x_dev dev,
uint8_t  reg_addr,
uint8_t *  reg_val 
)

Read device register.

Read data from a register

Parameters
dev- The device structure.
reg_addr- The register address.
reg_val- The data read from the register.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad405x_read_val()

int ad405x_read_val ( struct ad405x_dev dev,
int32_t *  data 
)

Trigger conversion and read data.

Trigger conversion adn read data.

Parameters
dev- The device structure.
data- Pointer to location of buffer where to store the data.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_remove()

int ad405x_remove ( struct ad405x_dev dev)

Remove the device and release resources.

Remove the device and release resources.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_reset_pattern_command()

int ad405x_reset_pattern_command ( struct ad405x_dev dev)

Send RESET command.

Send RESET pattern command.

Parameters
dev-The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad405x_set_adc_mode()

int ad405x_set_adc_mode ( struct ad405x_dev dev)

Enter ADC Mode.

Enter ADC Mode

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ 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.

Set averaging filter window length

Parameters
dev- The device structure.
length- Averaging filter window length.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_set_burst_averaging_mode()

int ad405x_set_burst_averaging_mode ( struct ad405x_dev dev)

Enter Burst Averaging Mode.

Enter Burst Averaging Mode

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad405x_set_config_mode()

int ad405x_set_config_mode ( struct ad405x_dev dev)

Enter Config Mode.

Enter Config Mode

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_set_data_format()

int ad405x_set_data_format ( struct ad405x_dev dev,
enum ad405x_out_data_format  data_format 
)

Set output data format.

Set adc output data format

Parameters
dev- The device structure.
data_format- format select.
Returns
0 in case of success, negative error code otherwise.

◆ 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.

Set DEV_EN signal polarity

Parameters
dev- The device structure.
polarity- DEV_EN signal polarity.
Returns
0 in case of success, negative error code otherwise.

◆ 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.

Set GP mode

Parameters
dev- The device structure.
gp- GP1/GP0 select.
mode- mode select.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_set_operation_mode()

int ad405x_set_operation_mode ( struct ad405x_dev dev,
enum ad405x_operation_mode  mode 
)

Set operation mode.

Set operation mode

Parameters
dev- The device structure.
mode- Operation mode.
Returns
0 in case of success, negative error code otherwise.

◆ 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.

Select sample rate for Burst and Autonomous Modes.

Parameters
dev- The device structure.
rate- Sample rate.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_soft_reset()

int ad405x_soft_reset ( struct ad405x_dev dev)

Software reset the device.

Software Reset.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad405x_spi_data_read()

int ad405x_spi_data_read ( struct ad405x_dev dev,
int32_t *  data 
)

Read conversion data.

Read conversion data.

Parameters
dev- The device structure.
data- Pointer to location of buffer where to store the data.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ 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.

Update specific register bits

Parameters
dev- The device structure.
reg_addr- The register address.
mask- Specific bits mask.
reg_val- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad405x_write()

int ad405x_write ( struct ad405x_dev dev,
uint8_t  reg_addr,
uint8_t  reg_val 
)

Write device register.

Write data into a register

Parameters
dev-The device structure.
reg_addr- The register address.
reg_val- The data to be written.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function: