Go to the documentation of this file.
33 #ifndef IIO_AD74413R_H
34 #define IIO_AD74413R_H
55 static const char *
const ad74413r_diag_available[] = {
ad74413r_adc_sample
Definition: ad74413r.h:286
#define AD74413R_DIN_THRESH
Definition: ad74413r.h:66
struct ad74413r_diag_channel_config diag_channel_configs[AD74413R_N_DIAG_CHANNELS]
Definition: iio_ad74413r.h:83
struct iio_device * iio_dev
Definition: iio_ad74413r.h:77
@ AD74413R_DIAG_IOVDD
Definition: ad74413r.h:251
@ AD74413R_STEP_500
Definition: ad74413r.h:272
#define END_ATTRIBUTES_ARRAY
Definition: iio_types.h:116
Header file for iio_trigger.
int ad74413r_iio_remove(struct ad74413r_iio_desc *)
Free an iio descriptor.
Definition: iio_ad74413r.c:1582
int ad74413r_reg_read_raw(struct ad74413r_desc *desc, uint32_t addr, uint8_t *val)
Read a raw communication frame.
Definition: ad74413r.c:219
int ad74413r_clear_errors(struct ad74413r_desc *desc)
Clear the ALERT_STATUS register.
Definition: ad74413r.c:333
@ IIO_VAL_INT
Definition: iio_types.h:50
Struct describing the scan type.
Definition: iio_types.h:168
char sign
Definition: iio_types.h:153
#define AD74413R_THRESHOLD_DAC_RANGE
Definition: ad74413r.h:153
int ad74413r_get_adc_range(struct ad74413r_desc *desc, uint32_t ch, uint16_t *val)
Get the ADC measurement range for a specific channel.
Definition: ad74413r.c:511
struct ad74413r_channel_config channel_configs[AD74413R_N_CHANNELS]
Definition: iio_ad74413r.h:80
#define AD74413R_THRESHOLD_RANGE
Definition: ad74413r.h:155
struct iio_channel * channels
Definition: iio_types.h:254
@ IIO_VAL_FRACTIONAL_LOG2
Definition: iio_types.h:56
void * dev
Definition: iio_types.h:227
Initialization parameter for the device descriptor.
Definition: ad74413r.h:296
@ AD74413R_STEP_120
Definition: ad74413r.h:271
int ad74413r_init(struct ad74413r_desc **desc, struct ad74413r_init_param *init_param)
Initialize the device structure.
Definition: ad74413r.c:1170
Diagnostics channel state.
Definition: iio_ad74413r.h:50
@ AD74413R_CURRENT_OUT
Definition: ad74413r.h:196
Structure holding channel attributess.
Definition: iio_types.h:103
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 in...
Definition: ad74413r.c:993
struct iio_hw_trig * trigger
Definition: iio_ad74413r.h:81
int ad74413r_set_adc_conv_seq(struct ad74413r_desc *desc, enum ad74413r_conv_seq status)
Start or stop ADC conversions.
Definition: ad74413r.c:679
int iio_trig_disable(void *trig)
Disable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:127
@ IIO_VAL_FRACTIONAL
Definition: iio_types.h:55
struct ad74413r_desc * ad74413r_desc
Definition: iio_ad74413r.h:76
@ AD74413R_ADC
Definition: iio_ad74413r.c:88
#define AD74413R_ADC_RESOLUTION
Definition: ad74413r.h:149
ADC value format.
Definition: ad74413r.h:305
#define AD74413R_N_DIAG_CHANNELS
Definition: ad74413r.h:42
bool ch_out
Definition: iio_types.h:107
bool enabled
Definition: iio_ad74413r.h:51
@ AD74413R_DIAG_DLDO_1V8
Definition: ad74413r.h:249
uint8_t no_of_active_channels
Definition: iio_ad74413r.h:79
#define AD74413R_ADC_CHANNEL(type, attrs)
Definition: iio_ad74413r.c:50
#define AD74413R_DIAG_CHANNEL(_addr, _type)
Definition: iio_ad74413r.c:59
@ IIO_RESISTANCE
Definition: iio_types.h:72
ad74413r_conv_seq
ADC conversion sequence commands.
Definition: ad74413r.h:220
#define AD74413R_N_CHANNELS
Definition: ad74413r.h:41
@ AD74413R_CURRENT_IN_EXT_HART
Definition: ad74413r.h:203
uint32_t num_channels
Definition: iio_ad74413r.h:103
struct ad74413r_diag_channel_config diag_channel_configs[AD74413R_N_DIAG_CHANNELS]
Definition: iio_ad74413r.h:94
#define AD74413R_DAC_RESOLUTION
Definition: ad74413r.h:147
struct iio_hw_trig * trigger
Definition: iio_ad74413r.h:93
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
#define NO_OS_ARRAY_SIZE(x)
Definition: no_os_util.h:49
@ AD74413R_DIAG_AVSS
Definition: ad74413r.h:245
@ AD74413R_VOLTAGE_OUT
Definition: ad74413r.h:195
#define AD74413R_SLEW_EN_MASK
Definition: ad74413r.h:113
#define AD74413R_DIN_COMP_CH(x)
Definition: ad74413r.h:133
#define AD74413R_DIN_COMP_OUT
Definition: ad74413r.h:69
#define AD74413R_ADC_RESULT(x)
Definition: ad74413r.h:70
int ad74413r_remove(struct ad74413r_desc *desc)
Free the device descriptor.
Definition: ad74413r.c:1227
@ AD74413R_START_CONT
Definition: ad74413r.h:223
bool ch_out
Definition: iio_types.h:188
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.
Definition: ad74413r.c:882
@ IIO_SHARED_BY_ALL
Definition: iio_types.h:122
int channel
Definition: iio_types.h:174
int32_t(* pre_enable)(void *dev, uint32_t mask)
Definition: iio_types.h:274
@ AD74413R_STEP_64
Definition: ad74413r.h:270
int ad74413r_reg_write(struct ad74413r_desc *desc, uint32_t addr, uint16_t val)
Write a register's value.
Definition: ad74413r.c:248
@ AD74413R_DIAG_DVCC
Definition: ad74413r.h:250
const char * name
Definition: iio_types.h:131
#define AD74413R_ADC_CODE_MAX
Definition: ad74413r.h:150
#define AD74413R_DIAG_RESULT(x)
Definition: ad74413r.h:71
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.
Definition: ad74413r.c:705
enum ad74413r_op_mode function
Definition: ad74413r.h:315
int iio_trig_enable(void *trig)
Enable system interrupt which is linked to the given trigger.
Definition: iio_trigger.c:110
@ AD74413R_SENSEL_C
Definition: ad74413r.h:254
Structure used to store a set of channel specific to an operation mode.
Definition: iio_ad74413r.h:101
int ad74413r_iio_init(struct ad74413r_iio_desc **, struct ad74413r_iio_desc_init_param *)
Initializes the AD74413R IIO descriptor.
Definition: iio_ad74413r.c:1531
Structure holding pointers to show and store functions.
Definition: iio_types.h:129
AD74413r device descriptor.
Definition: ad74413r.h:349
@ AD74413R_LIN_RATE_150KHZ
Definition: ad74413r.h:282
Descriptor that stores a iio specific state.
Definition: iio_ad74413r.h:75
@ AD74413R_SENSEL_D
Definition: ad74413r.h:255
channel_type
Definition: iio_ad74413r.c:87
@ AD74413R_SENSEL_A
Definition: ad74413r.h:252
Header file of AD74413r Driver.
@ AD74413R_DIGITAL_INPUT
Definition: ad74413r.h:201
@ IIO_CURRENT
Definition: iio_types.h:66
int32_t iio_parse_value(char *buf, enum iio_val fmt, int32_t *val, int32_t *val2)
Definition: iio.c:630
struct ad74413r_init_param * ad74413r_init_param
Definition: iio_ad74413r.h:91
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.
Definition: ad74413r.c:633
#define AD74413R_COMP_THRESH_MASK
Definition: ad74413r.h:129
Init parameter for the iio descriptor.
Definition: iio_ad74413r.h:90
@ IIO_VOLTAGE
Definition: iio_types.h:65
@ AD74412R
Definition: ad74413r.h:176
int ad74413r_get_adc_rate(struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_adc_sample *val)
Get the ADC sample rate.
Definition: ad74413r.c:593
#define AD74413R_SENSE_RESISTOR_OHMS
Definition: ad74413r.h:169
int ad74413r_reg_update(struct ad74413r_desc *desc, uint32_t addr, uint16_t mask, uint16_t val)
Update a register's field.
Definition: ad74413r.c:289
struct iio_buffer * buffer
Definition: iio_types.h:228
Header file of the IIO AD74413r Driver.
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.
Definition: ad74413r.c:136
@ AD74413R_CURRENT_IN_LOOP
Definition: ad74413r.h:199
@ AD74413R_DIAG_AVDD
Definition: ad74413r.h:244
int ad74413r_set_adc_rate(struct ad74413r_desc *desc, uint32_t ch, enum ad74413r_adc_sample val)
Set the ADC sample rate.
Definition: ad74413r.c:613
int iio_format_value(char *buf, uint32_t len, enum iio_val fmt, int32_t size, int32_t *vals)
Definition: iio.c:686
int ad74413r_iio_init(struct ad74413r_iio_desc **iio_desc, struct ad74413r_iio_desc_init_param *init_param)
Initializes the AD74413R IIO descriptor.
Definition: iio_ad74413r.c:1531
@ AD74413R_RESISTANCE
Definition: ad74413r.h:200
#define AD74413R_DAC_CODE_MAX
Definition: ad74413r.h:148
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.
Definition: ad74413r.c:771
uint32_t address
Definition: iio_types.h:113
uint32_t no_os_field_get(uint32_t mask, uint32_t word)
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.
Definition: ad74413r.c:421
ad74413r_diag_mode
Possible values to be loaded in the DIAG_RESULT register.
Definition: ad74413r.h:241
@ AD74413R_CURRENT_IN_EXT
Definition: ad74413r.h:198
uint16_t num_ch
Definition: iio_types.h:252
#define NO_OS_BIT(x)
Definition: no_os_util.h:45
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
@ IIO_TEMP
Definition: iio_types.h:69
@ AD74413R_STOP_PWR_DOWN
Definition: ad74413r.h:224
enum iio_chan_type type
Definition: iio_types.h:109
unsigned int no_os_hweight8(uint8_t word)
@ AD74413R_DIAG_ALDO_1V8
Definition: ad74413r.h:248
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.
Definition: ad74413r.c:863
uint32_t active_channels
Definition: iio_ad74413r.h:78
#define NULL
Definition: wrapper.h:64
@ AD74413R_DIAG_TEMP
Definition: ad74413r.h:243
int scan_index
Definition: iio_types.h:182
int ad74413r_iio_remove(struct ad74413r_iio_desc *desc)
Free an iio descriptor.
Definition: iio_ad74413r.c:1582
int ad74413r_set_diag_channel_enable(struct ad74413r_desc *desc, uint32_t ch, bool status)
Enable conversions on a diagnostic register.
Definition: ad74413r.c:497
struct ad7616_init_param init_param
Definition: ad7616_sdz.c:113
#define AD74413R_DAC_RANGE
Definition: ad74413r.h:145
Structure holding channels and attributes of a device.
Definition: iio_types.h:247
#define AD74413R_DAC_CHANNEL(type)
Definition: iio_ad74413r.c:70
Device channel state.
Definition: ad74413r.h:313
@ AD74413R_DIGITAL_INPUT_LOOP
Definition: ad74413r.h:202
#define AD74413R_DAC_CODE(x)
Definition: ad74413r.h:63
@ AD74413R_LIN_RATE_4KHZ
Definition: ad74413r.h:280
#define AD74413R_OUTPUT_CONFIG(x)
Definition: ad74413r.h:62
@ AD74413R_DIAG_AGND
Definition: ad74413r.h:242
#define AD74413R_DIAG_ASSIGN_MASK(x)
Definition: ad74413r.h:142
@ AD74413R_HIGH_Z
Definition: ad74413r.h:194
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.
Definition: ad74413r.c:163
@ AD74413R_SENSEL_B
Definition: ad74413r.h:253
@ AD74413R_LIN_RATE_64KHZ
Definition: ad74413r.h:281
@ AD74413R_DIAG
Definition: iio_ad74413r.c:89
Definition: iio_types.h:151
@ AD74413R_DIAG_ALDO_5V
Definition: ad74413r.h:247
#define AD74413R_SLEW_LIN_RATE_MASK
Definition: ad74413r.h:115
struct ad74413r_channel_config channel_configs[AD74413R_N_CHANNELS]
Definition: iio_ad74413r.h:92
@ AD74413R_STEP_1820
Definition: ad74413r.h:273
int ad74413r_set_adc_channel_enable(struct ad74413r_desc *desc, uint32_t ch, bool status)
Enable/disable a specific ADC channel.
Definition: ad74413r.c:475
Header file of utility functions.
Definition: iio_types.h:226
struct iio_channel * channels
Definition: iio_ad74413r.h:102
@ AD74413R_LIN_RATE_240KHZ
Definition: ad74413r.h:283
#define AD74413R_DIAG_ASSIGN
Definition: ad74413r.h:68
#define AD74413R_CHANNELS(name)
Definition: iio_ad74413r.c:84
IIO hardware trigger structure.
Definition: iio_trigger.h:56
@ AD74413R_DIAG_REFOUT
Definition: ad74413r.h:246
@ IIO_SHARED_BY_DIR
Definition: iio_types.h:121
#define AD74413R_SLEW_LIN_STEP_MASK
Definition: ad74413r.h:114
unsigned long address
Definition: iio_types.h:180
int ad74413r_reg_read(struct ad74413r_desc *desc, uint32_t addr, uint16_t *val)
Read a register's value.
Definition: ad74413r.c:263
@ AD74413R_CURRENT_IN_LOOP_HART
Definition: ad74413r.h:204
int iio_buffer_push_scan(struct iio_buffer *buffer, void *data)
Definition: iio.c:1434
@ IIO_VAL_INT_MULTIPLE
Definition: iio_types.h:54
@ AD74413R_VOLTAGE_IN
Definition: ad74413r.h:197
ad74413r_adc_range
ADC ranges configurations. These are dependent on the operation mode.
Definition: ad74413r.h:210
enum ad74413r_conv_seq conv_state
Definition: iio_ad74413r.h:82
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.
Definition: ad74413r.c:653