![]() |
no-OS
|
Implementation of AD4110 Driver. More...
#include <stdio.h>#include <stdlib.h>#include "ad4110.h"#include "no_os_util.h"#include "no_os_alloc.h"#include "no_os_error.h"#include "no_os_irq.h"#include "no_os_print_log.h"#include <string.h>Functions | |
| uint8_t | ad4110_compute_crc8 (uint8_t *data, uint8_t data_size) |
| uint8_t | ad4110_compute_xor (uint8_t *data, uint8_t data_size) |
| int32_t | ad4110_spi_int_reg_write_msk (struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t data, uint16_t mask) |
| int32_t | ad4110_set_adc_mode (struct ad4110_dev *dev, enum ad4110_adc_mode mode) |
| int32_t | ad4110_set_gain (struct ad4110_dev *dev, enum ad4110_gain gain) |
| int32_t | ad4110_set_adc_clk (struct ad4110_dev *dev, enum ad4110_adc_clk_sel clk) |
| int32_t | ad4110_set_afe_clk (struct ad4110_dev *dev, enum ad4110_afe_clk_cfg clk) |
| int32_t | ad4110_set_reference (struct ad4110_dev *dev, enum ad4110_voltage_reference ref) |
| int32_t | ad4110_set_op_mode (struct ad4110_dev *dev, enum ad4110_op_mode mode) |
| int32_t | ad4110_spi_do_soft_reset (struct ad4110_dev *dev) |
| uint8_t | ad4110_get_data_size (struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr) |
| int32_t | ad4110_spi_int_reg_write (struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t reg_data) |
| int32_t | ad4110_spi_int_data_reg_read (struct ad4110_dev *dev, uint32_t *reg_data) |
| int32_t | ad4110_spi_int_reg_read (struct ad4110_dev *dev, uint8_t reg_map, uint8_t reg_addr, uint32_t *reg_data) |
| int | ad4110_set_channel_status (struct ad4110_dev *dev, uint8_t chan_id, bool status) |
| Enable/Disable channel. | |
| int | ad4110_set_analog_input_buffer (struct ad4110_dev *dev, enum ad4110_ain_buffer buffer) |
| Assign analog input buffer. | |
| int | ad4110_set_bipolar (struct ad4110_dev *dev, bool bipolar) |
| Set polarity. | |
| int | ad4110_set_odr (struct ad4110_dev *dev, enum ad4110_odr odr) |
| Set Output Data Rate. | |
| int | ad4110_set_order (struct ad4110_dev *dev, enum ad4110_order order) |
| Set Order of Filter. | |
| int | ad4110_wait_for_rdy_low (struct ad4110_dev *dev, uint32_t timeout) |
| Wait for RDY bit to go low indicating conversion completion. | |
| int | ad4110_do_single_read (struct ad4110_dev *dev, uint32_t *buffer) |
| ADC data read in single conversion mode. | |
| int32_t | ad4110_setup (struct ad4110_dev **device, struct ad4110_init_param init_param) |
| int32_t | ad4110_continuous_read (struct ad4110_dev *dev, uint32_t *buffer, uint32_t buffer_size) |
| int32_t | ad4110_remove (struct ad4110_dev *dev) |
| Free the resources allocated by ad4110_setup(). | |
Implementation of AD4110 Driver.
Copyright 2021(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| uint8_t ad4110_compute_crc8 | ( | uint8_t * | data, |
| uint8_t | data_size ) |
Compute CRC8 checksum.
| data | - The data buffer. |
| data_size | - The size of the data buffer. |
| uint8_t ad4110_compute_xor | ( | uint8_t * | data, |
| uint8_t | data_size ) |
Compute XOR checksum.
| data | - The data buffer. |
| data_size | - The size of the data buffer. |
| int32_t ad4110_continuous_read | ( | struct ad4110_dev * | dev, |
| uint32_t * | buffer, | ||
| uint32_t | buffer_size ) |
ADC continuous read fills buffer with buffer_size number of samples.
| dev | - The device structure. |
| buffer | - The buffer. |
| buffer_size | - The buffer size = number of samples. |
| int ad4110_do_single_read | ( | struct ad4110_dev * | dev, |
| uint32_t * | buffer ) |
ADC data read in single conversion mode.
| dev | - The device structure. |
| buffer | - The data buffer. |
| uint8_t ad4110_get_data_size | ( | struct ad4110_dev * | dev, |
| uint8_t | reg_map, | ||
| uint8_t | reg_addr ) |
Get the data size of a specified register.
| dev | - The device structure. |
| reg_map | - The register map. Accepted values: A4110_ADC A4110_AFE |
| reg_addr | - The register address. |
| int32_t ad4110_remove | ( | struct ad4110_dev * | dev | ) |
Free the resources allocated by ad4110_setup().
| dev | - The device structure. |
| int32_t ad4110_set_adc_clk | ( | struct ad4110_dev * | dev, |
| enum ad4110_adc_clk_sel | clk ) |
Set ADC clock.
| dev | - The device structure. |
| clk | - The clock mode. Accepted values: AD4110_ADC_INT_CLK AD4110_ADC_INT_CLK_CLKIO AD4110_ADC_EXT_CLK |
| int32_t ad4110_set_adc_mode | ( | struct ad4110_dev * | dev, |
| enum ad4110_adc_mode | mode ) |
Set the mode of the ADC.
| dev | - The device structure. |
| mode | - The ADC mode Accepted values: AD4110_CONTINOUS_CONV_MODE AD4110_SINGLE_CONV_MODE AD4110_STANDBY_MODE AD4110_PW_DOWN_MODE AD4110_SYS_OFFSET_CAL AD4110_SYS_GAIN_CAL |
| int32_t ad4110_set_afe_clk | ( | struct ad4110_dev * | dev, |
| enum ad4110_afe_clk_cfg | clk ) |
Set AFE clock.
| dev | - The device structure. |
| clk | - The clock mode. Accepted values: AD4110_AFE_INT_CLOCK AD4110_AFE_ADC_CLOCKED |
| int ad4110_set_analog_input_buffer | ( | struct ad4110_dev * | dev, |
| enum ad4110_ain_buffer | buffer ) |
Assign analog input buffer.
| dev | - The device structure. |
| buffer | - Choice of analog input buffer to be set |
| int ad4110_set_bipolar | ( | struct ad4110_dev * | dev, |
| bool | bipolar ) |
Set polarity.
| dev | - The device structure. |
| bipolar | - True in case of Bipolar/ False in case of Unipolar |
| int ad4110_set_channel_status | ( | struct ad4110_dev * | dev, |
| uint8_t | chan_id, | ||
| bool | status ) |
Enable/Disable channel.
| dev | - The device structure. |
| chan_id | - Channel ID (number) |
| status | - Channel Status (True for Enable and False for Disable) |
| int32_t ad4110_set_gain | ( | struct ad4110_dev * | dev, |
| enum ad4110_gain | gain ) |
Set the gain.
| dev | - The device structure. |
| gain | - The gain value. Accepted values: AD4110_GAIN_0_2 AD4110_GAIN_0_25 AD4110_GAIN_0_3 AD4110_GAIN_0_375 AD4110_GAIN_0_5 AD4110_GAIN_0_75 AD4110_GAIN_1 AD4110_GAIN_1_5 AD4110_GAIN_2 AD4110_GAIN_3 AD4110_GAIN_4 AD4110_GAIN_6 AD4110_GAIN_8 AD4110_GAIN_12 AD4110_GAIN_16 AD4110_GAIN_24 |
| int ad4110_set_odr | ( | struct ad4110_dev * | dev, |
| enum ad4110_odr | odr ) |
Set Output Data Rate.
| dev | - The device structure. |
| odr | - Choice of ODR to be set |
| int32_t ad4110_set_op_mode | ( | struct ad4110_dev * | dev, |
| enum ad4110_op_mode | mode ) |
Set the operation mode.
| dev | - The device structure. |
| mode | - The operation mode type. Accepted values: AD4110_VOLTAGE_MODE AD4110_CURRENT_MODE AD4110_CURRENT_MODE_EXT_R_SEL AD4110_THERMOCOUPLE AD4110_FLD_POWER_MODE AD4110_RTD_2W_MODE AD4110_RTD_3W_MODE AD4110_RTD_4W_MODE |
| int ad4110_set_order | ( | struct ad4110_dev * | dev, |
| enum ad4110_order | order ) |
Set Order of Filter.
| dev | - The device structure. |
| order | - Choice of order to be set |
| int32_t ad4110_set_reference | ( | struct ad4110_dev * | dev, |
| enum ad4110_voltage_reference | ref ) |
Set the voltage reference.
| dev | - The device structure. |
| ref | - The voltage reference. Accepted values: AD4110_EXT_REF AD4110_INT_2_5V_REF AD4110_AVDD5_REF |
| int32_t ad4110_setup | ( | struct ad4110_dev ** | device, |
| struct ad4110_init_param | init_param ) |
Initialize the device.
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
| int32_t ad4110_spi_do_soft_reset | ( | struct ad4110_dev * | dev | ) |
Do a SPI software reset.
| dev | - The device structure. |
| int32_t ad4110_spi_int_data_reg_read | ( | struct ad4110_dev * | dev, |
| uint32_t * | reg_data ) |
SPI internal DATA register read from device.
| dev | - The device structure. |
| reg_data | - The register data. |
| int32_t ad4110_spi_int_reg_read | ( | struct ad4110_dev * | dev, |
| uint8_t | reg_map, | ||
| uint8_t | reg_addr, | ||
| uint32_t * | reg_data ) |
SPI internal register read from device.
| dev | - The device structure. |
| reg_map | - The register map. Accepted values: A4110_ADC A4110_AFE |
| reg_addr | - The register address. |
| reg_data | - The register data. |
| int32_t ad4110_spi_int_reg_write | ( | struct ad4110_dev * | dev, |
| uint8_t | reg_map, | ||
| uint8_t | reg_addr, | ||
| uint32_t | reg_data ) |
SPI internal register write to device.
| dev | - The device structure. |
| reg_map | - The register map. Accepted values: A4110_ADC A4110_AFE |
| reg_addr | - The register address. |
| reg_data | - The register data. |
| int32_t ad4110_spi_int_reg_write_msk | ( | struct ad4110_dev * | dev, |
| uint8_t | reg_map, | ||
| uint8_t | reg_addr, | ||
| uint32_t | data, | ||
| uint16_t | mask ) |
SPI internal register write to device using a mask.
| dev | - The device structure. |
| reg_map | - The register map. Accepted values: A4110_ADC A4110_AFE |
| reg_addr | - The register address. |
| data | - The register data. |
| mask | - The mask. |
| int ad4110_wait_for_rdy_low | ( | struct ad4110_dev * | dev, |
| uint32_t | timeout ) |
Wait for RDY bit to go low indicating conversion completion.
| dev | - The device structure. |
| timeout | - ADC conversion timeout |