Example program for EVAL-AD4130
Dependencies: tempsensors sdp_k1_sdram
Implementation of AD4130 IIO application interfaces. More...
Go to the source code of this file.
Functions | |
static int | iio_ad4130_attr_get (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
Getter functions for AD4130 attributes. | |
static int | iio_ad4130_attr_set (void *device, char *buf, uint32_t len, const struct iio_ch_info *channel, intptr_t priv) |
Setter functions for AD4130 attributes. | |
static void | update_vltg_conv_scale_factor (uint8_t chn) |
Update scale factor for adc data to voltage conversion for IIO client. | |
static void | perform_sensor_measurement_and_update_scale (uint32_t adc_raw, uint16_t chn) |
Perform the sensor measurement as per current demo config and update the adc_raw value to sensor conversion scale factor for IIO client. | |
static int | get_calibration_status (char *buf, uint32_t len, uint8_t chn, intptr_t id) |
Getter for the ADC internal/system calibration. | |
static int | set_calibration_routine (char *buf, uint32_t len, uint8_t chn, intptr_t id) |
Setter for the ADC internal/system calibration. | |
static int | get_loadcell_calibration_status (char *buf, uint32_t len, uint8_t chn, intptr_t id) |
Getter for the Loadcell offset/gain calibration. | |
static int | set_loadcell_calibration_status (char *buf, uint32_t len, uint8_t chn, intptr_t id) |
Setter for the Loadcell offset/gain calibration. | |
static int32_t | perform_adc_calibration (uint8_t chn, enum ad413x_adc_mode calib_mode) |
Perform the ADC internal/system calibration. | |
int32_t | debug_reg_read (void *dev, uint32_t reg, uint32_t *readval) |
Read the debug register value. | |
int32_t | debug_reg_write (void *dev, uint32_t reg, uint32_t writeval) |
Write into the debug register. | |
static int32_t | iio_ad4130_submit_buffer (struct iio_device_data *iio_dev_data) |
Read buffer data corresponding to AD4130 ADC IIO device. | |
static int32_t | iio_ad4130_prepare_transfer (void *dev, uint32_t ch_mask) |
Prepare for data transfer. | |
static int32_t | iio_ad4130_end_transfer (void *dev) |
Terminate current data transfer. | |
int32_t | ad4130_iio_init (struct iio_device **desc) |
Init for reading/writing and parameterization of a ad4130 IIO device. | |
int32_t | ad4130_iio_remove (struct iio_desc *desc) |
Release resources allocated for IIO device. | |
int32_t | ad4130_iio_initialize (void) |
Initialize the IIO interface for AD4130 IIO device. | |
void | ad4130_iio_event_handler (void) |
Run the AD4130 IIO event handler. | |
Variables | |
static const char | dev_name [] = ACTIVE_DEVICE_NAME |
Device name. | |
struct ad413x_dev * | ad4130_dev_inst = NULL |
Pointer to the struct representing the AD4130 IIO device. |
Detailed Description
Implementation of AD4130 IIO application interfaces.
This module acts as an interface for AD4130 IIO application
Copyright (c) 2020-2022 Analog Devices, Inc. All rights reserved.
This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.
Definition in file ad4130_iio.c.
Function Documentation
void ad4130_iio_event_handler | ( | void | ) |
Run the AD4130 IIO event handler.
- Returns:
- none
This function monitors the new IIO client event
Definition at line 1151 of file ad4130_iio.c.
int32_t ad4130_iio_init | ( | struct iio_device ** | desc ) |
Init for reading/writing and parameterization of a ad4130 IIO device.
- Parameters:
-
desc[in,out] - IIO device descriptor
- Returns:
- 0 in case of success, negative error code otherwise
Definition at line 1014 of file ad4130_iio.c.
int32_t ad4130_iio_initialize | ( | void | ) |
Initialize the IIO interface for AD4130 IIO device.
- Returns:
- 0 in case of success, negative error code otherwise
Definition at line 1089 of file ad4130_iio.c.
int32_t ad4130_iio_remove | ( | struct iio_desc * | desc ) |
Release resources allocated for IIO device.
- Parameters:
-
desc[in] - IIO device descriptor
- Returns:
- 0 in case of success, negative error code otherwise
Definition at line 1069 of file ad4130_iio.c.
int32_t debug_reg_read | ( | void * | dev, |
uint32_t | reg, | ||
uint32_t * | readval | ||
) |
Read the debug register value.
- Parameters:
-
dev[in]- Pointer to IIO device instance reg[in]- Register address to read from readval[in,out]- Pointer to variable to read data into
- Returns:
- 0 in case of success or negative value otherwise
Definition at line 831 of file ad4130_iio.c.
int32_t debug_reg_write | ( | void * | dev, |
uint32_t | reg, | ||
uint32_t | writeval | ||
) |
Write into the debug register.
- Parameters:
-
dev[in]- Pointer to IIO device instance reg[in]- Register address to write into writeval[in]- Register value to write
- Returns:
- 0 in case of success or negative value otherwise
Definition at line 854 of file ad4130_iio.c.
static int get_calibration_status | ( | char * | buf, |
uint32_t | len, | ||
uint8_t | chn, | ||
intptr_t | id | ||
) | [static] |
Getter for the ADC internal/system calibration.
- Parameters:
-
buf[in]- pointer to buffer holding attribute value len[in]- length of buffer string data chn[in]- ADC channel id[in]- Attribute ID
- Returns:
- Number of characters read/written
Definition at line 605 of file ad4130_iio.c.
static int get_loadcell_calibration_status | ( | char * | buf, |
uint32_t | len, | ||
uint8_t | chn, | ||
intptr_t | id | ||
) | [static] |
Getter for the Loadcell offset/gain calibration.
- Parameters:
-
buf[in]- pointer to buffer holding attribute value len[in]- length of buffer string data chn[in]- ADC channel id[in]- Attribute ID
- Returns:
- Number of characters read/written
Definition at line 758 of file ad4130_iio.c.
static int iio_ad4130_attr_get | ( | void * | device, |
char * | buf, | ||
uint32_t | len, | ||
const struct iio_ch_info * | channel, | ||
intptr_t | priv | ||
) | [static] |
Getter functions for AD4130 attributes.
- Parameters:
-
device[in]- Pointer to IIO device instance buf[in]- IIO input data buffer len[in]- Number of input bytes channel[in] - Input channel priv[in] - Attribute private ID
- Returns:
- 0 in case of success, negative error code otherwise This sampling_frequency attribute is used to define the timeout period in IIO client during data capture. Timeout (1 chn) = (requested samples * sampling frequency) + 1sec Timeout (n chns) = ((requested samples * n) / sampling frequency) + 1sec e.g. If sampling frequency = 31.5KSPS, requested samples = 4000, n=1min or 8max Timeout (1 chn) = (4000 / 315000) + 1 = ~1.13sec Timeout (8 chns) = ((4000 * 8) / 315000) + 1 = ~2.01sec
Definition at line 338 of file ad4130_iio.c.
static int iio_ad4130_attr_set | ( | void * | device, |
char * | buf, | ||
uint32_t | len, | ||
const struct iio_ch_info * | channel, | ||
intptr_t | priv | ||
) | [static] |
Setter functions for AD4130 attributes.
- Parameters:
-
device[in]- Pointer to IIO device instance buf[in]- IIO input data buffer len[in]- Number of input bytes channel[in] - Input channel priv[in] - Attribute private ID
- Returns:
- 0 in case of success, negative error code otherwise
Definition at line 439 of file ad4130_iio.c.
static int32_t iio_ad4130_end_transfer | ( | void * | dev ) | [static] |
Terminate current data transfer.
- Parameters:
-
dev[in] - IIO device instance
- Returns:
- 0 in case of success or negative value otherwise
Definition at line 913 of file ad4130_iio.c.
static int32_t iio_ad4130_prepare_transfer | ( | void * | dev, |
uint32_t | ch_mask | ||
) | [static] |
Prepare for data transfer.
- Parameters:
-
dev[in] - IIO device instance ch_mask[in] - Channels select mask
- Returns:
- 0 in case of success or negative value otherwise
Definition at line 902 of file ad4130_iio.c.
static int32_t iio_ad4130_submit_buffer | ( | struct iio_device_data * | iio_dev_data ) | [static] |
Read buffer data corresponding to AD4130 ADC IIO device.
- Parameters:
-
iio_dev_data[in] - IIO device data instance
- Returns:
- 0 in case of success or negative value otherwise
Definition at line 875 of file ad4130_iio.c.
static int32_t perform_adc_calibration | ( | uint8_t | chn, |
enum ad413x_adc_mode | calib_mode | ||
) | [static] |
Perform the ADC internal/system calibration.
- Parameters:
-
chn[in] - ADC channel calib_mode[in] - ADC calibration mode
- Returns:
- 0 in case of success, negative error code otherwise
Definition at line 474 of file ad4130_iio.c.
static void perform_sensor_measurement_and_update_scale | ( | uint32_t | adc_raw, |
uint16_t | chn | ||
) | [static] |
Perform the sensor measurement as per current demo config and update the adc_raw value to sensor conversion scale factor for IIO client.
- Parameters:
-
adc_raw[in] - ADC raw value chn[in] - ADC channel
- Returns:
- none
Definition at line 925 of file ad4130_iio.c.
static int set_calibration_routine | ( | char * | buf, |
uint32_t | len, | ||
uint8_t | chn, | ||
intptr_t | id | ||
) | [static] |
Setter for the ADC internal/system calibration.
- Parameters:
-
buf[in]- pointer to buffer holding attribute value len[in]- length of buffer string data chn[in]- ADC channel id[in]- Attribute ID
- Returns:
- Number of characters read/written
Definition at line 675 of file ad4130_iio.c.
static int set_loadcell_calibration_status | ( | char * | buf, |
uint32_t | len, | ||
uint8_t | chn, | ||
intptr_t | id | ||
) | [static] |
Setter for the Loadcell offset/gain calibration.
- Parameters:
-
buf[in]- pointer to buffer holding attribute value len[in]- length of buffer string data chn[in]- ADC channel id[in]- Attribute ID
- Returns:
- Number of characters read/written
Definition at line 785 of file ad4130_iio.c.
static void update_vltg_conv_scale_factor | ( | uint8_t | chn ) | [static] |
Update scale factor for adc data to voltage conversion for IIO client.
- Parameters:
-
chn[in] - Input channel
- Returns:
- none
Definition at line 968 of file ad4130_iio.c.
Variable Documentation
struct ad413x_dev* ad4130_dev_inst = NULL |
Pointer to the struct representing the AD4130 IIO device.
Definition at line 124 of file ad4130_iio.c.
const char dev_name[] = ACTIVE_DEVICE_NAME [static] |
Device name.
Definition at line 119 of file ad4130_iio.c.
Generated on Wed Jul 20 2022 12:42:25 by 1.7.2