no-OS
Loading...
Searching...
No Matches
ad7490.c File Reference

Source file of AD7490 Driver. More...

#include "ad7490.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_delay.h"
Include dependency graph for ad7490.c:

Macros

#define AD7490_DUMMY_TRANSFER   0xFFFF
 

Functions

int ad7490_set_op_mode (struct ad7490_desc *desc, enum ad7490_op_mode op_mode)
 Set AD7490 operating mode.
 
int ad7490_config (struct ad7490_desc *desc, enum ad7490_dout_state dout_state, enum ad7490_range range, enum ad7490_coding coding)
 Config DOUT state, range and coding of the AD7490.
 
int ad7490_read_ch (struct ad7490_desc *desc, enum ad7490_address channel, int16_t *val)
 Read single cannel raw value.
 
int ad7490_start_seq (struct ad7490_desc *desc, enum ad7490_seq_op seq_op, uint16_t channels, enum ad7490_address last_chan)
 Start AD7490 SEQUENCER using desired type.
 
int ad7490_change_seq (struct ad7490_desc *desc, enum ad7490_seq_op seq_op, enum ad7490_coding coding, enum ad7490_range range)
 Change AD7490 SEQUENCER type while it is active.
 
int ad7490_stop_seq (struct ad7490_desc *desc)
 Stop AD7490 SEQUENCER.
 
int ad7490_read_seq (struct ad7490_desc *desc, int16_t *channels_val)
 Read selected channels of the SEQUENCER raw values.
 
int ad7490_init (struct ad7490_desc **desc, struct ad7490_init_param *init_param)
 AD7490 Initialization function.
 
int ad7490_remove (struct ad7490_desc *desc)
 Free the resources allocated by initialization.
 

Detailed Description

Source file of AD7490 Driver.

Author
Radu Sabau (radu..nosp@m.saba.nosp@m.u@ana.nosp@m.log..nosp@m.com)

Copyright 2025(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD7490_DUMMY_TRANSFER

#define AD7490_DUMMY_TRANSFER   0xFFFF

Function Documentation

◆ ad7490_change_seq()

int ad7490_change_seq ( struct ad7490_desc * desc,
enum ad7490_seq_op seq_op,
enum ad7490_coding coding,
enum ad7490_range range )

Change AD7490 SEQUENCER type while it is active.

Parameters
desc- AD7490 device descriptor.
seq_op- Selected SEQUENCER type to change to.
coding- If CONTROL sequencer is selected, coding is requested.
range-If CONTROL sequencer is selected, range is requested.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_config()

int ad7490_config ( struct ad7490_desc * desc,
enum ad7490_dout_state dout_state,
enum ad7490_range range,
enum ad7490_coding coding )

Config DOUT state, range and coding of the AD7490.

Parameters
desc- AD7490 device descriptor.
dout_state- Selected DOUT state.
range- Selected range (REFIN or 2xREFIN)
coding- Selected coding style (binary or twos)
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_init()

int ad7490_init ( struct ad7490_desc ** desc,
struct ad7490_init_param * init_param )

AD7490 Initialization function.

Parameters
desc- AD7490 device descriptor.
init_param- AD7490 initialization parameter.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_read_ch()

int ad7490_read_ch ( struct ad7490_desc * desc,
enum ad7490_address channel,
int16_t * val )

Read single cannel raw value.

Parameters
desc- AD7490 device descriptor.
channel- Selected channel for value reading.
val- Pointer to the selected channel's raw value.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_read_seq()

int ad7490_read_seq ( struct ad7490_desc * desc,
int16_t * channels_val )

Read selected channels of the SEQUENCER raw values.

Parameters
desc- AD7490 device descriptor.
channels_val- Pointer to selected channels raw values array. Raw channels values are to be transmitted consecutive (e.g. if channels 0, 3, and 7 are selected, channels_val becomes an array with 3 elements, and index 0 is for channel 0, index 1 for channel 3, and index 2 for channel 7).
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_remove()

int ad7490_remove ( struct ad7490_desc * desc)

Free the resources allocated by initialization.

Parameters
desc- AD7490 device descriptor.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_set_op_mode()

int ad7490_set_op_mode ( struct ad7490_desc * desc,
enum ad7490_op_mode op_mode )

Set AD7490 operating mode.

Parameters
desc- AD7490 device descriptor
op_mode- Selected operating mode.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_start_seq()

int ad7490_start_seq ( struct ad7490_desc * desc,
enum ad7490_seq_op seq_op,
uint16_t channels,
enum ad7490_address last_chan )

Start AD7490 SEQUENCER using desired type.

Parameters
desc- AD7490 device descriptor.
seq_op- Selected SEQUENCER type.
channels- 16 bit channel mask for channel selection (1 = ON, 0 = OFF)
last_chan- In case CONSECUTIVE sequencer typee is selected, last channel is needed for conversion and all channels until the last one will be then selected.
Returns
0 in case of success, negative error code otherwise.

◆ ad7490_stop_seq()

int ad7490_stop_seq ( struct ad7490_desc * desc)

Stop AD7490 SEQUENCER.

Parameters
desc- AD7490 device descriptor.
Returns
0 in case of success, negative error code otherwise.