no-OS
|
Header file of AD74413r Driver. More...
Go to the source code of this file.
Classes | |
struct | ad74413r_init_param |
Initialization parameter for the device descriptor. More... | |
struct | ad74413r_decimal |
ADC value format. More... | |
struct | ad74413r_channel_config |
Device channel state. More... | |
struct | _ad74413r_live_status |
Bitfield struct which maps on the LIVE_STATUS register. More... | |
union | ad74413r_live_status |
Used to store the live status bit fields. More... | |
struct | ad74413r_desc |
AD74413r device descriptor. More... | |
Functions | |
int | ad74413r_dac_voltage_to_code (uint32_t, uint32_t *) |
Converts a millivolt value in the corresponding DAC 13 bit code. More... | |
int | ad74413r_range_to_voltage_range (enum ad74413r_adc_range, uint32_t *) |
Convert the measuring range of the ADC from range enum values to millivolts. More... | |
int | ad74413r_range_to_voltage_offset (enum ad74413r_adc_range, int32_t *) |
Convert the measuring range of the ADC from range enum values to millivolts. More... | |
int | ad74413r_reg_write (struct ad74413r_desc *, uint32_t, uint16_t) |
Write a register's value. More... | |
int | ad74413r_reg_read_raw (struct ad74413r_desc *, uint32_t, uint8_t *) |
Read a raw communication frame. More... | |
int | ad74413r_reg_read (struct ad74413r_desc *, uint32_t, uint16_t *) |
Read a register's value. More... | |
int | ad74413r_reg_update (struct ad74413r_desc *, uint32_t, uint16_t, uint16_t) |
Update a register's field. More... | |
int | ad74413r_nb_active_channels (struct ad74413r_desc *, uint8_t *) |
Get the number of active channels. More... | |
int | ad74413r_clear_errors (struct ad74413r_desc *) |
Clear the ALERT_STATUS register. More... | |
int | ad74413r_set_info (struct ad74413r_desc *desc, uint16_t mode) |
Select which information the device will respond with (in the readback field) when a read operation is performed. More... | |
int | ad74413r_reset (struct ad74413r_desc *) |
Perform either a software or hardware reset and wait for device reset time. More... | |
int | ad74413r_set_channel_function (struct ad74413r_desc *, uint32_t, enum ad74413r_op_mode) |
Set the operation mode for a specific channel. More... | |
int | ad74413r_get_raw_adc_result (struct ad74413r_desc *, uint32_t, uint16_t *) |
Read the raw ADC raw conversion value. More... | |
int | ad74413r_set_adc_channel_enable (struct ad74413r_desc *, uint32_t, bool) |
Enable/disable a specific ADC channel. More... | |
int | ad74413r_set_diag_channel_enable (struct ad74413r_desc *, uint32_t, bool) |
Enable conversions on a diagnostic register. More... | |
int | ad74413r_get_adc_range (struct ad74413r_desc *, uint32_t, uint16_t *) |
Get the ADC measurement range for a specific channel. More... | |
int | ad74413r_get_adc_rejection (struct ad74413r_desc *, uint32_t, enum ad74413r_rejection *) |
Get the rejection setting for a specific channel. More... | |
int | ad74413r_get_adc_diag_rejection (struct ad74413r_desc *, enum ad74413r_rejection *) |
Get the rejection setting for a specific channel. More... | |
int | ad74413r_set_adc_rejection (struct ad74413r_desc *, uint32_t, enum ad74413r_rejection) |
Set the rejection setting for a specific channel. More... | |
int | ad74413r_get_adc_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample *) |
Get the ADC sample rate. More... | |
int | ad74413r_set_adc_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample) |
Set the ADC sample rate. More... | |
int | ad74413r_get_adc_diag_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample *) |
Get the ADC sample rate for the diagnostics channels. More... | |
int | ad74413r_set_adc_diag_rate (struct ad74413r_desc *, uint32_t, enum ad74413r_adc_sample) |
Set the ADC sample rate for the diagnostics channels. More... | |
int | ad74413r_set_adc_conv_seq (struct ad74413r_desc *, enum ad74413r_conv_seq) |
Start or stop ADC conversions. More... | |
int | ad74413r_get_adc_single (struct ad74413r_desc *, uint32_t, uint16_t *, bool) |
Get a single ADC raw value for a specific channel, then power down the ADC. More... | |
int | ad74413r_adc_get_value (struct ad74413r_desc *, uint32_t, struct ad74413r_decimal *) |
Get the ADC real value, according to the operation mode. More... | |
int | ad74413r_get_temp (struct ad74413r_desc *, uint32_t, uint16_t *) |
Read the die's temperature from the diagnostic register. More... | |
int | ad74413r_set_channel_dac_code (struct ad74413r_desc *, uint32_t, uint16_t) |
Set and load a code for the DAC on a specific channel. More... | |
int | ad74413r_set_diag (struct ad74413r_desc *, uint32_t, enum ad74413r_diag_mode) |
Set which diagnostic value to be loaded in the DIAG_RESULT register. More... | |
int | ad74413r_get_diag (struct ad74413r_desc *, uint32_t, uint16_t *) |
Get the diagnostic value for a specific channel. More... | |
int | ad74413r_set_debounce_mode (struct ad74413r_desc *, uint32_t, enum ad74413r_debounce_mode) |
Set the debounce mode for the IOx inputs when the ADC is running in digital input mode. More... | |
int | ad74413r_set_debounce_time (struct ad74413r_desc *, uint32_t, uint32_t) |
Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode. More... | |
int | ad74413r_gpo_get (struct ad74413r_desc *, uint32_t, uint8_t *) |
Get the GPO value for a specific channel. More... | |
int | ad74413r_set_gpo_config (struct ad74413r_desc *, uint32_t, enum ad74413r_gpo_select) |
Set the GPO operation mode. More... | |
int | ad74413r_set_threshold (struct ad74413r_desc *, uint32_t, uint32_t) |
Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode. More... | |
int | ad74413r_gpo_set (struct ad74413r_desc *, uint32_t, uint8_t) |
Set the logic value of a GPO pin. More... | |
int | ad74413r_gpo_set_multiple (struct ad74413r_desc *, uint32_t) |
Set multiple GPO values at once. More... | |
int | ad74413r_get_live (struct ad74413r_desc *, union ad74413r_live_status *) |
Read the live status bits. More... | |
int | ad74413r_set_dac_clear_code (struct ad74413r_desc *, uint32_t, uint16_t) |
The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written. More... | |
int | ad74413r_clear_dac (struct ad74413r_desc *, uint32_t) |
Clear the DAC (to the code in DAC_CLR_CODE register) More... | |
int | ad74413r_dac_slew_enable (struct ad74413r_desc *, uint32_t, enum ad74413r_slew_lin_step, enum ad74413r_lin_rate) |
Configure and enable slew rate control for a DAC on a specific channel. More... | |
int | ad74413r_dac_slew_disable (struct ad74413r_desc *, uint32_t) |
Disable the slew rate control. More... | |
int | ad74413r_set_therm_rst (struct ad74413r_desc *, bool) |
Enable or disable the higher thermal reset. More... | |
int | ad74413r_init (struct ad74413r_desc **, struct ad74413r_init_param *) |
Initialize the device structure. More... | |
int | ad74413r_remove (struct ad74413r_desc *desc) |
Free the device descriptor. More... | |
Header file of AD74413r 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.
#define AD74413R_ADC_CODE_MAX 65536 |
#define AD74413R_ADC_CONFIG | ( | x | ) | (0x05 + x) |
#define AD74413R_ADC_CONV_CTRL 0x23 |
#define AD74413R_ADC_MAX_VALUE 65535 |
16 bit ADC
#define AD74413R_ADC_RANGE_MASK NO_OS_GENMASK(7, 5) |
#define AD74413R_ADC_REJECTION_MASK NO_OS_GENMASK(4, 3) |
#define AD74413R_ADC_RESOLUTION 16 |
#define AD74413R_ADC_RESULT | ( | x | ) | (0x26 + x) |
#define AD74413R_ALERT_MASK 0x3C |
#define AD74413R_ALERT_STATUS 0x2E |
#define AD74413R_ALERT_STATUS_RESET NO_OS_GENMASK(15, 0) |
#define AD74413R_CH_200K_TO_GND_MASK NO_OS_BIT(2) |
#define AD74413R_CH_A 0 |
#define AD74413R_CH_B 1 |
#define AD74413R_CH_C 2 |
#define AD74413R_CH_D 3 |
#define AD74413R_CH_EN_MASK | ( | x | ) | NO_OS_BIT(x) |
#define AD74413R_CH_FUNC_SETUP | ( | x | ) | (0x01 + x) |
#define AD74413R_CH_FUNC_SETUP_MASK NO_OS_GENMASK(3, 0) |
#define AD74413R_CLR_CODE_MASK NO_OS_GENMASK(12, 0) |
DAC_CLR_CODEx register
#define AD74413R_CLR_EN_MASK NO_OS_BIT(1) |
#define AD74413R_CMD_KEY 0x44 |
#define AD74413R_CMD_KEY_DAC_CLEAR 0x73D1 |
Command to load code into the DAC from DAC_CLR_CODEx
#define AD74413R_CMD_KEY_LDAC 0x953A |
Command to load code into the DAC from DAC_CODEx
#define AD74413R_CMD_KEY_RESET_1 0x15FA |
Software reset sequence
#define AD74413R_CMD_KEY_RESET_2 0xAF51 |
#define AD74413R_COMP_THRESH_MASK NO_OS_GENMASK(5, 1) |
DIN_THRESH
#define AD74413R_CONV_SEQ_MASK NO_OS_GENMASK(9, 8) |
#define AD74413R_DAC_ACTIVE | ( | x | ) | (0x1E + x) |
#define AD74413R_DAC_ACTIVE_CODE_MASK NO_OS_GENMASK(12, 0) |
DAC_ACTIVEx register
#define AD74413R_DAC_CLR_CODE | ( | x | ) | (0x1A + x) |
#define AD74413R_DAC_CODE | ( | x | ) | (0x16 + x) |
#define AD74413R_DAC_CODE_MASK NO_OS_GENMASK(12, 0) |
DAC_CODEx register
#define AD74413R_DAC_CODE_MAX 8191 |
#define AD74413R_DAC_RANGE 11000 |
The maximum voltage output of the DAC is 11V
#define AD74413R_DAC_RESOLUTION 13 |
13 bit DAC
#define AD74413R_DEBOUNCE_MODE_MASK NO_OS_BIT(5) |
#define AD74413R_DEBOUNCE_TIME_MASK NO_OS_GENMASK(4, 0) |
#define AD74413R_DIAG_ASSIGN 0x24 |
#define AD74413R_DIAG_ASSIGN_MASK | ( | x | ) | (NO_OS_GENMASK(3, 0) << (x * 4)) |
DIAG_ASSIGN register
#define AD74413R_DIAG_EN_MASK | ( | x | ) | (NO_OS_BIT(x) << 4) |
#define AD74413R_DIAG_RESULT | ( | x | ) | (0x2A + x) |
#define AD74413R_DIAG_RESULT_MASK NO_OS_GENMASK(15, 0) |
#define AD74413R_DIN_COMP_CH | ( | x | ) | NO_OS_BIT(x) |
DIN_COMP_OUT register
#define AD74413R_DIN_COMP_OUT 0x25 |
#define AD74413R_DIN_CONFIG | ( | x | ) | (0x09 + x) |
#define AD74413R_DIN_COUNTER | ( | x | ) | (0x3D + x) |
#define AD74413R_DIN_THRESH 0x22 |
#define AD74413R_DIN_THRESH_MODE_MASK NO_OS_BIT(0) |
#define AD74413R_EN_REJ_DIAG_MASK NO_OS_BIT(10) |
ADC_CONV_CTRL register
#define AD74413R_ERR_CLR_MASK NO_OS_GENMASK(15, 0) |
#define AD74413R_GPO_CONFIG | ( | x | ) | (0x0E + x) |
#define AD74413R_GPO_DATA_MASK NO_OS_BIT(3) |
#define AD74413R_GPO_PAR_DATA_MASK | ( | x | ) | NO_OS_BIT(x) |
GPO_PARALLEL register
#define AD74413R_GPO_PARALLEL 0x0D |
#define AD74413R_GPO_SELECT_MASK NO_OS_GENMASK(2, 0) |
GPO_CONFIGx register
#define AD74413R_I_LIMIT_MASK NO_OS_BIT(0) |
#define AD74413R_LIVE_STATUS 0x2F |
#define AD74413R_N_CHANNELS 4 |
#define AD74413R_N_DIAG_CHANNELS 4 |
#define AD74413R_NOP 0x00 |
Register map
#define AD74413R_OUTPUT_CONFIG | ( | x | ) | (0x12 + x) |
#define AD74413R_RANGE_10V_SCALE 15259ULL |
#define AD74413R_RANGE_10V_SCALE_DIV 100000ULL |
#define AD74413R_RANGE_2V5_SCALE 38147ULL |
#define AD74413R_RANGE_2V5_SCALE_DIV 1000000ULL |
#define AD74413R_RANGE_5V_OFFSET -(AD74413R_ADC_MAX_VALUE / 2) |
#define AD74413R_RANGE_5V_SCALE 76294ULL |
#define AD74413R_RANGE_5V_SCALE_DIV 1000000ULL |
#define AD74413R_READ_SELECT 0x41 |
#define AD74413R_REV_ID NO_OS_GENMASK(7, 0) |
#define AD74413R_RSENSE 100 |
The value of the sense resistor in ohms
#define AD74413R_RTD_PULL_UP 2100000ULL |
#define AD74413R_SCRATCH 0x45 |
#define AD74413R_SENSE_RESISTOR_OHMS 100 |
#define AD74413R_SILICON_REV 0x46 |
#define AD74413R_SLEW_EN_MASK NO_OS_GENMASK(7, 6) |
OUTPUT_CONFIGx register
#define AD74413R_SLEW_LIN_RATE_MASK NO_OS_GENMASK(3, 2) |
#define AD74413R_SLEW_LIN_STEP_MASK NO_OS_GENMASK(5, 4) |
#define AD74413R_SPI_CRC_ERR_MASK NO_OS_BIT(13) |
#define AD74413R_SPI_RD_RET_INFO_MASK NO_OS_BIT(8) |
#define AD74413R_TEMP_OFFSET -2392 |
#define AD74413R_TEMP_SCALE 8950 |
#define AD74413R_TEMP_SCALE_DIV 1000 |
#define AD74413R_THERM_RST 0x43 |
#define AD74413R_THRESHOLD_DAC_RANGE 29 |
The number of possible DAC values
#define AD74413R_THRESHOLD_RANGE 16000 |
The comparator's value can be set betwen 0 - 16 V
enum ad74413r_adc_range |
enum ad74413r_adc_sample |
enum ad74413r_chip_id |
enum ad74413r_conv_seq |
enum ad74413r_diag_mode |
Possible values to be loaded in the DIAG_RESULT register.
enum ad74413r_gpo_select |
enum ad74413r_lin_rate |
enum ad74413r_op_mode |
enum ad74413r_rejection |
int ad74413r_adc_get_value | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
struct ad74413r_decimal * | val | ||
) |
Get the ADC real value, according to the operation mode.
Get the ADC real value, according to the operation mode
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC real measurement value (the unit depends on the operation mode). |
I_Rsense = (Vmin + (ADC_CODE/65535) * range) / Rsense
int ad74413r_clear_dac | ( | struct ad74413r_desc * | desc, |
uint32_t | ch | ||
) |
Clear the DAC (to the code in DAC_CLR_CODE register)
Clear the DAC (to the code in DAC_CLR_CODE register)
desc | - The device structure. |
ch | - The channel index. |
int ad74413r_clear_errors | ( | struct ad74413r_desc * | desc | ) |
Clear the ALERT_STATUS register.
Clear the ALERT_STATUS register
desc | - The device structure. |
int ad74413r_dac_slew_disable | ( | struct ad74413r_desc * | desc, |
uint32_t | ch | ||
) |
Disable the slew rate control.
Disable the slew rate control
desc | - The device structure. |
ch | - The channel index. |
int ad74413r_dac_slew_enable | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_slew_lin_step | step, | ||
enum ad74413r_lin_rate | rate | ||
) |
Configure and enable slew rate control for a DAC on a specific channel.
Configure and enable slew rate control for a DAC on a specific channel
desc | - The device structure. |
ch | - The channel index. |
step | - Number of codes per increment. |
rate | - Number of increments per second. |
int ad74413r_dac_voltage_to_code | ( | uint32_t | mvolts, |
uint32_t * | code | ||
) |
Converts a millivolt value in the corresponding DAC 13 bit code.
Converts a millivolt value in the corresponding DAC 13 bit code
mvolts | - The millivolts value. |
code | - The resulting DAC code. |
int ad74413r_get_adc_diag_rate | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_adc_sample * | val | ||
) |
Get the ADC sample rate for the diagnostics channels.
Get the ADC sample rate for the diagnostics channels.
desc | - The device structure. |
ch | - The diagnostics channel index. |
val | - The ADC sample rate value. |
int ad74413r_get_adc_diag_rejection | ( | struct ad74413r_desc * | desc, |
enum ad74413r_rejection * | val | ||
) |
Get the rejection setting for a specific channel.
Get the rejection setting for any diagnostics channel
desc | - The device structure. |
val | - The ADC rejection setting. |
int ad74413r_get_adc_range | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | val | ||
) |
Get the ADC measurement range for a specific channel.
Get the ADC measurement range for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC range value. |
int ad74413r_get_adc_rate | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_adc_sample * | val | ||
) |
Get the ADC sample rate.
Get the ADC sample rate.
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC sample rate value. |
int ad74413r_get_adc_rejection | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_rejection * | val | ||
) |
Get the rejection setting for a specific channel.
Get the rejection setting for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC rejection setting. |
int ad74413r_get_adc_single | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | val, | ||
bool | is_diag | ||
) |
Get a single ADC raw value for a specific channel, then power down the ADC.
Get a single ADC raw value for a specific channel, then power down the ADC
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC raw result. |
is_diag | - Select which channel type does the index refer to (I/O or diagnostics). |
Wait for all channels to complete the conversion.
int ad74413r_get_diag | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | diag_code | ||
) |
Get the diagnostic value for a specific channel.
Get the diagnostic value for a specific channel
desc | - The device structure. |
ch | - The channel index. |
diag_code | - The diagnostic setting. |
int ad74413r_get_live | ( | struct ad74413r_desc * | desc, |
union ad74413r_live_status * | status | ||
) |
Read the live status bits.
Read the live status bits
desc | - The device structure. |
status | - The register's value. |
int ad74413r_get_raw_adc_result | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | val | ||
) |
Read the raw ADC raw conversion value.
Read the raw ADC raw conversion value
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC raw conversion value. |
int ad74413r_get_temp | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t * | temp | ||
) |
Read the die's temperature from the diagnostic register.
Read the die's temperature from the diagnostic register
desc | - The device structure. |
ch | - The diagnostic channel on which the temperature reading is assigned and enabled. |
temp | - The measured temperature (in degrees Celsius). |
int ad74413r_gpo_get | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint8_t * | val | ||
) |
Get the GPO value for a specific channel.
Get the GPO value for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The debounce time. |
int ad74413r_gpo_set | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint8_t | val | ||
) |
Set the logic value of a GPO pin.
Set the logic value of a GPO pin
desc | - The device structure. |
ch | - The channel index. |
val | - The output logic state. |
int ad74413r_gpo_set_multiple | ( | struct ad74413r_desc * | desc, |
uint32_t | mask | ||
) |
Set multiple GPO values at once.
Set multiple GPO values at once
desc | - The device structure. |
mask | - Active channels mask. |
int ad74413r_init | ( | struct ad74413r_desc ** | desc, |
struct ad74413r_init_param * | init_param | ||
) |
Initialize the device structure.
Initialize the device structure
desc | - The device structure to be initialized. |
init_param | - Initialization parameter for the device descriptor. |
int ad74413r_nb_active_channels | ( | struct ad74413r_desc * | desc, |
uint8_t * | nb_channels | ||
) |
Get the number of active channels.
Get the number of active channels
desc | - The device structure. |
nb_channels | - The number of active channels |
int ad74413r_range_to_voltage_offset | ( | enum ad74413r_adc_range | range, |
int32_t * | val | ||
) |
Convert the measuring range of the ADC from range enum values to millivolts.
range | - ADC sample rate |
val | - Rejection register value |
int ad74413r_range_to_voltage_range | ( | enum ad74413r_adc_range | range, |
uint32_t * | val | ||
) |
Convert the measuring range of the ADC from range enum values to millivolts.
Convert a voltage range from an enum representation to a millivolt value
range | - ADC sample rate |
val | - Rejection register value |
int ad74413r_reg_read | ( | struct ad74413r_desc * | desc, |
uint32_t | addr, | ||
uint16_t * | val | ||
) |
Read a register's value.
Read a register's value
desc | - The device structure. |
addr | - The register's address. |
val | - The register's read value. |
int ad74413r_reg_read_raw | ( | struct ad74413r_desc * | desc, |
uint32_t | addr, | ||
uint8_t * | val | ||
) |
Read a raw communication frame.
Read a raw communication frame
desc | - The device structure. |
addr | - The register's address. |
val | - A raw comm frame. |
Reading a register on AD74413r requires writing the address to the READ_SELECT register first and then doing another spi read, which will contain the requested register value.
int ad74413r_reg_update | ( | struct ad74413r_desc * | desc, |
uint32_t | addr, | ||
uint16_t | mask, | ||
uint16_t | val | ||
) |
Update a register's field.
Update a register's field
desc | - The device structure. |
addr | - The register's address. |
val | - The register's value. |
mask | - The mask for a specific register field. |
int ad74413r_reg_write | ( | struct ad74413r_desc * | desc, |
uint32_t | addr, | ||
uint16_t | val | ||
) |
Write a register's value.
Write a register's value
desc | - The device structure. |
addr | - The register's address. |
val | - The register's value. |
int ad74413r_remove | ( | struct ad74413r_desc * | desc | ) |
Free the device descriptor.
Free the device descriptor
desc | - The device structure. |
int ad74413r_reset | ( | struct ad74413r_desc * | desc | ) |
Perform either a software or hardware reset and wait for device reset time.
Perform either a software or hardware reset and wait for device reset time.
desc | - The device structure. |
int ad74413r_set_adc_channel_enable | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
bool | status | ||
) |
Enable/disable a specific ADC channel.
Enable/disable a specific ADC channel
desc | - The device structure. |
ch | - The channel index. |
status | - Enabled or disabled status. |
int ad74413r_set_adc_conv_seq | ( | struct ad74413r_desc * | desc, |
enum ad74413r_conv_seq | status | ||
) |
Start or stop ADC conversions.
Start or stop ADC conversions
desc | - The device structure. |
status | - The ADC conversion sequence. |
The write to CONV_SEQ powers up the ADC. If the ADC was powered down, the user must wait for 100us before the ADC starts doing conversions.
int ad74413r_set_adc_diag_rate | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_adc_sample | val | ||
) |
Set the ADC sample rate for the diagnostics channels.
Set the ADC sample rate for the diagnostics channels.
desc | - The device structure. |
ch | - The diagnostics channel index. |
val | - The ADC sample rate value. |
int ad74413r_set_adc_rate | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_adc_sample | val | ||
) |
Set the ADC sample rate.
Set the ADC sample rate.
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC sample rate value. |
int ad74413r_set_adc_rejection | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_rejection | val | ||
) |
Set the rejection setting for a specific channel.
Set the rejection setting for a specific channel
desc | - The device structure. |
ch | - The channel index. |
val | - The ADC rejection setting. |
int ad74413r_set_channel_dac_code | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t | dac_code | ||
) |
Set and load a code for the DAC on a specific channel.
Set and load a code for the DAC on a specific channel
desc | - The device structure. |
ch | - The channel index. |
dac_code | - The code for the DAC. |
int ad74413r_set_channel_function | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_op_mode | ch_func | ||
) |
Set the operation mode for a specific channel.
Set the operation mode for a specific channel
desc | - The device structure. |
ch | - The channel index. |
ch_func | - The operation mode. |
int ad74413r_set_dac_clear_code | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint16_t | code | ||
) |
The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written.
The code value will be loaded into the DACs when the CLR_EN bit in the OUTPUT_CONFIGx registers is asserted and the DAC clear key is written
desc | - The device structure. |
ch | - The channel index. |
code | - The DAC code to be loaded |
int ad74413r_set_debounce_mode | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_debounce_mode | mode | ||
) |
Set the debounce mode for the IOx inputs when the ADC is running in digital input mode.
Set the debounce mode for the IOx inputs when the ADC is running in digital input mode.
desc | - The device structure. |
ch | - The channel index. |
mode | - The debounce mode. |
int ad74413r_set_debounce_time | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint32_t | time | ||
) |
Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode.
Set the debounce settle time for the IOx inputs when the ADC is running in digital input mode
desc | - The device structure. |
ch | - The channel index. |
time | - The debounce time. |
int ad74413r_set_diag | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_diag_mode | diag_code | ||
) |
Set which diagnostic value to be loaded in the DIAG_RESULT register.
Set which diagnostic value to be loaded in the DIAG_RESULT register
desc | - The device structure. |
ch | - The channel index. |
diag_code | - The diagnostic setting. |
int ad74413r_set_diag_channel_enable | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
bool | status | ||
) |
Enable conversions on a diagnostic register.
Enable conversions on a diagnostic register
desc | - The device structure. |
ch | - Diagnostic channel index. |
status | - Enabled or disabled status. |
int ad74413r_set_gpo_config | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
enum ad74413r_gpo_select | config | ||
) |
Set the GPO operation mode.
Set the GPO operation mode
desc | - The device structure. |
ch | - The channel index. |
config | - The configuration setting. |
int ad74413r_set_info | ( | struct ad74413r_desc * | desc, |
uint16_t | mode | ||
) |
Select which information the device will respond with (in the readback field) when a read operation is performed.
Select which information the device will respond with (in the readback field) when a read operation is performed
desc | - The device structure. |
mode | - Possible values: 0 - Respond with the readback address. 1 - Respond with status bits. |
int ad74413r_set_therm_rst | ( | struct ad74413r_desc * | desc, |
bool | enable | ||
) |
Enable or disable the higher thermal reset.
Enable or disable the higher thermal reset
desc | - The device structure. |
enable | - The thermal reset status. false: reset at 110 deg. Celsius. true: reset at 140 deg. Celsius. |
int ad74413r_set_threshold | ( | struct ad74413r_desc * | desc, |
uint32_t | ch, | ||
uint32_t | threshold | ||
) |
Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode.
Set the threshold, for which a signal would be considered high, when the ADC is running in digital input mode
desc | - The device structure. |
ch | - The channel index. |
threshold | - The threshold value (in millivolts). The actual threshold set might not match this value (~500mV max. error), since it's fairly low resolution (29 possible values). |
Set a fixed range (0 - 16 V) for the threshold, so it would not depend on Vadd.