![]() |
no-OS
|
Header file of AD7190/2/3/4/5 Driver. More...
Classes | |
| struct | ad719x_dev |
| struct | ad719x_init_param |
Enumerations | |
| enum | ad719x_adc_gain { AD719X_ADC_GAIN_1 = 0 , AD719X_ADC_GAIN_8 = 3 , AD719X_ADC_GAIN_16 = 4 , AD719X_ADC_GAIN_32 = 5 , AD719X_ADC_GAIN_64 = 6 , AD719X_ADC_GAIN_128 = 7 } |
| enum | ad719x_adc_clock { AD719X_EXT_CRYSTAL_MCLK1_MCLK2 , AD719X_EXT_CRYSTAL_MCLK2 , AD719X_INT_CLK_4_92_MHZ_TRIST , AD719X_INT_CLK_4_92_MHZ } |
| enum | ad719x_adc_modes { AD719X_MODE_CONT , AD719X_MODE_SINGLE , AD719X_MODE_IDLE , AD719X_MODE_PWRDN , AD719X_MODE_CAL_INT_ZERO , AD719X_MODE_CAL_INT_FULL , AD719X_MODE_CAL_SYS_ZERO , AD719X_MODE_CAL_SYS_FULL } |
| enum | ad719x_chip_id { AD7190 = 0x4 , AD7192 = 0x0 , AD7193 = 0x2 , AD7194 = 0x3 , AD7195 = 0xA6 } |
Functions | |
| int | ad719x_init (struct ad719x_dev **device, struct ad719x_init_param init_param) |
| Initializes the communication peripheral and the initial Values for AD719X Board and resets the device. | |
| int | ad719x_remove (struct ad719x_dev *dev) |
| Free the resources allocated by ad719x_init(). | |
| int | ad719x_set_register_value (struct ad719x_dev *dev, uint8_t reg_addr, uint32_t reg_value, uint8_t bytes_number) |
| Writes data into a register. | |
| int | ad719x_get_register_value (struct ad719x_dev *dev, uint8_t reg_addr, uint8_t bytes_number, uint32_t *reg_data) |
| Reads the value of a register. | |
| int | ad719x_set_masked_register_value (struct ad719x_dev *dev, uint8_t reg_addr, uint32_t mask, uint32_t data, uint8_t bytes) |
| Write masked data into device register. | |
| int | ad719x_reset (struct ad719x_dev *dev) |
| Resets the device. | |
| int | ad719x_set_operating_mode (struct ad719x_dev *dev, enum ad719x_adc_modes opt_mode) |
| Sets device into the specified operating mode. | |
| int | ad719x_wait_rdy_go_low (struct ad719x_dev *dev) |
| Waits for RDY pin to go low. | |
| int | ad719x_channels_select (struct ad719x_dev *dev, uint16_t chn_mask) |
| Selects the channels to be enabled. | |
| int | ad719x_calibrate (struct ad719x_dev *dev, uint8_t mode, uint8_t channel) |
| Performs the given calibration to the specified channel. | |
| int | ad719x_config_input_mode (struct ad719x_dev *dev, uint8_t mode) |
| Configures the input mode of the ADC. | |
| int | ad719x_buffer_select (struct ad719x_dev *dev, uint8_t buff_en) |
| Enables or disables the buffer on the ADC input channels. | |
| int | ad719x_output_rate_select (struct ad719x_dev *dev, uint16_t out_rate_code) |
| Selects the filter output data rate of the ADC. | |
| int | ad719x_clock_select (struct ad719x_dev *dev, enum ad719x_adc_clock clk_select) |
| Selects the clock source of the ADC. | |
| int | ad719x_set_bridge_switch (struct ad719x_dev *dev, uint8_t bpdsw_select) |
| Opens or closes the bridge power-down switch of the ADC. | |
| int | ad719x_range_setup (struct ad719x_dev *dev, uint8_t polarity, enum ad719x_adc_gain range) |
| Selects the polarity of the conversion and the ADC input range. | |
| int | ad719x_single_conversion (struct ad719x_dev *dev, uint32_t *reg_data) |
| Returns the result of a single conversion. | |
| int | ad719x_continuous_read_avg (struct ad719x_dev *dev, uint8_t sample_number, uint32_t *samples_avg) |
| Returns the average of several conversion results. | |
| int | ad719x_temperature_read (struct ad719x_dev *dev, float *temp) |
| Read data from temperature sensor and converts it to Celsius degrees. | |
| float | ad719x_convert_to_millivolts (struct ad719x_dev *dev, uint32_t raw_data, float v_ref) |
| Converts 24-bit raw data to millivolts. | |
Header file of AD7190/2/3/4/5 Driver.
Copyright 2012(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| #define AD7190_4_ID_MASK 0x0F |
| #define AD7195_ID_MASK 0xFF |
| #define AD719X_AVG_BY_16 3 |
| #define AD719X_AVG_BY_2 1 |
| #define AD719X_AVG_BY_8 2 |
| #define AD719X_AVG_NONE 0 |
| #define AD719X_CH_0 0 |
| #define AD719X_CH_1 1 |
| #define AD719X_CH_2 2 |
| #define AD719X_CH_3 3 |
| #define AD719X_CH_4 4 |
| #define AD719X_CH_5 5 |
| #define AD719X_CH_6 6 |
| #define AD719X_CH_7 7 |
| #define AD719X_CH_MASK | ( | channel | ) |
| #define AD719X_CH_SHORT 9 |
| #define AD719X_CH_TEMP 8 |
| #define AD719X_COMM_ADDR | ( | x | ) |
| #define AD719X_COMM_CREAD (1 << 2) |
| #define AD719X_COMM_READ (1 << 6) |
| #define AD719X_COMM_WEN (1 << 7) |
| #define AD719X_COMM_WRITE (0 << 6) |
| #define AD719X_CONF_BUF (1 << 4) |
| #define AD719X_CONF_BURN (1 << 7) |
| #define AD719X_CONF_CHAN | ( | x | ) |
| #define AD719X_CONF_CHOP ((uint32_t)1 << 23) |
| #define AD719X_CONF_GAIN | ( | x | ) |
| #define AD719X_CONF_PSEUDO ((uint32_t)1 << 18) |
| #define AD719X_CONF_REFDET (1 << 6) |
| #define AD719X_CONF_REFSEL ((uint32_t)1 << 20) |
| #define AD719X_CONF_UNIPOLAR (1 << 3) |
| #define AD719X_GPOCON_BPDSW (1 << 6) |
| #define AD719X_GPOCON_GP10EN (1 << 4) |
| #define AD719X_GPOCON_GP32EN (1 << 5) |
| #define AD719X_GPOCON_P0DAT (1 << 0) |
| #define AD719X_GPOCON_P1DAT (1 << 1) |
| #define AD719X_GPOCON_P2DAT (1 << 2) |
| #define AD719X_GPOCON_P3DAT (1 << 3) |
| #define AD719X_MODE_AVG | ( | x | ) |
| #define AD719X_MODE_CLKDIV (1 << 12) |
| #define AD719X_MODE_CLKSRC | ( | x | ) |
| #define AD719X_MODE_DAT_STA ((uint32_t)1 << 20) |
| #define AD719X_MODE_ENPAR (1 << 13) |
| #define AD719X_MODE_RATE | ( | x | ) |
| #define AD719X_MODE_REJ60 (1 << 10) |
| #define AD719X_MODE_SCYCLE (1 << 11) |
| #define AD719X_MODE_SEL | ( | x | ) |
| #define AD719X_MODE_SINC3 (1 << 15) |
| #define AD719X_REG_COMM 0 |
| #define AD719X_REG_CONF 2 |
| #define AD719X_REG_DATA 3 |
| #define AD719X_REG_FULLSCALE 7 |
| #define AD719X_REG_GPOCON 5 |
| #define AD719X_REG_ID 4 |
| #define AD719X_REG_MODE 1 |
| #define AD719X_REG_OFFSET 6 |
| #define AD719X_REG_STAT 0 |
| #define AD719X_SLAVE_ID 1 |
| #define AD719X_STAT_CH0 (1 << 0) |
| #define AD719X_STAT_CH1 (1 << 1) |
| #define AD719X_STAT_CH2 (1 << 2) |
| #define AD719X_STAT_CH3 (1 << 3) |
| #define AD719X_STAT_ERR (1 << 6) |
| #define AD719X_STAT_NOREF (1 << 5) |
| #define AD719X_STAT_PARITY (1 << 4) |
| #define AD719X_STAT_RDY (1 << 7) |
| enum ad719x_adc_clock |
| enum ad719x_adc_gain |
| enum ad719x_adc_modes |
| enum ad719x_chip_id |
| int ad719x_buffer_select | ( | struct ad719x_dev * | dev, |
| uint8_t | buff_en ) |
Enables or disables the buffer on the ADC input channels.
Enables or disables the buffer on the ADC input channels
| dev | - The device structure. |
| buff_en | - Enable/disable option. Example: 0 - Buffer disabled 1 - Buffer Enabled |
| int ad719x_calibrate | ( | struct ad719x_dev * | dev, |
| uint8_t | mode, | ||
| uint8_t | channel ) |
Performs the given calibration to the specified channel.
Performs the given calibration to the specified channel.
| dev | - The device structure. |
| mode | - Calibration type. |
| channel | - Channel to be calibrated. |
| int ad719x_channels_select | ( | struct ad719x_dev * | dev, |
| uint16_t | chn_mask ) |
Selects the channels to be enabled.
Selects the channels to be enabled.
| dev | - The device structure. |
| chn_mask | - Channel mask. Example: AD719X_CH_0 - AIN1(+) - AIN2(-); (Pseudo = 0) AD719X_CH_1 - AIN3(+) - AIN4(-); (Pseudo = 0) AD719X_TEMP - Temperature sensor AD719X_SHORT - AIN2(+) - AIN2(-); (Pseudo = 0) |
| int ad719x_clock_select | ( | struct ad719x_dev * | dev, |
| enum ad719x_adc_clock | clk_select ) |
Selects the clock source of the ADC.
Selects the clock source of the ADC
| dev | - The device structure. |
| clk_select | - Clock source to be selected. Accepted values: AD719X_EXT_CRYSTAL_MCLK1_MCLK2 AD719X_EXT_CRYSTAL_MCLK2 AD719X_INT_CLK_4_92_MHZ_TRIST AD719X_INT_CLK_4_92_MHZ |
| int ad719x_config_input_mode | ( | struct ad719x_dev * | dev, |
| uint8_t | mode ) |
Configures the input mode of the ADC.
Configures the input mode of the ADC
| dev | - The device structure. |
| mode | - Mode selection. Example: 0 - Differential Analog Inputs 1 - Pseudo Differential Analog Inputs |
| int ad719x_continuous_read_avg | ( | struct ad719x_dev * | dev, |
| uint8_t | sample_number, | ||
| uint32_t * | samples_avg ) |
Returns the average of several conversion results.
Returns the average of several conversion results.
| dev | - The device structure. |
| sample_number | - the number of samples |
| samples_avg | - Average of the samples read |
| float ad719x_convert_to_millivolts | ( | struct ad719x_dev * | dev, |
| uint32_t | raw_data, | ||
| float | v_ref ) |
Converts 24-bit raw data to millivolts.
Converts 24-bit raw data to millivolts.
| dev | - The device structure. |
| raw_data | - 24-bit data sample. |
| v_ref | - The value of the voltage reference used by the device. |
| int ad719x_get_register_value | ( | struct ad719x_dev * | dev, |
| uint8_t | reg_addr, | ||
| uint8_t | bytes_number, | ||
| uint32_t * | reg_data ) |
Reads the value of a register.
Reads the value of a register.
| dev | - The device structure. |
| reg_addr | - Address of the register. |
| bytes_number | - Number of bytes that will be read. |
| reg_data | - Data read from the register. |
| int ad719x_init | ( | struct ad719x_dev ** | device, |
| struct ad719x_init_param | init_param ) |
Initializes the communication peripheral and the initial Values for AD719X Board and resets the device.
Checks if the AD719X part is present.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| int ad719x_output_rate_select | ( | struct ad719x_dev * | dev, |
| uint16_t | out_rate_code ) |
Selects the filter output data rate of the ADC.
Selects the filter output data rate of the ADC
| dev | - The device structure. |
| out_rate_code | - Filter output data rate code. |
| int ad719x_range_setup | ( | struct ad719x_dev * | dev, |
| uint8_t | polarity, | ||
| enum ad719x_adc_gain | gain ) |
Selects the polarity of the conversion and the ADC input range.
Selects the polarity of the conversion and the ADC input range.
| dev | - The device structure. |
| polarity | - Polarity select bit. Example: 0 - bipolar operation is selected. 1 - unipolar operation is selected. |
| gain | - Gain select bits. These bits are written by the user to select the ADC input range. |
| int ad719x_remove | ( | struct ad719x_dev * | dev | ) |
Free the resources allocated by ad719x_init().
Free the resources allocated by ad719x_init().
| dev | - The device structure. |
| int ad719x_reset | ( | struct ad719x_dev * | dev | ) |
Resets the device.
Resets the device.
| dev | - The device structure. |
| int ad719x_set_bridge_switch | ( | struct ad719x_dev * | dev, |
| uint8_t | bpdsw_select ) |
Opens or closes the bridge power-down switch of the ADC.
Opens or closes the bridge power-down switch of the ADC
| dev | - The device structure. |
| bpdsw_select | - Option to open or close bridge power-down switch. 0 - Switch Opened 1 - Switch Closed |
| int ad719x_set_masked_register_value | ( | struct ad719x_dev * | dev, |
| uint8_t | reg_addr, | ||
| uint32_t | mask, | ||
| uint32_t | reg_data, | ||
| uint8_t | bytes ) |
Write masked data into device register.
| dev | - The device structure. |
| reg_addr | - Address of the register. |
| mask | - The mask. |
| reg_data | - Register data to be written. |
| bytes | - Number of bytes that will be read. |
| int ad719x_set_operating_mode | ( | struct ad719x_dev * | dev, |
| enum ad719x_adc_modes | opt_mode ) |
Sets device into the specified operating mode.
Set the device into specified operating mode.
| dev | - The device structure. |
| opt_mode | - Operating mode to be set. Accepted values: AD719X_MODE_CONT AD719X_MODE_SINGLE AD719X_MODE_IDLE AD719X_MODE_PWRDN AD719X_MODE_CAL_INT_ZERO AD719X_MODE_CAL_INT_FULL AD719X_MODE_CAL_SYS_ZERO AD719X_MODE_CAL_SYS_FULL |
| int ad719x_set_register_value | ( | struct ad719x_dev * | dev, |
| uint8_t | reg_addr, | ||
| uint32_t | reg_val, | ||
| uint8_t | bytes_number ) |
Writes data into a register.
Writes data into a register.
| dev | - The device structure. |
| reg_addr | - Address of the register. |
| reg_val | - Data value to write. |
| bytes_number | - Number of bytes to be written. |
| int ad719x_single_conversion | ( | struct ad719x_dev * | dev, |
| uint32_t * | reg_data ) |
Returns the result of a single conversion.
Returns the result of a single conversion.
| dev | - The device structure. |
| reg_data | - Buffer to store sampled register data |
| int ad719x_temperature_read | ( | struct ad719x_dev * | dev, |
| float * | temp ) |
Read data from temperature sensor and converts it to Celsius degrees.
Read data from temperature sensor and converts it to Celsius degrees.
| dev | - The device structure. |
| temp | - Stores the temperature result. |
| int ad719x_wait_rdy_go_low | ( | struct ad719x_dev * | dev | ) |
Waits for RDY pin to go low.
Waits for RDY pin to go low.