![]() |
no-OS
|
Implementation of AD7190/2/3/4/5 Driver. More...
#include <stdlib.h>#include "ad719x.h"#include "no_os_error.h"#include "no_os_delay.h"#include "no_os_alloc.h"#include <string.h>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_val, 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 reg_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 gain) |
| 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. | |
| int | ad719x_sync_control (struct ad719x_dev *dev, uint8_t value) |
| Control SYNC pin for synchronization of multiple devices. | |
Implementation of AD7190/2/3/4/5 Driver.
Copyright 2012(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| int ad719x_buffer_select | ( | struct ad719x_dev * | dev, |
| uint8_t | buff_en ) |
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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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.
| 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().
| dev | - The device structure. |
| int ad719x_reset | ( | struct ad719x_dev * | dev | ) |
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.
| 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.
| 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.
| 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.
| dev | - The device structure. |
| reg_data | - Buffer to store sampled register data |
| int ad719x_sync_control | ( | struct ad719x_dev * | dev, |
| uint8_t | value ) |
Control SYNC pin for synchronization of multiple devices.
| dev | - The device structure. |
| value | - Pin level to be written. 0 - LOW 1 - HIGH |
| int ad719x_temperature_read | ( | struct ad719x_dev * | dev, |
| float * | temp ) |
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.