no-OS
|
Header file of AD7768 Driver. More...
Go to the source code of this file.
Classes | |
struct | ad7768_freq_config |
struct | ad7768_avail_freq |
struct | ad7768_dev |
struct | ad7768_init_param |
Header file 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.
#define AD7768_CH_MODE | ( | x | ) | (1 << (x)) |
#define AD7768_CH_MODE_DEC_RATE | ( | x | ) | (((x) & 0x7) << 0) |
#define AD7768_CH_MODE_DEC_RATE_MSK NO_OS_GENMASK(2, 0) |
#define AD7768_CH_MODE_FILTER_TYPE (1 << 3) |
#define AD7768_CH_STANDBY | ( | x | ) | (1 << (x)) |
#define AD7768_DATA_CONTROL_SPI_SYNC NO_OS_BIT(7) |
#define AD7768_DATA_CONTROL_SPI_SYNC_CLEAR 0 |
#define AD7768_DATA_CONTROL_SPI_SYNC_MSK NO_OS_BIT(7) |
#define AD7768_DATA_CTRL_SINGLE_SHOT_EN (1 << 4) |
#define AD7768_DATA_CTRL_SPI_RESET | ( | x | ) | (((x) & 0x3) << 0) |
#define AD7768_DATA_CTRL_SPI_SYNC (1 << 7) |
#define AD7768_INTERFACE_CFG_CRC_SEL | ( | x | ) | (((x) & 0x3) << 2) |
#define AD7768_INTERFACE_CFG_DCLK_DIV | ( | x | ) | (((x) & 0x3) << 0) |
#define AD7768_INTERFACE_CFG_DCLK_DIV_MODE | ( | x | ) | (4 - no_os_find_first_set_bit(x)) |
#define AD7768_INTERFACE_CFG_DCLK_DIV_MSK NO_OS_GENMASK(1, 0) |
#define ad7768_map_power_mode_to_regval | ( | x | ) | ((x) ? ((x) + 1) : 0) |
#define AD7768_MAX_DCLK_DIV 8 |
#define AD7768_MAX_FREQ_PER_MODE 6 |
#define AD7768_NUM_CHANNELS 8 |
#define AD7768_PWR_MODE_LVDS_ENABLE (1 << 3) |
#define AD7768_PWR_MODE_MCLK_DIV | ( | x | ) | (((x) & 0x3) << 0) |
#define AD7768_PWR_MODE_MCLK_DIV_MSK NO_OS_GENMASK(1, 0) |
#define AD7768_PWR_MODE_POWER_MODE | ( | x | ) | (((x) & 0x3) << 4) |
#define AD7768_PWR_MODE_POWER_MODE_MSK NO_OS_GENMASK(5, 4) |
#define AD7768_PWR_MODE_SLEEP_MODE (1 << 7) |
#define AD7768_REG_BIST_CTRL 0x08 |
#define AD7768_REG_CH_GAIN_1 | ( | ch | ) | (0x36 + (ch) * 3) |
#define AD7768_REG_CH_GAIN_2 | ( | ch | ) | (0x37 + (ch) * 3) |
#define AD7768_REG_CH_GAIN_3 | ( | ch | ) | (0x38 + (ch) * 3) |
#define AD7768_REG_CH_MODE_A 0x01 |
#define AD7768_REG_CH_MODE_B 0x02 |
#define AD7768_REG_CH_MODE_SEL 0x03 |
#define AD7768_REG_CH_OFFSET_1 | ( | ch | ) | (0x1E + (ch) * 3) |
#define AD7768_REG_CH_OFFSET_2 | ( | ch | ) | (0x1F + (ch) * 3) |
#define AD7768_REG_CH_OFFSET_3 | ( | ch | ) | (0x20 + (ch) * 3) |
#define AD7768_REG_CH_STANDBY 0x00 |
#define AD7768_REG_CH_SYNC_OFFSET | ( | ch | ) | (0x4E + (ch) * 3) |
#define AD7768_REG_DATA_CTRL 0x06 |
#define AD7768_REG_DEV_ID_LSB 0x0C |
#define AD7768_REG_DEV_ID_MSB 0x0B |
#define AD7768_REG_DEV_STATUS 0x09 |
#define AD7768_REG_DIAG_CHOP_CTRL 0x59 |
#define AD7768_REG_DIAG_CTRL 0x57 |
#define AD7768_REG_DIAG_METER_RX 0x56 |
#define AD7768_REG_DIAG_MOD_DELAY_CTRL 0x58 |
#define AD7768_REG_GENERAL_CFG 0x05 |
#define AD7768_REG_GPIO_CTRL 0x0E |
#define AD7768_REG_GPIO_RD_DATA 0x10 |
#define AD7768_REG_GPIO_WR_DATA 0x0F |
#define AD7768_REG_INTERFACE_CFG 0x07 |
#define AD7768_REG_NEG_REF_BUF 0x14 |
#define AD7768_REG_POS_REF_BUF 0x13 |
#define AD7768_REG_PRECHARGE_BUF_1 0x11 |
#define AD7768_REG_PRECHARGE_BUF_2 0x12 |
#define AD7768_REG_PWR_MODE 0x04 |
#define AD7768_REG_REV_ID 0x0A |
#define AD7768_REG_SW_REV_ID 0x0D |
#define AD7768_RESOLUTION 24 |
#define AD7768_SAMPLE_SIZE 32 |
enum ad7768_ch |
enum ad7768_ch_mode |
enum ad7768_ch_state |
enum ad7768_conv_op |
enum ad7768_crc_sel |
enum ad7768_dclk_div |
enum ad7768_dec_rate |
enum ad7768_filt_type |
enum ad7768_mclk_div |
enum ad7768_pin_spi_ctrl |
enum ad7768_power_mode |
enum ad7768_sleep_mode |
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_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. |