no-OS
Classes | Macros | Enumerations | Functions
ad717x.h File Reference

AD717X header file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2, AD7177-2, AD4111, AD4112, AD4114, AD4115. More...

#include <stdint.h>
#include "no-os/spi.h"
Include dependency graph for ad717x.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad717x_st_reg
 
struct  ad717x_dev
 
struct  ad717x_init_param
 

Macros

#define AD717X_COMM_REG   0x00
 
#define AD717X_STATUS_REG   0x00
 
#define AD717X_ADCMODE_REG   0x01
 
#define AD717X_IFMODE_REG   0x02
 
#define AD717X_REGCHECK_REG   0x03
 
#define AD717X_DATA_REG   0x04
 
#define AD717X_GPIOCON_REG   0x06
 
#define AD717X_ID_REG   0x07
 
#define AD717X_CHMAP0_REG   0x10
 
#define AD717X_CHMAP1_REG   0x11
 
#define AD717X_CHMAP2_REG   0x12
 
#define AD717X_CHMAP3_REG   0x13
 
#define AD717X_CHMAP4_REG   0x14
 
#define AD717X_CHMAP5_REG   0x15
 
#define AD717X_CHMAP6_REG   0x16
 
#define AD717X_CHMAP7_REG   0x17
 
#define AD717X_CHMAP8_REG   0x18
 
#define AD717X_CHMAP9_REG   0x19
 
#define AD717X_CHMAP10_REG   0x1A
 
#define AD717X_CHMAP11_REG   0x1B
 
#define AD717X_CHMAP12_REG   0x1C
 
#define AD717X_CHMAP13_REG   0x1D
 
#define AD717X_CHMAP14_REG   0x1E
 
#define AD717X_CHMAP15_REG   0x1F
 
#define AD717X_SETUPCON0_REG   0x20
 
#define AD717X_SETUPCON1_REG   0x21
 
#define AD717X_SETUPCON2_REG   0x22
 
#define AD717X_SETUPCON3_REG   0x23
 
#define AD717X_SETUPCON4_REG   0x24
 
#define AD717X_SETUPCON5_REG   0x25
 
#define AD717X_SETUPCON6_REG   0x26
 
#define AD717X_SETUPCON7_REG   0x27
 
#define AD717X_FILTCON0_REG   0x28
 
#define AD717X_FILTCON1_REG   0x29
 
#define AD717X_FILTCON2_REG   0x2A
 
#define AD717X_FILTCON3_REG   0x2B
 
#define AD717X_FILTCON4_REG   0x2C
 
#define AD717X_FILTCON5_REG   0x2D
 
#define AD717X_FILTCON6_REG   0x2E
 
#define AD717X_FILTCON7_REG   0x2F
 
#define AD717X_OFFSET0_REG   0x30
 
#define AD717X_OFFSET1_REG   0x31
 
#define AD717X_OFFSET2_REG   0x32
 
#define AD717X_OFFSET3_REG   0x33
 
#define AD717X_OFFSET4_REG   0x34
 
#define AD717X_OFFSET5_REG   0x35
 
#define AD717X_OFFSET6_REG   0x36
 
#define AD717X_OFFSET7_REG   0x37
 
#define AD717X_GAIN0_REG   0x38
 
#define AD717X_GAIN1_REG   0x39
 
#define AD717X_GAIN2_REG   0x3A
 
#define AD717X_GAIN3_REG   0x3B
 
#define AD717X_GAIN4_REG   0x3C
 
#define AD717X_GAIN5_REG   0x3D
 
#define AD717X_GAIN6_REG   0x3E
 
#define AD717X_GAIN7_REG   0x3F
 
#define AD717X_COMM_REG_WEN   (0 << 7)
 
#define AD717X_COMM_REG_WR   (0 << 6)
 
#define AD717X_COMM_REG_RD   (1 << 6)
 
#define AD717X_COMM_REG_RA(x)   ((x) & 0x3F)
 
#define AD717X_STATUS_REG_RDY   (1 << 7)
 
#define AD717X_STATUS_REG_ADC_ERR   (1 << 6)
 
#define AD717X_STATUS_REG_CRC_ERR   (1 << 5)
 
#define AD717X_STATUS_REG_REG_ERR   (1 << 4)
 
#define AD717X_STATUS_REG_CH(x)   ((x) & 0x0F)
 
#define AD717X_ADCMODE_REG_REF_EN   (1 << 15)
 
#define AD717X_ADCMODE_SING_CYC   (1 << 13)
 
#define AD717X_ADCMODE_REG_DELAY(x)   (((x) & 0x7) << 8)
 
#define AD717X_ADCMODE_REG_MODE(x)   (((x) & 0x7) << 4)
 
#define AD717X_ADCMODE_REG_CLKSEL(x)   (((x) & 0x3) << 2)
 
#define AD717X_ADCMODE_REG_HIDE_DELAY   (1 << 14)
 
#define AD717X_IFMODE_REG_ALT_SYNC   (1 << 12)
 
#define AD717X_IFMODE_REG_IOSTRENGTH   (1 << 11)
 
#define AD717X_IFMODE_REG_DOUT_RESET   (1 << 8)
 
#define AD717X_IFMODE_REG_CONT_READ   (1 << 7)
 
#define AD717X_IFMODE_REG_DATA_STAT   (1 << 6)
 
#define AD717X_IFMODE_REG_REG_CHECK   (1 << 5)
 
#define AD717X_IFMODE_REG_XOR_EN   (0x01 << 2)
 
#define AD717X_IFMODE_REG_CRC_EN   (0x02 << 2)
 
#define AD717X_IFMODE_REG_XOR_STAT(x)   (((x) & AD717X_IFMODE_REG_XOR_EN) == AD717X_IFMODE_REG_XOR_EN)
 
#define AD717X_IFMODE_REG_CRC_STAT(x)   (((x) & AD717X_IFMODE_REG_CRC_EN) == AD717X_IFMODE_REG_CRC_EN)
 
#define AD717X_IFMODE_REG_DATA_WL16   (1 << 0)
 
#define AD717X_IFMODE_REG_HIDE_DELAY   (1 << 10)
 
#define AD717X_GPIOCON_REG_MUX_IO   (1 << 12)
 
#define AD717X_GPIOCON_REG_SYNC_EN   (1 << 11)
 
#define AD717X_GPIOCON_REG_ERR_EN(x)   (((x) & 0x3) << 9)
 
#define AD717X_GPIOCON_REG_ERR_DAT   (1 << 8)
 
#define AD717X_GPIOCON_REG_IP_EN1   (1 << 5)
 
#define AD717X_GPIOCON_REG_IP_EN0   (1 << 4)
 
#define AD717X_GPIOCON_REG_OP_EN1   (1 << 3)
 
#define AD717X_GPIOCON_REG_OP_EN0   (1 << 2)
 
#define AD717X_GPIOCON_REG_DATA1   (1 << 1)
 
#define AD717X_GPIOCON_REG_DATA0   (1 << 0)
 
#define AD717X_GPIOCON_REG_GP_DATA3   (1 << 7)
 
#define AD717X_GPIOCON_REG_GP_DATA2   (1 << 6)
 
#define AD717X_GPIOCON_REG_GP_DATA1   (1 << 1)
 
#define AD717X_GPIOCON_REG_GP_DATA0   (1 << 0)
 
#define AD717X_GPIOCON_REG_PDSW   (1 << 14)
 
#define AD717X_GPIOCON_REG_OP_EN2_3   (1 << 13)
 
#define AD4111_GPIOCON_REG_OP_EN0_1   (1 << 13)
 
#define AD4111_GPIOCON_REG_DATA1   (1 << 7)
 
#define AD4111_GPIOCON_REG_DATA0   (1 << 6)
 
#define AD4116_GPIOCON_REG_OP_EN2_3   (1 << 13)
 
#define AD4116_GPIOCON_REG_DATA3   (1 << 7)
 
#define AD4116_GPIOCON_REG_DATA2   (1 << 6)
 
#define AD4111_GPIOCON_REG_OW_EN   (1 << 12)
 
#define AD717X_CHMAP_REG_CH_EN   (1 << 15)
 
#define AD717X_CHMAP_REG_SETUP_SEL(x)   (((x) & 0x7) << 12)
 
#define AD717X_CHMAP_REG_AINPOS(x)   (((x) & 0x1F) << 5)
 
#define AD717X_CHMAP_REG_AINNEG(x)   (((x) & 0x1F) << 0)
 
#define AD4111_CHMAP_REG_INPUT(x)   (((x) & 0x3FF) << 0)
 
#define AD717X_SETUP_CONF_REG_BI_UNIPOLAR   (1 << 12)
 
#define AD717X_SETUP_CONF_REG_REF_SEL(x)   (((x) & 0x3) << 4)
 
#define AD717X_SETUP_CONF_REG_REF_BUF(x)   (((x) & 0x3) << 10)
 
#define AD717X_SETUP_CONF_REG_AIN_BUF(x)   (((x) & 0x3) << 8)
 
#define AD717X_SETUP_CONF_REG_BURNOUT_EN   (1 << 7)
 
#define AD717X_SETUP_CONF_REG_BUFCHOPMAX   (1 << 6)
 
#define AD717X_SETUP_CONF_REG_REFBUF_P   (1 << 11)
 
#define AD717X_SETUP_CONF_REG_REFBUF_N   (1 << 10)
 
#define AD717X_SETUP_CONF_REG_AINBUF_P   (1 << 9)
 
#define AD717X_SETUP_CONF_REG_AINBUF_N   (1 << 8)
 
#define AD4111_SETUP_CONF_REG_REFPOS_BUF   (1 << 11)
 
#define AD4111_SETUP_CONF_REG_REFNEG_BUF   (1 << 10)
 
#define AD4111_SETUP_CONF_REG_AIN_BUF(x)   (((x) & 0x3) << 8)
 
#define AD4111_SETUP_CONF_REG_BUFCHOPMAX   (1 << 6)
 
#define AD717X_FILT_CONF_REG_SINC3_MAP   (1 << 15)
 
#define AD717X_FILT_CONF_REG_ENHFILTEN   (1 << 11)
 
#define AD717X_FILT_CONF_REG_ENHFILT(x)   (((x) & 0x7) << 8)
 
#define AD717X_FILT_CONF_REG_ORDER(x)   (((x) & 0x3) << 5)
 
#define AD717X_FILT_CONF_REG_ODR(x)   (((x) & 0x1F) << 0)
 
#define AD717X_ID_REG_MASK   0xFFF0
 
#define AD7172_2_ID_REG_VALUE   0x00D0
 
#define AD7172_4_ID_REG_VALUE   0x2050
 
#define AD7173_8_ID_REG_VALUE   0x30D0
 
#define AD7175_2_ID_REG_VALUE   0x0CD0
 
#define AD7175_8_ID_REG_VALUE   0x3CD0
 
#define AD7176_2_ID_REG_VALUE   0x0C90
 
#define AD7177_2_ID_REG_VALUE   0x4FD0
 
#define AD411X_ID_REG_VALUE   0x30D0
 
#define AD4114_5_ID_REG_VALUE   0x31D0
 
#define AD4116_ID_REG_VALUE   0x34D0
 
#define AD717X_CRC8_POLYNOMIAL_REPRESENTATION   0x07 /* x8 + x2 + x + 1 */
 

Enumerations

enum  ad717x_crc_mode {
  AD717X_DISABLE,
  AD717X_USE_CRC,
  AD717X_USE_XOR
}
 

Functions

ad717x_st_regAD717X_GetReg (ad717x_dev *device, uint8_t reg_address)
 Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address. More...
 
int32_t AD717X_ReadRegister (ad717x_dev *device, uint8_t addr)
 Reads the value of the specified register. More...
 
int32_t AD717X_WriteRegister (ad717x_dev *device, uint8_t)
 Writes the value of the specified register. More...
 
int32_t AD717X_Reset (ad717x_dev *device)
 Resets the device. More...
 
int32_t AD717X_WaitForReady (ad717x_dev *device, uint32_t timeout)
 Waits until a new conversion result is available. More...
 
int32_t AD717X_ReadData (ad717x_dev *device, int32_t *pData)
 Reads the conversion result from the device. More...
 
int32_t AD717X_ComputeDataregSize (ad717x_dev *device)
 Computes data register read size to account for bit number and status read. More...
 
uint8_t AD717X_ComputeCRC8 (uint8_t *pBuf, uint8_t bufSize)
 Computes the CRC checksum for a data buffer. More...
 
uint8_t AD717X_ComputeXOR8 (uint8_t *pBuf, uint8_t bufSize)
 Computes the XOR checksum for a data buffer. More...
 
int32_t AD717X_UpdateCRCSetting (ad717x_dev *device)
 Updates the CRC settings. More...
 
int32_t AD717X_Init (ad717x_dev **device, ad717x_init_param init_param)
 Initializes the AD717X. More...
 
int32_t AD717X_remove (ad717x_dev *dev)
 Free the resources allocated by AD717X_Init(). More...
 

Detailed Description

AD717X header file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2, AD7177-2, AD4111, AD4112, AD4114, AD4115.

Author
acozma (andre.nosp@m.i.co.nosp@m.zma@a.nosp@m.nalo.nosp@m.g.com) dnechita (dan.n.nosp@m.echi.nosp@m.ta@an.nosp@m.alog.nosp@m..com)

Copyright 2015(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Macro Definition Documentation

◆ AD4111_CHMAP_REG_INPUT

#define AD4111_CHMAP_REG_INPUT (   x)    (((x) & 0x3FF) << 0)

◆ AD4111_GPIOCON_REG_DATA0

#define AD4111_GPIOCON_REG_DATA0   (1 << 6)

◆ AD4111_GPIOCON_REG_DATA1

#define AD4111_GPIOCON_REG_DATA1   (1 << 7)

◆ AD4111_GPIOCON_REG_OP_EN0_1

#define AD4111_GPIOCON_REG_OP_EN0_1   (1 << 13)

◆ AD4111_GPIOCON_REG_OW_EN

#define AD4111_GPIOCON_REG_OW_EN   (1 << 12)

◆ AD4111_SETUP_CONF_REG_AIN_BUF

#define AD4111_SETUP_CONF_REG_AIN_BUF (   x)    (((x) & 0x3) << 8)

◆ AD4111_SETUP_CONF_REG_BUFCHOPMAX

#define AD4111_SETUP_CONF_REG_BUFCHOPMAX   (1 << 6)

◆ AD4111_SETUP_CONF_REG_REFNEG_BUF

#define AD4111_SETUP_CONF_REG_REFNEG_BUF   (1 << 10)

◆ AD4111_SETUP_CONF_REG_REFPOS_BUF

#define AD4111_SETUP_CONF_REG_REFPOS_BUF   (1 << 11)

◆ AD4114_5_ID_REG_VALUE

#define AD4114_5_ID_REG_VALUE   0x31D0

◆ AD4116_GPIOCON_REG_DATA2

#define AD4116_GPIOCON_REG_DATA2   (1 << 6)

◆ AD4116_GPIOCON_REG_DATA3

#define AD4116_GPIOCON_REG_DATA3   (1 << 7)

◆ AD4116_GPIOCON_REG_OP_EN2_3

#define AD4116_GPIOCON_REG_OP_EN2_3   (1 << 13)

◆ AD4116_ID_REG_VALUE

#define AD4116_ID_REG_VALUE   0x34D0

◆ AD411X_ID_REG_VALUE

#define AD411X_ID_REG_VALUE   0x30D0

◆ AD7172_2_ID_REG_VALUE

#define AD7172_2_ID_REG_VALUE   0x00D0

◆ AD7172_4_ID_REG_VALUE

#define AD7172_4_ID_REG_VALUE   0x2050

◆ AD7173_8_ID_REG_VALUE

#define AD7173_8_ID_REG_VALUE   0x30D0

◆ AD7175_2_ID_REG_VALUE

#define AD7175_2_ID_REG_VALUE   0x0CD0

◆ AD7175_8_ID_REG_VALUE

#define AD7175_8_ID_REG_VALUE   0x3CD0

◆ AD7176_2_ID_REG_VALUE

#define AD7176_2_ID_REG_VALUE   0x0C90

◆ AD7177_2_ID_REG_VALUE

#define AD7177_2_ID_REG_VALUE   0x4FD0

◆ AD717X_ADCMODE_REG

#define AD717X_ADCMODE_REG   0x01

◆ AD717X_ADCMODE_REG_CLKSEL

#define AD717X_ADCMODE_REG_CLKSEL (   x)    (((x) & 0x3) << 2)

◆ AD717X_ADCMODE_REG_DELAY

#define AD717X_ADCMODE_REG_DELAY (   x)    (((x) & 0x7) << 8)

◆ AD717X_ADCMODE_REG_HIDE_DELAY

#define AD717X_ADCMODE_REG_HIDE_DELAY   (1 << 14)

◆ AD717X_ADCMODE_REG_MODE

#define AD717X_ADCMODE_REG_MODE (   x)    (((x) & 0x7) << 4)

◆ AD717X_ADCMODE_REG_REF_EN

#define AD717X_ADCMODE_REG_REF_EN   (1 << 15)

◆ AD717X_ADCMODE_SING_CYC

#define AD717X_ADCMODE_SING_CYC   (1 << 13)

◆ AD717X_CHMAP0_REG

#define AD717X_CHMAP0_REG   0x10

◆ AD717X_CHMAP10_REG

#define AD717X_CHMAP10_REG   0x1A

◆ AD717X_CHMAP11_REG

#define AD717X_CHMAP11_REG   0x1B

◆ AD717X_CHMAP12_REG

#define AD717X_CHMAP12_REG   0x1C

◆ AD717X_CHMAP13_REG

#define AD717X_CHMAP13_REG   0x1D

◆ AD717X_CHMAP14_REG

#define AD717X_CHMAP14_REG   0x1E

◆ AD717X_CHMAP15_REG

#define AD717X_CHMAP15_REG   0x1F

◆ AD717X_CHMAP1_REG

#define AD717X_CHMAP1_REG   0x11

◆ AD717X_CHMAP2_REG

#define AD717X_CHMAP2_REG   0x12

◆ AD717X_CHMAP3_REG

#define AD717X_CHMAP3_REG   0x13

◆ AD717X_CHMAP4_REG

#define AD717X_CHMAP4_REG   0x14

◆ AD717X_CHMAP5_REG

#define AD717X_CHMAP5_REG   0x15

◆ AD717X_CHMAP6_REG

#define AD717X_CHMAP6_REG   0x16

◆ AD717X_CHMAP7_REG

#define AD717X_CHMAP7_REG   0x17

◆ AD717X_CHMAP8_REG

#define AD717X_CHMAP8_REG   0x18

◆ AD717X_CHMAP9_REG

#define AD717X_CHMAP9_REG   0x19

◆ AD717X_CHMAP_REG_AINNEG

#define AD717X_CHMAP_REG_AINNEG (   x)    (((x) & 0x1F) << 0)

◆ AD717X_CHMAP_REG_AINPOS

#define AD717X_CHMAP_REG_AINPOS (   x)    (((x) & 0x1F) << 5)

◆ AD717X_CHMAP_REG_CH_EN

#define AD717X_CHMAP_REG_CH_EN   (1 << 15)

◆ AD717X_CHMAP_REG_SETUP_SEL

#define AD717X_CHMAP_REG_SETUP_SEL (   x)    (((x) & 0x7) << 12)

◆ AD717X_COMM_REG

#define AD717X_COMM_REG   0x00

◆ AD717X_COMM_REG_RA

#define AD717X_COMM_REG_RA (   x)    ((x) & 0x3F)

◆ AD717X_COMM_REG_RD

#define AD717X_COMM_REG_RD   (1 << 6)

◆ AD717X_COMM_REG_WEN

#define AD717X_COMM_REG_WEN   (0 << 7)

◆ AD717X_COMM_REG_WR

#define AD717X_COMM_REG_WR   (0 << 6)

◆ AD717X_CRC8_POLYNOMIAL_REPRESENTATION

#define AD717X_CRC8_POLYNOMIAL_REPRESENTATION   0x07 /* x8 + x2 + x + 1 */

◆ AD717X_DATA_REG

#define AD717X_DATA_REG   0x04

◆ AD717X_FILT_CONF_REG_ENHFILT

#define AD717X_FILT_CONF_REG_ENHFILT (   x)    (((x) & 0x7) << 8)

◆ AD717X_FILT_CONF_REG_ENHFILTEN

#define AD717X_FILT_CONF_REG_ENHFILTEN   (1 << 11)

◆ AD717X_FILT_CONF_REG_ODR

#define AD717X_FILT_CONF_REG_ODR (   x)    (((x) & 0x1F) << 0)

◆ AD717X_FILT_CONF_REG_ORDER

#define AD717X_FILT_CONF_REG_ORDER (   x)    (((x) & 0x3) << 5)

◆ AD717X_FILT_CONF_REG_SINC3_MAP

#define AD717X_FILT_CONF_REG_SINC3_MAP   (1 << 15)

◆ AD717X_FILTCON0_REG

#define AD717X_FILTCON0_REG   0x28

◆ AD717X_FILTCON1_REG

#define AD717X_FILTCON1_REG   0x29

◆ AD717X_FILTCON2_REG

#define AD717X_FILTCON2_REG   0x2A

◆ AD717X_FILTCON3_REG

#define AD717X_FILTCON3_REG   0x2B

◆ AD717X_FILTCON4_REG

#define AD717X_FILTCON4_REG   0x2C

◆ AD717X_FILTCON5_REG

#define AD717X_FILTCON5_REG   0x2D

◆ AD717X_FILTCON6_REG

#define AD717X_FILTCON6_REG   0x2E

◆ AD717X_FILTCON7_REG

#define AD717X_FILTCON7_REG   0x2F

◆ AD717X_GAIN0_REG

#define AD717X_GAIN0_REG   0x38

◆ AD717X_GAIN1_REG

#define AD717X_GAIN1_REG   0x39

◆ AD717X_GAIN2_REG

#define AD717X_GAIN2_REG   0x3A

◆ AD717X_GAIN3_REG

#define AD717X_GAIN3_REG   0x3B

◆ AD717X_GAIN4_REG

#define AD717X_GAIN4_REG   0x3C

◆ AD717X_GAIN5_REG

#define AD717X_GAIN5_REG   0x3D

◆ AD717X_GAIN6_REG

#define AD717X_GAIN6_REG   0x3E

◆ AD717X_GAIN7_REG

#define AD717X_GAIN7_REG   0x3F

◆ AD717X_GPIOCON_REG

#define AD717X_GPIOCON_REG   0x06

◆ AD717X_GPIOCON_REG_DATA0

#define AD717X_GPIOCON_REG_DATA0   (1 << 0)

◆ AD717X_GPIOCON_REG_DATA1

#define AD717X_GPIOCON_REG_DATA1   (1 << 1)

◆ AD717X_GPIOCON_REG_ERR_DAT

#define AD717X_GPIOCON_REG_ERR_DAT   (1 << 8)

◆ AD717X_GPIOCON_REG_ERR_EN

#define AD717X_GPIOCON_REG_ERR_EN (   x)    (((x) & 0x3) << 9)

◆ AD717X_GPIOCON_REG_GP_DATA0

#define AD717X_GPIOCON_REG_GP_DATA0   (1 << 0)

◆ AD717X_GPIOCON_REG_GP_DATA1

#define AD717X_GPIOCON_REG_GP_DATA1   (1 << 1)

◆ AD717X_GPIOCON_REG_GP_DATA2

#define AD717X_GPIOCON_REG_GP_DATA2   (1 << 6)

◆ AD717X_GPIOCON_REG_GP_DATA3

#define AD717X_GPIOCON_REG_GP_DATA3   (1 << 7)

◆ AD717X_GPIOCON_REG_IP_EN0

#define AD717X_GPIOCON_REG_IP_EN0   (1 << 4)

◆ AD717X_GPIOCON_REG_IP_EN1

#define AD717X_GPIOCON_REG_IP_EN1   (1 << 5)

◆ AD717X_GPIOCON_REG_MUX_IO

#define AD717X_GPIOCON_REG_MUX_IO   (1 << 12)

◆ AD717X_GPIOCON_REG_OP_EN0

#define AD717X_GPIOCON_REG_OP_EN0   (1 << 2)

◆ AD717X_GPIOCON_REG_OP_EN1

#define AD717X_GPIOCON_REG_OP_EN1   (1 << 3)

◆ AD717X_GPIOCON_REG_OP_EN2_3

#define AD717X_GPIOCON_REG_OP_EN2_3   (1 << 13)

◆ AD717X_GPIOCON_REG_PDSW

#define AD717X_GPIOCON_REG_PDSW   (1 << 14)

◆ AD717X_GPIOCON_REG_SYNC_EN

#define AD717X_GPIOCON_REG_SYNC_EN   (1 << 11)

◆ AD717X_ID_REG

#define AD717X_ID_REG   0x07

◆ AD717X_ID_REG_MASK

#define AD717X_ID_REG_MASK   0xFFF0

◆ AD717X_IFMODE_REG

#define AD717X_IFMODE_REG   0x02

◆ AD717X_IFMODE_REG_ALT_SYNC

#define AD717X_IFMODE_REG_ALT_SYNC   (1 << 12)

◆ AD717X_IFMODE_REG_CONT_READ

#define AD717X_IFMODE_REG_CONT_READ   (1 << 7)

◆ AD717X_IFMODE_REG_CRC_EN

#define AD717X_IFMODE_REG_CRC_EN   (0x02 << 2)

◆ AD717X_IFMODE_REG_CRC_STAT

#define AD717X_IFMODE_REG_CRC_STAT (   x)    (((x) & AD717X_IFMODE_REG_CRC_EN) == AD717X_IFMODE_REG_CRC_EN)

◆ AD717X_IFMODE_REG_DATA_STAT

#define AD717X_IFMODE_REG_DATA_STAT   (1 << 6)

◆ AD717X_IFMODE_REG_DATA_WL16

#define AD717X_IFMODE_REG_DATA_WL16   (1 << 0)

◆ AD717X_IFMODE_REG_DOUT_RESET

#define AD717X_IFMODE_REG_DOUT_RESET   (1 << 8)

◆ AD717X_IFMODE_REG_HIDE_DELAY

#define AD717X_IFMODE_REG_HIDE_DELAY   (1 << 10)

◆ AD717X_IFMODE_REG_IOSTRENGTH

#define AD717X_IFMODE_REG_IOSTRENGTH   (1 << 11)

◆ AD717X_IFMODE_REG_REG_CHECK

#define AD717X_IFMODE_REG_REG_CHECK   (1 << 5)

◆ AD717X_IFMODE_REG_XOR_EN

#define AD717X_IFMODE_REG_XOR_EN   (0x01 << 2)

◆ AD717X_IFMODE_REG_XOR_STAT

#define AD717X_IFMODE_REG_XOR_STAT (   x)    (((x) & AD717X_IFMODE_REG_XOR_EN) == AD717X_IFMODE_REG_XOR_EN)

◆ AD717X_OFFSET0_REG

#define AD717X_OFFSET0_REG   0x30

◆ AD717X_OFFSET1_REG

#define AD717X_OFFSET1_REG   0x31

◆ AD717X_OFFSET2_REG

#define AD717X_OFFSET2_REG   0x32

◆ AD717X_OFFSET3_REG

#define AD717X_OFFSET3_REG   0x33

◆ AD717X_OFFSET4_REG

#define AD717X_OFFSET4_REG   0x34

◆ AD717X_OFFSET5_REG

#define AD717X_OFFSET5_REG   0x35

◆ AD717X_OFFSET6_REG

#define AD717X_OFFSET6_REG   0x36

◆ AD717X_OFFSET7_REG

#define AD717X_OFFSET7_REG   0x37

◆ AD717X_REGCHECK_REG

#define AD717X_REGCHECK_REG   0x03

◆ AD717X_SETUP_CONF_REG_AIN_BUF

#define AD717X_SETUP_CONF_REG_AIN_BUF (   x)    (((x) & 0x3) << 8)

◆ AD717X_SETUP_CONF_REG_AINBUF_N

#define AD717X_SETUP_CONF_REG_AINBUF_N   (1 << 8)

◆ AD717X_SETUP_CONF_REG_AINBUF_P

#define AD717X_SETUP_CONF_REG_AINBUF_P   (1 << 9)

◆ AD717X_SETUP_CONF_REG_BI_UNIPOLAR

#define AD717X_SETUP_CONF_REG_BI_UNIPOLAR   (1 << 12)

◆ AD717X_SETUP_CONF_REG_BUFCHOPMAX

#define AD717X_SETUP_CONF_REG_BUFCHOPMAX   (1 << 6)

◆ AD717X_SETUP_CONF_REG_BURNOUT_EN

#define AD717X_SETUP_CONF_REG_BURNOUT_EN   (1 << 7)

◆ AD717X_SETUP_CONF_REG_REF_BUF

#define AD717X_SETUP_CONF_REG_REF_BUF (   x)    (((x) & 0x3) << 10)

◆ AD717X_SETUP_CONF_REG_REF_SEL

#define AD717X_SETUP_CONF_REG_REF_SEL (   x)    (((x) & 0x3) << 4)

◆ AD717X_SETUP_CONF_REG_REFBUF_N

#define AD717X_SETUP_CONF_REG_REFBUF_N   (1 << 10)

◆ AD717X_SETUP_CONF_REG_REFBUF_P

#define AD717X_SETUP_CONF_REG_REFBUF_P   (1 << 11)

◆ AD717X_SETUPCON0_REG

#define AD717X_SETUPCON0_REG   0x20

◆ AD717X_SETUPCON1_REG

#define AD717X_SETUPCON1_REG   0x21

◆ AD717X_SETUPCON2_REG

#define AD717X_SETUPCON2_REG   0x22

◆ AD717X_SETUPCON3_REG

#define AD717X_SETUPCON3_REG   0x23

◆ AD717X_SETUPCON4_REG

#define AD717X_SETUPCON4_REG   0x24

◆ AD717X_SETUPCON5_REG

#define AD717X_SETUPCON5_REG   0x25

◆ AD717X_SETUPCON6_REG

#define AD717X_SETUPCON6_REG   0x26

◆ AD717X_SETUPCON7_REG

#define AD717X_SETUPCON7_REG   0x27

◆ AD717X_STATUS_REG

#define AD717X_STATUS_REG   0x00

◆ AD717X_STATUS_REG_ADC_ERR

#define AD717X_STATUS_REG_ADC_ERR   (1 << 6)

◆ AD717X_STATUS_REG_CH

#define AD717X_STATUS_REG_CH (   x)    ((x) & 0x0F)

◆ AD717X_STATUS_REG_CRC_ERR

#define AD717X_STATUS_REG_CRC_ERR   (1 << 5)

◆ AD717X_STATUS_REG_RDY

#define AD717X_STATUS_REG_RDY   (1 << 7)

◆ AD717X_STATUS_REG_REG_ERR

#define AD717X_STATUS_REG_REG_ERR   (1 << 4)

Enumeration Type Documentation

◆ ad717x_crc_mode

Enumerator
AD717X_DISABLE 
AD717X_USE_CRC 
AD717X_USE_XOR 

Function Documentation

◆ AD717X_ComputeCRC8()

uint8_t AD717X_ComputeCRC8 ( uint8_t *  pBuf,
uint8_t  bufSize 
)

Computes the CRC checksum for a data buffer.

Computes the CRC checksum for a data buffer.

Parameters
pBuf- Data buffer
bufSize- Data buffer size in bytes
Returns
Returns the computed CRC checksum.
Here is the caller graph for this function:

◆ AD717X_ComputeDataregSize()

int32_t AD717X_ComputeDataregSize ( ad717x_dev device)

Computes data register read size to account for bit number and status read.

Computes data register read size to account for bit number and status read.

Parameters
device- The handler of the instance of the driver.
Returns
0in case of success or negative code in case of failure.
Here is the caller graph for this function:

◆ AD717X_ComputeXOR8()

uint8_t AD717X_ComputeXOR8 ( uint8_t *  pBuf,
uint8_t  bufSize 
)

Computes the XOR checksum for a data buffer.

Computes the XOR checksum for a data buffer.

Parameters
pBuf- Data buffer
bufSize- Data buffer size in bytes
Returns
Returns the computed XOR checksum.
Here is the caller graph for this function:

◆ AD717X_GetReg()

ad717x_st_reg* AD717X_GetReg ( ad717x_dev device,
uint8_t  reg_address 
)

Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address.

Retrieves a pointer to the register that matches the given address

Parameters
device- The handler of the instance of the driver.
reg_address- The address to be used to find the register.
Returns
A pointer to the register if found or 0.
Here is the caller graph for this function:

◆ AD717X_Init()

int32_t AD717X_Init ( ad717x_dev **  device,
ad717x_init_param  init_param 
)

Initializes the AD717X.

Initializes the AD717X.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
Returns 0 for success or negative error code.

◆ AD717X_ReadData()

int32_t AD717X_ReadData ( ad717x_dev device,
int32_t *  pData 
)

Reads the conversion result from the device.

Reads the conversion result from the device.

Parameters
device- The handler of the instance of the driver.
pData- Pointer to store the read data.
Returns
Returns 0 for success or negative error code.

◆ AD717X_ReadRegister()

int32_t AD717X_ReadRegister ( ad717x_dev device,
uint8_t  addr 
)

Reads the value of the specified register.

Reads the value of the specified register.

Parameters
device- The handler of the instance of the driver.
addr- The address of the register to be read. The value will be stored inside the register structure that holds info about this register.
Returns
Returns 0 for success or negative error code.
Here is the caller graph for this function:

◆ AD717X_remove()

int32_t AD717X_remove ( ad717x_dev dev)

Free the resources allocated by AD717X_Init().

Free the resources allocated by AD717X_Init().

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

◆ AD717X_Reset()

int32_t AD717X_Reset ( ad717x_dev device)

Resets the device.

Resets the device.

Parameters
device- The handler of the instance of the driver.
Returns
Returns 0 for success or negative error code.
Here is the caller graph for this function:

◆ AD717X_UpdateCRCSetting()

int32_t AD717X_UpdateCRCSetting ( ad717x_dev device)

Updates the CRC settings.

Updates the CRC settings.

Parameters
device- The handler of the instance of the driver.
Returns
Returns 0 for success or negative error code.
Here is the caller graph for this function:

◆ AD717X_WaitForReady()

int32_t AD717X_WaitForReady ( ad717x_dev device,
uint32_t  timeout 
)

Waits until a new conversion result is available.

Waits until a new conversion result is available.

Parameters
device- The handler of the instance of the driver.
timeout- Count representing the number of polls to be done until the function returns if no new data is available.
Returns
Returns 0 for success or negative error code.

◆ AD717X_WriteRegister()

int32_t AD717X_WriteRegister ( ad717x_dev device,
uint8_t  addr 
)

Writes the value of the specified register.

Writes the value of the specified register.

Parameters
device- The handler of the instance of the driver.
addr- The address of the register to be written with the value stored inside the register structure that holds info about this register.
Returns
Returns 0 for success or negative error code.
Here is the caller graph for this function: