![]() |
no-OS
|
Source file for the ad4858 drivers. More...
#include <stdio.h>#include <stdlib.h>#include <stdbool.h>#include <string.h>#include "ad4858.h"#include "no_os_delay.h"#include "no_os_print_log.h"Functions | |
| int | ad4858_reg_write (struct ad4858_dev *dev, uint32_t reg_addr, uint32_t reg_val) |
| Write device register. | |
| int | ad4858_reg_read (struct ad4858_dev *dev, uint32_t reg_addr, uint32_t *reg_val) |
| Read device register. | |
| int | ad4858_reg_mask (struct ad4858_dev *dev, uint32_t reg_addr, uint32_t mask, uint32_t reg_val) |
| Update specific register bits of an input register. | |
| int | ad4858_set_operating_mode (struct ad4858_dev *dev, enum ad4858_operating_mode mode) |
| Set the device operating mode. | |
| int | ad4858_set_spi_data_mode (struct ad4858_dev *dev, enum ad4858_spi_data_mode mode) |
| Set the SPI data mode. | |
| int | ad4858_set_config_interface_mode (struct ad4858_dev *dev) |
| Set device config interface mode. | |
| int | ad4858_set_data_interface_mode (struct ad4858_dev *dev) |
| Set device data interface mode. | |
| int | ad4858_enable_osr (struct ad4858_dev *dev, bool osr_status) |
| Enable OSR. | |
| int | ad4858_set_osr_ratio (struct ad4858_dev *dev, enum ad4858_osr_ratio osr_ratio) |
| Set OSR ratio. | |
| int | ad4858_set_packet_format (struct ad4858_dev *dev, enum ad4858_packet_format packet_format) |
| Set packet format. | |
| int | ad4858_enable_test_pattern (struct ad4858_dev *dev, bool test_pattern) |
| Enable/Disable test pattern on ADC data output. | |
| int | ad4858_enable_ch_sleep (struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_sleep_value sleep_status) |
| Enable/Disable channel sleep. | |
| int | ad4858_enable_ch_seamless_hdr (struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_seamless_hdr seamless_hdr_status) |
| Enable/Disable seamless hdr. | |
| int | ad4858_set_chn_softspan (struct ad4858_dev *dev, uint8_t chn, enum ad4858_chn_softspan chn_softspan) |
| Set channel softspan. | |
| int | ad4858_set_chn_offset (struct ad4858_dev *dev, uint8_t chn, uint32_t offset) |
| Set channel offset. | |
| int | ad4858_set_chn_gain (struct ad4858_dev *dev, uint8_t chn, uint16_t gain) |
| Set channel gain. | |
| int | ad4858_set_chn_phase (struct ad4858_dev *dev, uint8_t chn, uint16_t phase) |
| Set channel phase. | |
| int | ad4858_set_chn_or_limit (struct ad4858_dev *dev, uint8_t chn, uint32_t or_limit) |
| Set channel overrange (OR) limit. | |
| int | ad4858_set_chn_ur_limit (struct ad4858_dev *dev, uint8_t chn, uint32_t ur_limit) |
| Set channel underrange (UR) limit. | |
| int | ad4858_convst (struct ad4858_dev *dev) |
| Toggle the CNV pin to start a conversion. | |
| int | ad4858_perform_conv (struct ad4858_dev *dev) |
| Perform ADC conversion. | |
| int | ad4858_spi_data_read (struct ad4858_dev *dev, struct ad4858_conv_data *data) |
| Read ADC conversion data over SPI. | |
| int | ad4858_read_data (struct ad4858_dev *dev, struct ad4858_conv_data *data) |
| Read ADC data (for all channels). | |
| int | ad4858_soft_reset (struct ad4858_dev *dev) |
| Perform an AD4858 software reset. | |
| int | ad4858_init (struct ad4858_dev **device, struct ad4858_init_param *init_param) |
| Initialize an AD4858 device structure. | |
| int | ad4858_remove (struct ad4858_dev *dev) |
| Remove an AD4858 device (free memory allocated by ad4858_init function). | |
Source file for the ad4858 drivers.
Header file for the ad4858 drivers.
Copyright 2023(c) Analog Devices, Inc. SPDX-License-Identifier: BSD-3-Clause
| int ad4858_convst | ( | struct ad4858_dev * | dev | ) |
Toggle the CNV pin to start a conversion.
| dev | - Pointer to the device structure. |
| int ad4858_enable_ch_seamless_hdr | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| enum ad4858_ch_seamless_hdr | seamless_hdr_status ) |
Enable/Disable seamless hdr.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| seamless_hdr_status | - seamless hdr status. |
| int ad4858_enable_ch_sleep | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| enum ad4858_ch_sleep_value | sleep_status ) |
Enable/Disable channel sleep.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| sleep_status | - Sleep status. |
| int ad4858_enable_osr | ( | struct ad4858_dev * | dev, |
| bool | osr_status ) |
Enable OSR.
| dev | - Pointer to the device structure. |
| osr_status | - OSR enable/disable status. |
| int ad4858_enable_test_pattern | ( | struct ad4858_dev * | dev, |
| bool | test_pattern ) |
Enable/Disable test pattern on ADC data output.
| dev | - Pointer to the device structure. |
| test_pattern | - Test pattern enable status. |
| int ad4858_init | ( | struct ad4858_dev ** | device, |
| struct ad4858_init_param * | init_param ) |
Initialize an AD4858 device structure.
| device | - Pointer to the device structure (memory is allocated within this function). |
| init_param | - Pointer to the initialization parameters. |
| int ad4858_perform_conv | ( | struct ad4858_dev * | dev | ) |
Perform ADC conversion.
| dev | - Pointer to the device structure. |
| int ad4858_read_data | ( | struct ad4858_dev * | dev, |
| struct ad4858_conv_data * | data ) |
Read ADC data (for all channels).
| dev | - Pointer to the device structure. |
| data | - Pointer to adc conversion data structure. |
| int ad4858_reg_mask | ( | struct ad4858_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint32_t | mask, | ||
| uint32_t | reg_val ) |
Update specific register bits of an input register.
| dev | - The device structure. |
| reg_addr | - The register address. |
| mask | - Specific bits mask. |
| reg_val | - The data to be written. |
| int ad4858_reg_read | ( | struct ad4858_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint32_t * | reg_val ) |
Read device register.
| dev | - The device structure. |
| reg_addr | - The register address. |
| reg_val | - The data read from the register. |
| int ad4858_reg_write | ( | struct ad4858_dev * | dev, |
| uint32_t | reg_addr, | ||
| uint32_t | reg_val ) |
Write device register.
| dev- | The device structure. |
| reg_addr | - The register address. |
| reg_val | - The data to be written. |
| int ad4858_remove | ( | struct ad4858_dev * | dev | ) |
Remove an AD4858 device (free memory allocated by ad4858_init function).
| dev | - Pointer to the device structure. |
| int ad4858_set_chn_gain | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| uint16_t | gain ) |
Set channel gain.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| gain | - Gain value. |
| int ad4858_set_chn_offset | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| uint32_t | offset ) |
Set channel offset.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| offset | - Offset value. |
| int ad4858_set_chn_or_limit | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| uint32_t | or_limit ) |
Set channel overrange (OR) limit.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| or_limit | - Overrange limit. |
| int ad4858_set_chn_phase | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| uint16_t | phase ) |
Set channel phase.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| phase | - Phase value. |
| int ad4858_set_chn_softspan | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| enum ad4858_chn_softspan | chn_softspan ) |
Set channel softspan.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| chn_softspan | - Softspan value. |
| int ad4858_set_chn_ur_limit | ( | struct ad4858_dev * | dev, |
| uint8_t | chn, | ||
| uint32_t | ur_limit ) |
Set channel underrange (UR) limit.
| dev | - Pointer to the device structure. |
| chn | - Input channel. |
| ur_limit | - Underrange limit. |
| int ad4858_set_config_interface_mode | ( | struct ad4858_dev * | dev | ) |
Set device config interface mode.
| dev | - Pointer to the device structure. |
| int ad4858_set_data_interface_mode | ( | struct ad4858_dev * | dev | ) |
Set device data interface mode.
| dev | - Pointer to the device structure. |
| int ad4858_set_operating_mode | ( | struct ad4858_dev * | dev, |
| enum ad4858_operating_mode | mode ) |
Set the device operating mode.
| dev | - Pointer to the device structure. |
| mode | - Operating mode. |
| int ad4858_set_osr_ratio | ( | struct ad4858_dev * | dev, |
| enum ad4858_osr_ratio | osr_ratio ) |
Set OSR ratio.
| dev | - Pointer to the device structure. |
| osr_ratio | - OSR ratio. |
| int ad4858_set_packet_format | ( | struct ad4858_dev * | dev, |
| enum ad4858_packet_format | packet_format ) |
Set packet format.
| dev | - Pointer to the device structure. |
| packet_format | - Packet format. |
| int ad4858_set_spi_data_mode | ( | struct ad4858_dev * | dev, |
| enum ad4858_spi_data_mode | mode ) |
Set the SPI data mode.
| dev | - Pointer to the device structure. |
| mode | - SPI data mode. |
| int ad4858_soft_reset | ( | struct ad4858_dev * | dev | ) |
Perform an AD4858 software reset.
| dev | - Pointer to the device structure. |
| int ad4858_spi_data_read | ( | struct ad4858_dev * | dev, |
| struct ad4858_conv_data * | data ) |
Read ADC conversion data over SPI.
| dev | - Pointer to the device structure. |
| data | - Pointer to adc conversion data structure. |