no-OS
|
AD717X implementation file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2 AD7177-2, AD4111, AD4112, AD4114, AD4115, AD4116. More...
Macros | |
#define | INVALID_VAL -1 /* Invalid argument */ |
#define | COMM_ERR -2 /* Communication error on receive */ |
#define | TIMEOUT -3 /* A timeout has occured */ |
Functions | |
int | ad717x_set_channel_status (ad717x_dev *device, uint8_t channel_id, bool channel_status) |
Set channel status - Enable/Disable. More... | |
int | ad717x_set_adc_mode (ad717x_dev *device, enum ad717x_mode adc_mode) |
Set ADC Mode. More... | |
int | ad717x_connect_analog_input (ad717x_dev *device, uint8_t channel_id, union ad717x_analog_inputs analog_input) |
Set Analog Inputs to channel. More... | |
int | ad717x_assign_setup (ad717x_dev *device, uint8_t channel_id, uint8_t setup) |
Assign Setup to Channel. More... | |
int | ad717x_set_polarity (ad717x_dev *device, bool bipolar, uint8_t setup_id) |
Set Polarity. More... | |
int | ad717x_set_reference_source (ad717x_dev *device, enum ad717x_reference_source ref_source, uint8_t setup_id) |
Select the reference source. More... | |
int | ad717x_enable_input_buffer (ad717x_dev *device, bool inbuf_en, bool refbuf_en, uint8_t setup_id) |
Enable Input Buffer. More... | |
int | ad717x_single_read (ad717x_dev *device, uint8_t id, int32_t *adc_raw_data) |
Perform Single Conversion. More... | |
ad717x_st_reg * | AD717X_GetReg (ad717x_dev *device, uint8_t reg_address) |
Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address. More... | |
int32_t | AD717X_ReadRegister (ad717x_dev *device, uint8_t addr) |
Reads the value of the specified register. More... | |
int32_t | AD717X_WriteRegister (ad717x_dev *device, uint8_t addr) |
Writes the value of the specified register. More... | |
int32_t | AD717X_Reset (ad717x_dev *device) |
Resets the device. More... | |
int32_t | AD717X_WaitForReady (ad717x_dev *device, uint32_t timeout) |
Waits until a new conversion result is available. More... | |
int32_t | AD717X_ReadData (ad717x_dev *device, int32_t *pData) |
Reads the conversion result from the device. More... | |
int32_t | AD717X_ComputeDataregSize (ad717x_dev *device) |
Computes data register read size to account for bit number and status read. More... | |
uint8_t | AD717X_ComputeCRC8 (uint8_t *pBuf, uint8_t bufSize) |
Computes the CRC checksum for a data buffer. More... | |
uint8_t | AD717X_ComputeXOR8 (uint8_t *pBuf, uint8_t bufSize) |
Computes the XOR checksum for a data buffer. More... | |
int32_t | AD717X_UpdateCRCSetting (ad717x_dev *device) |
Updates the CRC settings. More... | |
int32_t | ad717x_configure_device_odr (ad717x_dev *dev, uint8_t filtcon_id, uint8_t odr_sel) |
Configure ODR for the device. More... | |
int32_t | AD717X_Init (ad717x_dev **device, ad717x_init_param init_param) |
Initializes the AD717X. More... | |
int32_t | AD717X_remove (ad717x_dev *dev) |
Free the resources allocated by AD717X_Init(). More... | |
AD717X implementation file. Devices: AD7172-2, AD7172-4, AD7173-8, AD7175-2, AD7175-8, AD7176-2 AD7177-2, AD4111, AD4112, AD4114, AD4115, AD4116.
Copyright 2015(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.
#define COMM_ERR -2 /* Communication error on receive */ |
#define INVALID_VAL -1 /* Invalid argument */ |
#define TIMEOUT -3 /* A timeout has occured */ |
int ad717x_assign_setup | ( | ad717x_dev * | device, |
uint8_t | channel_id, | ||
uint8_t | setup | ||
) |
Assign Setup to Channel.
device | - AD717x Device Descriptor |
channel_id | - Channel ID (number) |
setup | - Setup ID (number) |
uint8_t AD717X_ComputeCRC8 | ( | uint8_t * | pBuf, |
uint8_t | bufSize | ||
) |
Computes the CRC checksum for a data buffer.
pBuf | - Data buffer |
bufSize | - Data buffer size in bytes |
int32_t AD717X_ComputeDataregSize | ( | ad717x_dev * | device | ) |
Computes data register read size to account for bit number and status read.
device | - The handler of the instance of the driver. |
uint8_t AD717X_ComputeXOR8 | ( | uint8_t * | pBuf, |
uint8_t | bufSize | ||
) |
Computes the XOR checksum for a data buffer.
pBuf | - Data buffer |
bufSize | - Data buffer size in bytes |
int32_t ad717x_configure_device_odr | ( | ad717x_dev * | dev, |
uint8_t | filtcon_id, | ||
uint8_t | odr_sel | ||
) |
Configure ODR for the device.
dev | - The AD717x Device descriptor |
filtcon_id | - Filter Configuration Register ID (Number) |
odr_sel | - ODR[4:0] bitfield value as a decimal |
int ad717x_connect_analog_input | ( | ad717x_dev * | device, |
uint8_t | channel_id, | ||
union ad717x_analog_inputs | analog_input | ||
) |
Set Analog Inputs to channel.
device | - AD717x Device Descriptor |
channel_id | - Channel whose Analog input is to be configured |
analog_input | - Analog Inputs to the Channel |
int ad717x_enable_input_buffer | ( | ad717x_dev * | device, |
bool | inbuf_en, | ||
bool | refbuf_en, | ||
uint8_t | setup_id | ||
) |
Enable Input Buffer.
device | - AD717x Device Descriptor |
inbuf_en | - Enable Inpur Buffer |
refbuf_en | - Enable referece Buffer |
setup_id | - Setup ID (Number) |
ad717x_st_reg* AD717X_GetReg | ( | ad717x_dev * | device, |
uint8_t | reg_address | ||
) |
Searches through the list of registers of the driver instance and retrieves a pointer to the register that matches the given address.
device | - The handler of the instance of the driver. |
reg_address | - The address to be used to find the register. |
int32_t AD717X_Init | ( | ad717x_dev ** | device, |
ad717x_init_param | init_param | ||
) |
Initializes the AD717X.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t AD717X_ReadData | ( | ad717x_dev * | device, |
int32_t * | pData | ||
) |
Reads the conversion result from the device.
device | - The handler of the instance of the driver. |
pData | - Pointer to store the read data. |
int32_t AD717X_ReadRegister | ( | ad717x_dev * | device, |
uint8_t | addr | ||
) |
Reads the value of the specified register.
device | - The handler of the instance of the driver. |
addr | - The address of the register to be read. The value will be stored inside the register structure that holds info about this register. |
int32_t AD717X_remove | ( | ad717x_dev * | dev | ) |
Free the resources allocated by AD717X_Init().
dev | - The device structure. |
int32_t AD717X_Reset | ( | ad717x_dev * | device | ) |
Resets the device.
device | - The handler of the instance of the driver. |
int ad717x_set_adc_mode | ( | ad717x_dev * | device, |
enum ad717x_mode | adc_mode | ||
) |
Set ADC Mode.
device | - AD717x Device Descriptor |
adc_mode | - ADC Mode to be configured |
int ad717x_set_channel_status | ( | ad717x_dev * | device, |
uint8_t | channel_id, | ||
bool | channel_status | ||
) |
Set channel status - Enable/Disable.
device | - AD717x Device descriptor. |
channel_id | - Channel ID (number) of the channel whose status is to be set. |
channel_status | - Required status of the channel-True in case of Enable and False in case of Disable |
int ad717x_set_polarity | ( | ad717x_dev * | device, |
bool | bipolar, | ||
uint8_t | setup_id | ||
) |
Set Polarity.
device | - AD717x Device Descriptor |
bipolar | - Polarity Select:True in case of Bipolar, False in case of Unipolar |
setup_id | - Setup ID (number) |
int ad717x_set_reference_source | ( | ad717x_dev * | device, |
enum ad717x_reference_source | ref_source, | ||
uint8_t | setup_id | ||
) |
Select the reference source.
device | - AD717x Device Descriptor |
ref_source | - Reference source |
setup_id | - Setup ID (Number) |
int ad717x_single_read | ( | ad717x_dev * | device, |
uint8_t | id, | ||
int32_t * | adc_raw_data | ||
) |
Perform Single Conversion.
device | - AD717x Device Descriptor |
id | - Channel ID (number) requested |
adc_raw_data | ADC Raw Value |
int32_t AD717X_UpdateCRCSetting | ( | ad717x_dev * | device | ) |
Updates the CRC settings.
device | - The handler of the instance of the driver. |
int32_t AD717X_WaitForReady | ( | ad717x_dev * | device, |
uint32_t | timeout | ||
) |
Waits until a new conversion result is available.
device | - The handler of the instance of the driver. |
timeout | - Count representing the number of polls to be done until the function returns if no new data is available. |
int32_t AD717X_WriteRegister | ( | ad717x_dev * | device, |
uint8_t | addr | ||
) |
Writes the value of the specified register.
device | - The handler of the instance of the driver. |
addr | - The address of the register to be written with the value stored inside the register structure that holds info about this register. |