no-OS
|
Implementation of AD7768 Driver. More...
#include <stdio.h>
#include <stdlib.h>
#include "ad7768.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_util.h"
Variables | |
const uint8_t | standard_pin_ctrl_mode_sel [3][4] |
const uint8_t | one_shot_pin_ctrl_mode_sel [3][4] |
Implementation of AD7768 Driver.
Copyright 2016(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.
int32_t ad7768_get_ch_mode | ( | ad7768_dev * | dev, |
ad7768_ch | ch, | ||
ad7768_ch_mode * | mode | ||
) |
Get the channel mode.
dev | - The device structure. |
ch | - The channel number. Accepted values: AD7768_CH0 AD7768_CH1 AD7768_CH2 AD7768_CH3 AD7768_CH4 AD7768_CH5 AD7768_CH6 AD7768_CH7 |
mode | - The channel mode. |
int32_t ad7768_get_ch_state | ( | ad7768_dev * | dev, |
ad7768_ch | ch, | ||
ad7768_ch_state * | state | ||
) |
Get the channel state.
dev | - The device structure. |
ch | - The channel number. Accepted values: AD7768_CH0 AD7768_CH1 AD7768_CH2 AD7768_CH3 AD7768_CH4 AD7768_CH5 AD7768_CH6 AD7768_CH7 |
state | - The channel state. |
int32_t ad7768_get_conv_op | ( | ad7768_dev * | dev, |
ad7768_conv_op * | conv_op | ||
) |
Get the conversion operation mode.
dev | - The device structure. |
conv_op | - The conversion operation mode. |
int32_t ad7768_get_crc_sel | ( | ad7768_dev * | dev, |
ad7768_crc_sel * | crc_sel | ||
) |
Get the CRC selection.
dev | - The device structure. |
crc_sel | - The CRC selection. |
int32_t ad7768_get_dclk_div | ( | ad7768_dev * | dev, |
ad7768_dclk_div * | clk_div | ||
) |
Get the DCLK divider.
dev | - The device structure. |
clk_div | - The DCLK divider. |
int32_t ad7768_get_mclk_div | ( | ad7768_dev * | dev, |
ad7768_mclk_div * | clk_div | ||
) |
Get the MCLK divider.
dev | - The device structure. |
clk_div | - The MCLK divider. |
int32_t ad7768_get_mode_config | ( | ad7768_dev * | dev, |
ad7768_ch_mode | mode, | ||
ad7768_filt_type * | filt_type, | ||
ad7768_dec_rate * | dec_rate | ||
) |
Get the mode configuration.
dev | - The device structure. |
mode | - The channel mode. |
filt_type | - The filter type. |
dec_rate | - The decimation rate. |
int32_t ad7768_get_power_mode | ( | ad7768_dev * | dev, |
ad7768_power_mode * | mode | ||
) |
Get the device power mode.
dev | - The device structure. |
mode | - The device power mode. |
int32_t ad7768_get_sleep_mode | ( | ad7768_dev * | dev, |
ad7768_sleep_mode * | mode | ||
) |
Get the device sleep mode.
dev | - The device structure. |
mode | - The device sleep mode. |
int ad7768_remove | ( | ad7768_dev * | dev | ) |
Free the resources allocated by ad7768_setup().
dev | - The device structure. |
void ad7768_set_available_sampl_freq | ( | ad7768_dev * | dev | ) |
Set available sampling frequency.
dev | - The device structure. |
int32_t ad7768_set_ch_mode | ( | ad7768_dev * | dev, |
ad7768_ch | ch, | ||
ad7768_ch_mode | mode | ||
) |
Set the channel mode.
dev | - The device structure. |
ch | - The channel number. Accepted values: AD7768_CH0 AD7768_CH1 AD7768_CH2 AD7768_CH3 AD7768_CH4 AD7768_CH5 AD7768_CH6 AD7768_CH7 |
mode | - The channel mode. Accepted values: AD7768_MODE_A AD7768_MODE_B |
int32_t ad7768_set_ch_state | ( | ad7768_dev * | dev, |
ad7768_ch | ch, | ||
ad7768_ch_state | state | ||
) |
Set the channel state.
dev | - The device structure. |
ch | - The channel number. Accepted values: AD7768_CH0 AD7768_CH1 AD7768_CH2 AD7768_CH3 AD7768_CH4 AD7768_CH5 AD7768_CH6 AD7768_CH7 |
state | - The channel state. Accepted values: AD7768_ENABLED AD7768_STANDBY |
int32_t ad7768_set_conv_op | ( | ad7768_dev * | dev, |
ad7768_conv_op | conv_op | ||
) |
Set the conversion operation mode.
dev | - The device structure. |
conv_op | - The conversion operation mode. Accepted values: AD7768_STANDARD_CONV AD7768_ONE_SHOT_CONV |
int32_t ad7768_set_crc_sel | ( | ad7768_dev * | dev, |
ad7768_crc_sel | crc_sel | ||
) |
Set the CRC selection.
dev | - The device structure. |
crc_sel | - The CRC selection. Accepted values: AD7768_NO_CRC AD7768_CRC_4 AD7768_CRC_16 |
int32_t ad7768_set_dclk_div | ( | ad7768_dev * | dev, |
ad7768_dclk_div | clk_div | ||
) |
Set the DCLK divider.
dev | - The device structure. |
clk_div | - The DCLK divider. Accepted values: AD7768_DCLK_DIV_1 AD7768_DCLK_DIV_2 AD7768_DCLK_DIV_4 AD7768_DCLK_DIV_8 |
int32_t ad7768_set_mclk_div | ( | ad7768_dev * | dev, |
ad7768_mclk_div | clk_div | ||
) |
Set the MCLK divider.
dev | - The device structure. |
clk_div | - The MCLK divider. Accepted values: AD7768_MCLK_DIV_32 AD7768_MCLK_DIV_8 AD7768_MCLK_DIV_4 |
int32_t ad7768_set_mode_config | ( | ad7768_dev * | dev, |
ad7768_ch_mode | mode, | ||
ad7768_filt_type | filt_type, | ||
ad7768_dec_rate | dec_rate | ||
) |
Set the mode configuration.
dev | - The device structure. |
mode | - The channel mode. Accepted values: AD7768_MODE_A AD7768_MODE_B |
filt_type | - The filter type. Accepted values: AD7768_FILTER_WIDEBAND AD7768_FILTER_SINC, |
dec_rate | - The decimation rate. Accepted values: AD7768_DEC_X32 AD7768_DEC_X64 AD7768_DEC_X128 AD7768_DEC_X256 AD7768_DEC_X512 AD7768_DEC_X1024 |
int32_t ad7768_set_mode_pins | ( | ad7768_dev * | dev, |
uint8_t | state | ||
) |
Internal set MODEx pins function.
dev | - The device structure. |
state | - The state of the MODEx pins. |
int32_t ad7768_set_power_mode | ( | ad7768_dev * | dev, |
ad7768_power_mode | mode | ||
) |
Set the device power mode.
dev | - The device structure. |
mode | - The device power mode. Accepted values: AD7768_ECO AD7768_MEDIAN AD7768_FAST |
int ad7768_set_power_mode_and_sampling_freq | ( | ad7768_dev * | dev, |
enum ad7768_power_modes_raw | mode | ||
) |
Set power mode and sampling frequency.
dev | - The device structure. |
mode | - The required power mode (raw value). |
int32_t ad7768_set_sleep_mode | ( | ad7768_dev * | dev, |
ad7768_sleep_mode | mode | ||
) |
Set the device sleep mode.
dev | - The device structure. |
mode | - The device sleep mode. Accepted values: AD7768_ACTIVE AD7768_SLEEP |
int32_t ad7768_setup | ( | ad7768_dev ** | device, |
ad7768_init_param | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad7768_setup_begin | ( | ad7768_dev ** | device, |
ad7768_init_param | init_param | ||
) |
Begin initializing the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad7768_setup_finish | ( | ad7768_dev * | dev, |
ad7768_init_param | init_param | ||
) |
Finish initializing the device.
dev | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad7768_spi_read | ( | ad7768_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
SPI read from device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
int32_t ad7768_spi_read_mask | ( | ad7768_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t * | data | ||
) |
SPI read from device using a mask.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - The mask. |
data | - The register data. |
int32_t ad7768_spi_write | ( | ad7768_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data | ||
) |
SPI write to device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
int32_t ad7768_spi_write_mask | ( | ad7768_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | mask, | ||
uint8_t | data | ||
) |
SPI write to device using a mask.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - The mask. |
data | - The register data. |
const uint8_t one_shot_pin_ctrl_mode_sel[3][4] |
const uint8_t standard_pin_ctrl_mode_sel[3][4] |