Implementation of ad7293 Driver. More...
#include <malloc.h>
#include "ad7293.h"
#include "no_os_error.h"
#include "no_os_delay.h"
#include "no_os_alloc.h"
Functions | |
int | ad7293_spi_read (struct ad7293_dev *dev, unsigned int reg, uint16_t *val) |
Reads data from AD7293 over SPI. | |
int | ad7293_spi_write (struct ad7293_dev *dev, unsigned int reg, uint16_t val) |
Writes data to AD7293 over SPI. | |
int | ad7293_spi_update_bits (struct ad7293_dev *dev, unsigned int reg, uint16_t mask, uint16_t val) |
Update AD7293 register. | |
int | ad7293_adc_get_range (struct ad7293_dev *dev, unsigned int ch, uint16_t *range) |
Get the range value for ADC channels. | |
int | ad7293_adc_set_range (struct ad7293_dev *dev, unsigned int ch, uint16_t range) |
Set the range value for ADC channels. | |
int | ad7293_isense_set_gain (struct ad7293_dev *dev, unsigned int ch, uint16_t gain) |
Set the gain value for ISENSE channels. | |
int | ad7293_isense_get_gain (struct ad7293_dev *dev, unsigned int ch, uint16_t *gain) |
Get the gain value for ISENSE channels. | |
int | ad7293_get_offset (struct ad7293_dev *dev, enum ad7293_ch_type type, unsigned int ch, uint16_t *offset) |
Set offset value for specific channel and channel type. | |
int | ad7293_set_offset (struct ad7293_dev *dev, enum ad7293_ch_type type, unsigned int ch, uint16_t offset) |
Set offset value for specific channel and channel type. | |
int | ad7293_dac_write_raw (struct ad7293_dev *dev, unsigned int ch, uint16_t raw) |
Set the DAC output raw value. | |
int | ad7293_ch_read_raw (struct ad7293_dev *dev, enum ad7293_ch_type type, unsigned int ch, uint16_t *raw) |
Read raw value for specific channel and channel type. | |
int | ad7293_soft_reset (struct ad7293_dev *dev) |
Perform software reset. | |
int | ad7293_reset (struct ad7293_dev *dev) |
Perform both hardware and software reset. | |
int | ad7293_init (struct ad7293_dev **device, struct ad7293_init_param *init_param) |
Initializes the ad7293. | |
int | ad7293_remove (struct ad7293_dev *dev) |
AD7293 Resources Deallocation. | |
Implementation of ad7293 Driver.
Copyright 2022(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 ad7293_adc_get_range | ( | struct ad7293_dev * | dev, |
unsigned int | ch, | ||
uint16_t * | range ) |
Get the range value for ADC channels.
dev | - The device structure. |
ch | - the channel number. |
range | - the range value. |
int ad7293_adc_set_range | ( | struct ad7293_dev * | dev, |
unsigned int | ch, | ||
uint16_t | range ) |
Set the range value for ADC channels.
dev | - The device structure. |
ch | - the channel number. |
range | - the range value. |
int ad7293_ch_read_raw | ( | struct ad7293_dev * | dev, |
enum ad7293_ch_type | type, | ||
unsigned int | ch, | ||
uint16_t * | raw ) |
Read raw value for specific channel and channel type.
dev | - The device structure. |
type | - The channel type. |
ch | - the channel number. |
raw | - the raw value read. |
int ad7293_dac_write_raw | ( | struct ad7293_dev * | dev, |
unsigned int | ch, | ||
uint16_t | raw ) |
Set the DAC output raw value.
dev | - The device structure. |
ch | - the channel number. |
raw | - the raw value to be written. |
int ad7293_get_offset | ( | struct ad7293_dev * | dev, |
enum ad7293_ch_type | type, | ||
unsigned int | ch, | ||
uint16_t * | offset ) |
Set offset value for specific channel and channel type.
dev | - The device structure. |
type | - The channel type. |
ch | - the channel number. |
offset | - the raw value to be written. |
int ad7293_init | ( | struct ad7293_dev ** | device, |
struct ad7293_init_param * | init_param ) |
Initializes the ad7293.
device | - The device structure. |
init_param | - The structure containing the device initial parameters. |
int ad7293_isense_get_gain | ( | struct ad7293_dev * | dev, |
unsigned int | ch, | ||
uint16_t * | gain ) |
Get the gain value for ISENSE channels.
dev | - The device structure. |
ch | - the channel number. |
gain | - the gain read. |
int ad7293_isense_set_gain | ( | struct ad7293_dev * | dev, |
unsigned int | ch, | ||
uint16_t | gain ) |
Set the gain value for ISENSE channels.
dev | - The device structure. |
ch | - the channel number. |
gain | - the range value. |
int ad7293_remove | ( | struct ad7293_dev * | dev | ) |
AD7293 Resources Deallocation.
dev | - The device structure. |
int ad7293_reset | ( | struct ad7293_dev * | dev | ) |
Perform both hardware and software reset.
dev- | The device structure. |
int ad7293_set_offset | ( | struct ad7293_dev * | dev, |
enum ad7293_ch_type | type, | ||
unsigned int | ch, | ||
uint16_t | offset ) |
Set offset value for specific channel and channel type.
dev | - The device structure. |
type | - The channel type. |
ch | - the channel number. |
offset | - the raw value read. |
int ad7293_soft_reset | ( | struct ad7293_dev * | dev | ) |
Perform software reset.
dev | - The device structure. |
int ad7293_spi_read | ( | struct ad7293_dev * | dev, |
unsigned int | reg, | ||
uint16_t * | val ) |
Reads data from AD7293 over SPI.
dev | - The device structure. |
reg | - The register address. |
val | - Data read from the device. |
int ad7293_spi_update_bits | ( | struct ad7293_dev * | dev, |
unsigned int | reg, | ||
uint16_t | mask, | ||
uint16_t | val ) |
Update AD7293 register.
dev | - The device structure. |
reg | - The register address. |
mask | - Mask for specific register bits to be updated. |
val | - Data written to the device (requires prior bit shifting). |
int ad7293_spi_write | ( | struct ad7293_dev * | dev, |
unsigned int | reg, | ||
uint16_t | val ) |
Writes data to AD7293 over SPI.
dev | - The device structure. |
reg | - The register address. |
val | - Data value to write. |