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. More... | |
int | ad4858_reg_read (struct ad4858_dev *dev, uint32_t reg_addr, uint32_t *reg_val) |
Read device register. More... | |
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. More... | |
int | ad4858_set_operating_mode (struct ad4858_dev *dev, enum ad4858_operating_mode mode) |
Set the device operating mode. More... | |
int | ad4858_set_spi_data_mode (struct ad4858_dev *dev, enum ad4858_spi_data_mode mode) |
Set the SPI data mode. More... | |
int | ad4858_set_config_interface_mode (struct ad4858_dev *dev) |
Set device config interface mode. More... | |
int | ad4858_set_data_interface_mode (struct ad4858_dev *dev) |
Set device data interface mode. More... | |
int | ad4858_enable_osr (struct ad4858_dev *dev, bool osr_status) |
Enable OSR. More... | |
int | ad4858_set_osr_ratio (struct ad4858_dev *dev, enum ad4858_osr_ratio osr_ratio) |
Set OSR ratio. More... | |
int | ad4858_set_packet_format (struct ad4858_dev *dev, enum ad4858_packet_format packet_format) |
Set packet format. More... | |
int | ad4858_enable_test_pattern (struct ad4858_dev *dev, bool test_pattern) |
Enable/Disable test pattern on ADC data output. More... | |
int | ad4858_enable_ch_sleep (struct ad4858_dev *dev, uint8_t chn, enum ad4858_ch_sleep_value sleep_status) |
Enable/Disable channel sleep. More... | |
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. More... | |
int | ad4858_set_chn_softspan (struct ad4858_dev *dev, uint8_t chn, enum ad4858_chn_softspan chn_softspan) |
Set channel softspan. More... | |
int | ad4858_set_chn_offset (struct ad4858_dev *dev, uint8_t chn, uint32_t offset) |
Set channel offset. More... | |
int | ad4858_set_chn_gain (struct ad4858_dev *dev, uint8_t chn, uint16_t gain) |
Set channel gain. More... | |
int | ad4858_set_chn_phase (struct ad4858_dev *dev, uint8_t chn, uint16_t phase) |
Set channel phase. More... | |
int | ad4858_set_chn_or_limit (struct ad4858_dev *dev, uint8_t chn, uint32_t or_limit) |
Set channel overrange (OR) limit. More... | |
int | ad4858_set_chn_ur_limit (struct ad4858_dev *dev, uint8_t chn, uint32_t ur_limit) |
Set channel underrange (UR) limit. More... | |
int | ad4858_convst (struct ad4858_dev *dev) |
Toggle the CNV pin to start a conversion. More... | |
int | ad4858_perform_conv (struct ad4858_dev *dev) |
Perform ADC conversion. More... | |
int | ad4858_spi_data_read (struct ad4858_dev *dev, struct ad4858_conv_data *data) |
Read ADC conversion data over SPI. More... | |
int | ad4858_read_data (struct ad4858_dev *dev, struct ad4858_conv_data *data) |
Read ADC data (for all channels). More... | |
int | ad4858_soft_reset (struct ad4858_dev *dev) |
Perform an AD4858 software reset. More... | |
int | ad4858_init (struct ad4858_dev **device, struct ad4858_init_param *init_param) |
Initialize an AD4858 device structure. More... | |
int | ad4858_remove (struct ad4858_dev *dev) |
Remove an AD4858 device (free memory allocated by ad4858_init function). More... | |
Source file for the ad4858 drivers.
Header file for the ad4858 drivers.
Copyright 2023(c) Analog Devices, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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. |