no-OS
Macros | Functions
ad74413r.c File Reference

Source file of AD74413r Driver. More...

#include "ad74413r.h"
#include "no_os_crc8.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_util.h"
#include "no_os_alloc.h"
Include dependency graph for ad74413r.c:

Macros

#define AD74413R_FRAME_SIZE   4
 
#define AD74413R_CRC_POLYNOMIAL   0x7
 
#define AD74413R_DIN_DEBOUNCE_LEN   NO_OS_BIT(5)
 

Functions

 NO_OS_DECLARE_CRC8_TABLE (_crc_table)
 
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. More...
 
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. More...
 
int ad74413r_dac_voltage_to_code (uint32_t mvolts, uint32_t *code)
 Converts a millivolt value in the corresponding DAC 13 bit code. More...
 
int ad74413r_reg_read_raw (struct ad74413r_desc *desc, uint32_t addr, uint8_t *val)
 Read a raw communication frame. More...
 
int ad74413r_reg_write (struct ad74413r_desc *desc, uint32_t addr, uint16_t val)
 Write a register's value. More...
 
int ad74413r_reg_read (struct ad74413r_desc *desc, uint32_t addr, uint16_t *val)
 Read a register's value. More...
 
int ad74413r_reg_update (struct ad74413r_desc *desc, uint32_t addr, uint16_t mask, uint16_t val)
 Update a register's field. More...
 
int ad74413r_nb_active_channels (struct ad74413r_desc *desc, uint8_t *nb_channels)
 Get the number of active channels. More...
 
int ad74413r_clear_errors (struct ad74413r_desc *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 *desc)
 Perform either a software or hardware reset and wait for device reset time. More...
 
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. More...
 
int ad74413r_get_raw_adc_result (struct ad74413r_desc *desc, uint32_t ch, uint16_t *val)
 Read the raw ADC raw conversion value. More...
 
int ad74413r_set_adc_channel_enable (struct ad74413r_desc *desc, uint32_t ch, bool status)
 Enable/disable a specific ADC channel. More...
 
int ad74413r_set_diag_channel_enable (struct ad74413r_desc *desc, uint32_t ch, bool status)
 Enable conversions on a diagnostic register. More...
 
int ad74413r_get_adc_range (struct ad74413r_desc *desc, uint32_t ch, uint16_t *val)
 Get the ADC measurement range for a specific channel. More...
 
int ad74413r_get_adc_rejection (struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_rejection *val)
 Get the rejection setting for a specific channel. More...
 
int ad74413r_get_adc_diag_rejection (struct ad74413r_desc *desc, enum ad74413r_rejection *val)
 Get the rejection setting for a specific channel. More...
 
int ad74413r_set_adc_rejection (struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_rejection val)
 Set the rejection setting for a specific channel. More...
 
int ad74413r_get_adc_rate (struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_adc_sample *val)
 Get the ADC sample rate. More...
 
int ad74413r_set_adc_rate (struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_adc_sample val)
 Set the ADC sample rate. More...
 
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. More...
 
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. More...
 
int ad74413r_set_adc_conv_seq (struct ad74413r_desc *desc, enum ad74413r_conv_seq status)
 Start or stop ADC conversions. More...
 
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. More...
 
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. More...
 
int ad74413r_get_temp (struct ad74413r_desc *desc, uint32_t ch, uint16_t *temp)
 Read the die's temperature from the diagnostic register. More...
 
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. More...
 
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. More...
 
int ad74413r_get_diag (struct ad74413r_desc *desc, uint32_t ch, uint16_t *diag_code)
 Get the diagnostic value for a specific channel. More...
 
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. More...
 
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. More...
 
int ad74413r_gpo_get (struct ad74413r_desc *desc, uint32_t ch, uint8_t *val)
 Get the GPO value for a specific channel. More...
 
int ad74413r_set_gpo_config (struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_gpo_select config)
 Set the GPO operation mode. More...
 
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. More...
 
int ad74413r_gpo_set (struct ad74413r_desc *desc, uint32_t ch, uint8_t val)
 Set the logic value of a GPO pin. More...
 
int ad74413r_gpo_set_multiple (struct ad74413r_desc *desc, uint32_t mask)
 Set multiple GPO values at once. More...
 
int ad74413r_get_live (struct ad74413r_desc *desc, union ad74413r_live_status *status)
 Read the live status bits. More...
 
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. More...
 
int ad74413r_clear_dac (struct ad74413r_desc *desc, uint32_t ch)
 Clear the DAC (to the code in DAC_CLR_CODE register) More...
 
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. More...
 
int ad74413r_dac_slew_disable (struct ad74413r_desc *desc, uint32_t ch)
 Disable the slew rate control. More...
 
int ad74413r_set_therm_rst (struct ad74413r_desc *desc, bool enable)
 Enable or disable the higher thermal reset. More...
 
int ad74413r_init (struct ad74413r_desc **desc, struct ad74413r_init_param *init_param)
 Initialize the device structure. More...
 
int ad74413r_remove (struct ad74413r_desc *desc)
 Free the device descriptor. More...
 

Detailed Description

Source file of AD74413r Driver.

Author
Ciprian Regus (cipri.nosp@m.an.r.nosp@m.egus@.nosp@m.anal.nosp@m.og.co.nosp@m.m)

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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Macro Definition Documentation

◆ AD74413R_CRC_POLYNOMIAL

#define AD74413R_CRC_POLYNOMIAL   0x7

◆ AD74413R_DIN_DEBOUNCE_LEN

#define AD74413R_DIN_DEBOUNCE_LEN   NO_OS_BIT(5)

◆ AD74413R_FRAME_SIZE

#define AD74413R_FRAME_SIZE   4

Function Documentation

◆ ad74413r_adc_get_value()

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.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC real measurement value (the unit depends on the operation mode).
Returns
0 in case of success, negative error code otherwise.

I_Rsense = (Vmin + (ADC_CODE/65535) * range) / Rsense

Here is the caller graph for this function:

◆ ad74413r_clear_dac()

int ad74413r_clear_dac ( struct ad74413r_desc desc,
uint32_t  ch 
)

Clear the DAC (to the code in DAC_CLR_CODE register)

Parameters
desc- The device structure.
ch- The channel index.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_clear_errors()

int ad74413r_clear_errors ( struct ad74413r_desc desc)

Clear the ALERT_STATUS register.

Parameters
desc- The device structure.
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_dac_slew_disable()

int ad74413r_dac_slew_disable ( struct ad74413r_desc desc,
uint32_t  ch 
)

Disable the slew rate control.

Parameters
desc- The device structure.
ch- The channel index.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_dac_slew_enable()

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.

Parameters
desc- The device structure.
ch- The channel index.
step- Number of codes per increment.
rate- Number of increments per second.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_dac_voltage_to_code()

int ad74413r_dac_voltage_to_code ( uint32_t  mvolts,
uint32_t *  code 
)

Converts a millivolt value in the corresponding DAC 13 bit code.

Parameters
mvolts- The millivolts value.
code- The resulting DAC code.
Returns
0 in case of success, -EINVAL otherwise
Here is the caller graph for this function:

◆ ad74413r_get_adc_diag_rate()

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.

Parameters
desc- The device structure.
ch- The diagnostics channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_diag_rejection()

int ad74413r_get_adc_diag_rejection ( struct ad74413r_desc desc,
enum ad74413r_rejection val 
)

Get the rejection setting for a specific channel.

Parameters
desc- The device structure.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_adc_range()

int ad74413r_get_adc_range ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  val 
)

Get the ADC measurement range for a specific channel.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC range value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_rate()

int ad74413r_get_adc_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample val 
)

Get the ADC sample rate.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_adc_rejection()

int ad74413r_get_adc_rejection ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_rejection val 
)

Get the rejection setting for a specific channel.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_adc_single()

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.

Parameters
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).
Returns
0 in case of success, negative error code otherwise.

Wait for all channels to complete the conversion.

Here is the caller graph for this function:

◆ ad74413r_get_diag()

int ad74413r_get_diag ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  diag_code 
)

Get the diagnostic value for a specific channel.

Parameters
desc- The device structure.
ch- The channel index.
diag_code- The diagnostic setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_live()

int ad74413r_get_live ( struct ad74413r_desc desc,
union ad74413r_live_status status 
)

Read the live status bits.

Parameters
desc- The device structure.
status- The register's value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_get_raw_adc_result()

int ad74413r_get_raw_adc_result ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  val 
)

Read the raw ADC raw conversion value.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC raw conversion value.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_get_temp()

int ad74413r_get_temp ( struct ad74413r_desc desc,
uint32_t  ch,
uint16_t *  temp 
)

Read the die's temperature from the diagnostic register.

Parameters
desc- The device structure.
ch- The diagnostic channel on which the temperature reading is assigned and enabled.
temp- The measured temperature (in degrees Celsius).
Returns
0 in case of success, -EINVAL otherwise.
Here is the caller graph for this function:

◆ ad74413r_gpo_get()

int ad74413r_gpo_get ( struct ad74413r_desc desc,
uint32_t  ch,
uint8_t *  val 
)

Get the GPO value for a specific channel.

Parameters
desc- The device structure.
ch- The channel index.
val- The debounce time.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_gpo_set()

int ad74413r_gpo_set ( struct ad74413r_desc desc,
uint32_t  ch,
uint8_t  val 
)

Set the logic value of a GPO pin.

Parameters
desc- The device structure.
ch- The channel index.
val- The output logic state.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_gpo_set_multiple()

int ad74413r_gpo_set_multiple ( struct ad74413r_desc desc,
uint32_t  mask 
)

Set multiple GPO values at once.

Parameters
desc- The device structure.
mask- Active channels mask.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_init()

int ad74413r_init ( struct ad74413r_desc **  desc,
struct ad74413r_init_param init_param 
)

Initialize the device structure.

Parameters
desc- The device structure to be initialized.
init_param- Initialization parameter for the device descriptor.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_nb_active_channels()

int ad74413r_nb_active_channels ( struct ad74413r_desc desc,
uint8_t *  nb_channels 
)

Get the number of active channels.

Parameters
desc- The device structure.
nb_channels- The number of active channels
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_range_to_voltage_offset()

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.

Parameters
range- ADC sample rate
val- Rejection register value
Returns
0 in case of success, -EINVAL otherwise

◆ ad74413r_range_to_voltage_range()

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.

Parameters
range- ADC sample rate
val- Rejection register value
Returns
0 in case of success, -EINVAL otherwise

◆ ad74413r_reg_read()

int ad74413r_reg_read ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t *  val 
)

Read a register's value.

Parameters
desc- The device structure.
addr- The register's address.
val- The register's read value.
Returns
0 in case of success, negative error otherwise
Here is the caller graph for this function:

◆ ad74413r_reg_read_raw()

int ad74413r_reg_read_raw ( struct ad74413r_desc desc,
uint32_t  addr,
uint8_t *  val 
)

Read a raw communication frame.

Parameters
desc- The device structure.
addr- The register's address.
val- A raw comm frame.
Returns
0 in case of success, negative error otherwise.

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.

Here is the caller graph for this function:

◆ ad74413r_reg_update()

int ad74413r_reg_update ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t  mask,
uint16_t  val 
)

Update a register's field.

Parameters
desc- The device structure.
addr- The register's address.
val- The register's value.
mask- The mask for a specific register field.
Returns
0 in case of success, negative error otherwise.
Here is the caller graph for this function:

◆ ad74413r_reg_write()

int ad74413r_reg_write ( struct ad74413r_desc desc,
uint32_t  addr,
uint16_t  val 
)

Write a register's value.

Parameters
desc- The device structure.
addr- The register's address.
val- The register's value.
Returns
0 in case of success, negative error otherwise
Here is the caller graph for this function:

◆ ad74413r_remove()

int ad74413r_remove ( struct ad74413r_desc desc)

Free the device descriptor.

Parameters
desc- The device structure.
Returns
0 in case of success, -EINVAL otherwise.
Here is the caller graph for this function:

◆ ad74413r_reset()

int ad74413r_reset ( struct ad74413r_desc desc)

Perform either a software or hardware reset and wait for device reset time.

Parameters
desc- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_channel_enable()

int ad74413r_set_adc_channel_enable ( struct ad74413r_desc desc,
uint32_t  ch,
bool  status 
)

Enable/disable a specific ADC channel.

Parameters
desc- The device structure.
ch- The channel index.
status- Enabled or disabled status.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_conv_seq()

int ad74413r_set_adc_conv_seq ( struct ad74413r_desc desc,
enum ad74413r_conv_seq  status 
)

Start or stop ADC conversions.

Parameters
desc- The device structure.
status- The ADC conversion sequence.
Returns
0 in case of success, negative error code otherwise.

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.

Here is the caller graph for this function:

◆ ad74413r_set_adc_diag_rate()

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.

Parameters
desc- The device structure.
ch- The diagnostics channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_rate()

int ad74413r_set_adc_rate ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_adc_sample  val 
)

Set the ADC sample rate.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC sample rate value.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_adc_rejection()

int ad74413r_set_adc_rejection ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_rejection  val 
)

Set the rejection setting for a specific channel.

Parameters
desc- The device structure.
ch- The channel index.
val- The ADC rejection setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_channel_dac_code()

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.

Parameters
desc- The device structure.
ch- The channel index.
dac_code- The code for the DAC.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_channel_function()

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.

Parameters
desc- The device structure.
ch- The channel index.
ch_func- The operation mode.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_dac_clear_code()

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.

Parameters
desc- The device structure.
ch- The channel index.
code- The DAC code to be loaded
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_debounce_mode()

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.

Parameters
desc- The device structure.
ch- The channel index.
mode- The debounce mode.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_debounce_time()

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.

Parameters
desc- The device structure.
ch- The channel index.
time- The debounce time.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_diag()

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.

Parameters
desc- The device structure.
ch- The channel index.
diag_code- The diagnostic setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_diag_channel_enable()

int ad74413r_set_diag_channel_enable ( struct ad74413r_desc desc,
uint32_t  ch,
bool  status 
)

Enable conversions on a diagnostic register.

Parameters
desc- The device structure.
ch- Diagnostic channel index.
status- Enabled or disabled status.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_gpo_config()

int ad74413r_set_gpo_config ( struct ad74413r_desc desc,
uint32_t  ch,
enum ad74413r_gpo_select  config 
)

Set the GPO operation mode.

Parameters
desc- The device structure.
ch- The channel index.
config- The configuration setting.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad74413r_set_info()

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.

Parameters
desc- The device structure.
mode- Possible values: 0 - Respond with the readback address. 1 - Respond with status bits.
Returns
0 in case of success, negative error otherwise.

◆ ad74413r_set_therm_rst()

int ad74413r_set_therm_rst ( struct ad74413r_desc desc,
bool  enable 
)

Enable or disable the higher thermal reset.

Parameters
desc- The device structure.
enable- The thermal reset status. false: reset at 110 deg. Celsius. true: reset at 140 deg. Celsius.
Returns
0 in case of success, negative error code otherwise.

◆ ad74413r_set_threshold()

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.

Parameters
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).
Returns
0 in case of success, negative error code otherwise.

Set a fixed range (0 - 16 V) for the threshold, so it would not depend on Vadd.

Here is the caller graph for this function:

◆ NO_OS_DECLARE_CRC8_TABLE()

NO_OS_DECLARE_CRC8_TABLE ( _crc_table  )