![]() |
no-OS
|
AD717X header file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2, AD7177-2, AD4111, AD4112, AD4113, AD4114, AD4115, AD4116. More...
Classes | |
| union | ad717x_analog_inputs |
| struct | ad717x_channel_setup |
| struct | ad717x_filtcon |
| struct | ad717x_channel_map |
| struct | ad717x_st_reg |
| struct | ad717x_dev |
| struct | ad717x_init_param |
Functions | |
| 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. | |
| int32_t | AD717X_ReadRegister (ad717x_dev *device, uint8_t addr) |
| Reads the value of the specified register. | |
| int32_t | AD717X_WriteRegister (ad717x_dev *device, uint8_t) |
| Writes the value of the specified register. | |
| int32_t | AD717X_Reset (ad717x_dev *device) |
| Resets the device. | |
| int32_t | AD717X_WaitForReady (ad717x_dev *device, uint32_t timeout) |
| Waits until a new conversion result is available. | |
| int32_t | AD717X_ReadData (ad717x_dev *device, int32_t *pData) |
| Reads the conversion result from the device. | |
| int32_t | AD717X_ComputeDataregSize (ad717x_dev *device) |
| Computes data register read size to account for bit number and status read. | |
| uint8_t | AD717X_ComputeCRC8 (uint8_t *pBuf, uint8_t bufSize) |
| Computes the CRC checksum for a data buffer. | |
| uint8_t | AD717X_ComputeXOR8 (uint8_t *pBuf, uint8_t bufSize) |
| Computes the XOR checksum for a data buffer. | |
| int32_t | AD717X_UpdateCRCSetting (ad717x_dev *device) |
| Updates the CRC settings. | |
| int32_t | AD717X_Init (ad717x_dev **device, ad717x_init_param init_param) |
| Initializes the AD717X. | |
| int32_t | AD717X_remove (ad717x_dev *dev) |
| Free the resources allocated by AD717X_Init(). | |
| int | ad717x_set_channel_status (ad717x_dev *device, uint8_t channel_id, bool channel_status) |
| Set channel status - Enable/Disable. | |
| int | ad717x_set_adc_mode (ad717x_dev *device, enum ad717x_mode mode) |
| Set ADC Mode. | |
| int | ad717x_connect_analog_input (ad717x_dev *device, uint8_t channel_id, union ad717x_analog_inputs analog_input) |
| Set Analog Inputs to channel. | |
| int | ad717x_assign_setup (ad717x_dev *device, uint8_t channel_id, uint8_t setup) |
| Assign Setup to Channel. | |
| int | ad717x_set_polarity (ad717x_dev *device, bool bipolar, uint8_t setup_id) |
| Set Polarity. | |
| int | ad717x_set_reference_source (ad717x_dev *device, enum ad717x_reference_source ref_source, uint8_t setup_id) |
| Select the reference source. | |
| int | ad717x_enable_buffers (ad717x_dev *device, bool inbuf_en, bool refbuf_en, uint8_t setup_id) |
| Enable input and reference buffers. | |
| int | ad717x_single_read (ad717x_dev *device, uint8_t id, int32_t *adc_raw_data) |
| Perform Single Conversion. | |
| int32_t | ad717x_configure_device_odr (ad717x_dev *dev, uint8_t filtcon_id, uint8_t odr_sel) |
| Configure ODR for the device. | |
AD717X header file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2, AD7177-2, AD4111, AD4112, AD4113, AD4114, AD4115, AD4116.
Copyright 2015(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define AD4111_CHMAP_REG_INPUT | ( | x | ) |
| #define AD4111_GPIOCON_REG_DATA0 (1 << 6) |
| #define AD4111_GPIOCON_REG_DATA1 (1 << 7) |
| #define AD4111_GPIOCON_REG_OP_EN0_1 (1 << 13) |
| #define AD4111_GPIOCON_REG_OW_EN (1 << 12) |
| #define AD4111_SETUP_CONF_REG_AIN_BUF | ( | x | ) |
| #define AD4111_SETUP_CONF_REG_BUFCHOPMAX (1 << 6) |
| #define AD4111_SETUP_CONF_REG_REFNEG_BUF (1 << 10) |
| #define AD4111_SETUP_CONF_REG_REFPOS_BUF (1 << 11) |
| #define AD4113_4_5_ID_REG_VALUE 0x31D0 |
| #define AD4116_GPIOCON_REG_DATA2 (1 << 6) |
| #define AD4116_GPIOCON_REG_DATA3 (1 << 7) |
| #define AD4116_GPIOCON_REG_OP_EN2_3 (1 << 13) |
| #define AD4116_ID_REG_VALUE 0x34D0 |
| #define AD411X_ID_REG_VALUE 0x30D0 |
| #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 AD717X_ADCMODE_REG 0x01 |
| #define AD717X_ADCMODE_REG_CLKSEL | ( | x | ) |
| #define AD717X_ADCMODE_REG_DELAY | ( | x | ) |
| #define AD717X_ADCMODE_REG_HIDE_DELAY (1 << 14) |
| #define AD717X_ADCMODE_REG_MODE | ( | x | ) |
| #define AD717X_ADCMODE_REG_MODE_MSK NO_OS_GENMASK(6,4) |
| #define AD717X_ADCMODE_REG_REF_EN (1 << 15) |
| #define AD717X_ADCMODE_SING_CYC (1 << 13) |
| #define AD717x_CHANNEL_INPUT_MASK NO_OS_GENMASK(9,0) |
| #define AD717X_CHMAP0_REG 0x10 |
| #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_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_CHMAP_REG_AINNEG | ( | x | ) |
| #define AD717X_CHMAP_REG_AINNEG_MSK NO_OS_GENMASK(4,0) |
| #define AD717X_CHMAP_REG_AINPOS | ( | x | ) |
| #define AD717X_CHMAP_REG_AINPOS_MSK NO_OS_GENMASK(9,5) |
| #define AD717X_CHMAP_REG_CH_EN (1 << 15) |
| #define AD717X_CHMAP_REG_SETUP_SEL | ( | x | ) |
| #define AD717X_CHMAP_REG_SETUP_SEL_MSK NO_OS_GENMASK(14,12) |
| #define AD717X_COMM_REG 0x00 |
| #define AD717X_COMM_REG_RA | ( | x | ) |
| #define AD717X_COMM_REG_RD (1 << 6) |
| #define AD717X_COMM_REG_WEN (0 << 7) |
| #define AD717X_COMM_REG_WR (0 << 6) |
| #define AD717X_CONV_TIMEOUT 10000 |
| #define AD717X_CRC8_POLYNOMIAL_REPRESENTATION 0x07 /* x8 + x2 + x + 1 */ |
| #define AD717X_DATA_REG 0x04 |
| #define AD717X_FILT_CONF_REG_ENHFILT | ( | x | ) |
| #define AD717X_FILT_CONF_REG_ENHFILTEN (1 << 11) |
| #define AD717X_FILT_CONF_REG_ODR | ( | x | ) |
| #define AD717X_FILT_CONF_REG_ORDER | ( | x | ) |
| #define AD717X_FILT_CONF_REG_SINC3_MAP (1 << 15) |
| #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_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_GPIOCON_REG 0x06 |
| #define AD717X_GPIOCON_REG_DATA0 (1 << 0) |
| #define AD717X_GPIOCON_REG_DATA1 (1 << 1) |
| #define AD717X_GPIOCON_REG_ERR_DAT (1 << 8) |
| #define AD717X_GPIOCON_REG_ERR_EN | ( | x | ) |
| #define AD717X_GPIOCON_REG_GP_DATA0 (1 << 0) |
| #define AD717X_GPIOCON_REG_GP_DATA1 (1 << 1) |
| #define AD717X_GPIOCON_REG_GP_DATA2 (1 << 6) |
| #define AD717X_GPIOCON_REG_GP_DATA3 (1 << 7) |
| #define AD717X_GPIOCON_REG_IP_EN0 (1 << 4) |
| #define AD717X_GPIOCON_REG_IP_EN1 (1 << 5) |
| #define AD717X_GPIOCON_REG_MUX_IO (1 << 12) |
| #define AD717X_GPIOCON_REG_OP_EN0 (1 << 2) |
| #define AD717X_GPIOCON_REG_OP_EN1 (1 << 3) |
| #define AD717X_GPIOCON_REG_OP_EN2_3 (1 << 13) |
| #define AD717X_GPIOCON_REG_PDSW (1 << 14) |
| #define AD717X_GPIOCON_REG_SYNC_EN (1 << 11) |
| #define AD717X_ID_REG 0x07 |
| #define AD717X_ID_REG_MASK 0xFFF0 |
| #define AD717X_IFMODE_REG 0x02 |
| #define AD717X_IFMODE_REG_ALT_SYNC (1 << 12) |
| #define AD717X_IFMODE_REG_CONT_READ (1 << 7) |
| #define AD717X_IFMODE_REG_CRC_EN (0x02 << 2) |
| #define AD717X_IFMODE_REG_CRC_STAT | ( | x | ) |
| #define AD717X_IFMODE_REG_DATA_STAT (1 << 6) |
| #define AD717X_IFMODE_REG_DATA_WL16 (1 << 0) |
| #define AD717X_IFMODE_REG_DOUT_RESET (1 << 8) |
| #define AD717X_IFMODE_REG_HIDE_DELAY (1 << 10) |
| #define AD717X_IFMODE_REG_IOSTRENGTH (1 << 11) |
| #define AD717X_IFMODE_REG_REG_CHECK (1 << 5) |
| #define AD717X_IFMODE_REG_XOR_EN (0x01 << 2) |
| #define AD717X_IFMODE_REG_XOR_STAT | ( | x | ) |
| #define AD717x_MAX_CHANNELS 16 |
| #define AD717x_MAX_SETUPS 8 |
| #define AD717x_ODR_MSK NO_OS_GENMASK(4,0) |
| #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_REGCHECK_REG 0x03 |
| #define AD717X_SETUP_CONF_REG_AIN_BUF | ( | x | ) |
| #define AD717X_SETUP_CONF_REG_AINBUF_N (1 << 8) |
| #define AD717X_SETUP_CONF_REG_AINBUF_P (1 << 9) |
| #define AD717X_SETUP_CONF_REG_BI_UNIPOLAR (1 << 12) |
| #define AD717X_SETUP_CONF_REG_BUFCHOPMAX (1 << 6) |
| #define AD717X_SETUP_CONF_REG_BURNOUT_EN (1 << 7) |
| #define AD717X_SETUP_CONF_REG_REF_BUF | ( | x | ) |
| #define AD717X_SETUP_CONF_REG_REF_SEL | ( | x | ) |
| #define AD717X_SETUP_CONF_REG_REF_SEL_MSK NO_OS_GENMASK(5,4) |
| #define AD717X_SETUP_CONF_REG_REFBUF_N (1 << 10) |
| #define AD717X_SETUP_CONF_REG_REFBUF_P (1 << 11) |
| #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_STATUS_REG 0x00 |
| #define AD717X_STATUS_REG_ADC_ERR (1 << 6) |
| #define AD717X_STATUS_REG_CH | ( | x | ) |
| #define AD717X_STATUS_REG_CRC_ERR (1 << 5) |
| #define AD717X_STATUS_REG_RDY (1 << 7) |
| #define AD717X_STATUS_REG_REG_ERR (1 << 4) |
| enum ad717x_analog_input |
| enum ad717x_crc_mode |
| enum ad717x_device_type |
| enum ad717x_enhfilt |
| enum ad717x_mode |
| enum ad717x_odr |
| enum ad717x_order |
| int ad717x_assign_setup | ( | ad717x_dev * | device, |
| uint8_t | channel_id, | ||
| uint8_t | setup ) |
Assign Setup to Channel.
| device | - AD717x Device Descriptor |
| channel_id | - Channel ID (number) |
| setup | - Setup ID (number) |
| 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.
| pBuf | - Data buffer |
| bufSize | - Data buffer size in bytes |
| 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.
| device | - The handler of the instance of the driver. |
| 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.
| pBuf | - Data buffer |
| bufSize | - Data buffer size in bytes |
| int32_t ad717x_configure_device_odr | ( | ad717x_dev * | dev, |
| uint8_t | filtcon_id, | ||
| uint8_t | odr_sel ) |
Configure ODR for the device.
| dev | - The AD717x Device descriptor |
| filtcon_id | - Filter Configuration Register ID (Number) |
| odr_sel | - ODR[4:0] bitfield value as a decimal |
| int ad717x_connect_analog_input | ( | ad717x_dev * | device, |
| uint8_t | channel_id, | ||
| union ad717x_analog_inputs | analog_input ) |
Set Analog Inputs to channel.
| device | - AD717x Device Descriptor |
| channel_id | - Channel whose Analog input is to be configured |
| analog_input | - Analog Inputs to the Channel |
| int ad717x_enable_buffers | ( | ad717x_dev * | device, |
| bool | inbuf_en, | ||
| bool | refbuf_en, | ||
| uint8_t | setup_id ) |
Enable input and reference buffers.
| device | - AD717x Device Descriptor |
| inbuf_en | - Enable Inpur Buffer |
| refbuf_en | - Enable referece Buffer |
| setup_id | - Setup ID (Number) |
| 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
| device | - The handler of the instance of the driver. |
| reg_address | - The address to be used to find the register. |
| int32_t AD717X_Init | ( | ad717x_dev ** | device, |
| ad717x_init_param | init_param ) |
Initializes the AD717X.
Initializes the AD717X.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| int32_t AD717X_ReadData | ( | ad717x_dev * | device, |
| int32_t * | pData ) |
Reads the conversion result from the device.
Reads the conversion result from the device.
| device | - The handler of the instance of the driver. |
| pData | - Pointer to store the read data. |
| int32_t AD717X_ReadRegister | ( | ad717x_dev * | device, |
| uint8_t | addr ) |
Reads the value of the specified register.
Reads the value of the specified register.
| 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. |
| int32_t AD717X_remove | ( | ad717x_dev * | dev | ) |
Free the resources allocated by AD717X_Init().
Free the resources allocated by AD717X_Init().
| dev | - The device structure. |
| int32_t AD717X_Reset | ( | ad717x_dev * | device | ) |
Resets the device.
Resets the device.
| device | - The handler of the instance of the driver. |
| int ad717x_set_adc_mode | ( | ad717x_dev * | device, |
| enum ad717x_mode | adc_mode ) |
Set ADC Mode.
| device | - AD717x Device Descriptor |
| adc_mode | - ADC Mode to be configured |
| int ad717x_set_channel_status | ( | ad717x_dev * | device, |
| uint8_t | channel_id, | ||
| bool | channel_status ) |
Set channel status - Enable/Disable.
| device | - AD717x Device descriptor. |
| channel_id | - Channel ID (number) of the channel whose status is to be set. |
| channel_status | - Required status of the channel-True in case of Enable and False in case of Disable |
| int ad717x_set_polarity | ( | ad717x_dev * | device, |
| bool | bipolar, | ||
| uint8_t | setup_id ) |
Set Polarity.
| device | - AD717x Device Descriptor |
| bipolar | - Polarity Select:True in case of Bipolar, False in case of Unipolar |
| setup_id | - Setup ID (number) |
| int ad717x_set_reference_source | ( | ad717x_dev * | device, |
| enum ad717x_reference_source | ref_source, | ||
| uint8_t | setup_id ) |
Select the reference source.
| device | - AD717x Device Descriptor |
| ref_source | - Reference source |
| setup_id | - Setup ID (Number) |
| int ad717x_single_read | ( | ad717x_dev * | device, |
| uint8_t | id, | ||
| int32_t * | adc_raw_data ) |
Perform Single Conversion.
| device | - AD717x Device Descriptor |
| id | - Channel ID (number) requested |
| adc_raw_data | ADC Raw Value |
| int32_t AD717X_UpdateCRCSetting | ( | ad717x_dev * | device | ) |
Updates the CRC settings.
Updates the CRC settings.
| device | - The handler of the instance of the driver. |
| 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.
| 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. |
| int32_t AD717X_WriteRegister | ( | ad717x_dev * | device, |
| uint8_t | addr ) |
Writes the value of the specified register.
Writes the value of the specified register.
| 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. |