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

Header file of AD7490 Driver. More...

#include <stdlib.h>
#include "no_os_spi.h"
#include "no_os_util.h"
Include dependency graph for ad7490.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ad7490_init_param
 
struct  ad7490_desc
 

Macros

#define AD7490_LOW_BYTE_MASK   NO_OS_GENMASK(7, 0)
 
#define AD7490_HIGH_BYTE_MASK   NO_OS_GENMASK(15, 8)
 
#define AD7490_VAL_MASK   NO_OS_GENMASK(11, 0)
 
#define AD7490_WRITE_MASK   NO_OS_BIT(11)
 
#define AD7490_SEQ_MASK   NO_OS_BIT(10)
 
#define AD7490_ADD_MASK   NO_OS_GENMASK(9, 6)
 
#define AD7490_PM_MASK   NO_OS_GENMASK(5, 4)
 
#define AD7490_SHADOW_MASK   NO_OS_BIT(3)
 
#define AD7490_WEAKTRI_MASK   NO_OS_BIT(2)
 
#define AD7490_RANGE_MASK   NO_OS_BIT(1)
 
#define AD7490_CODING_MASK   NO_OS_BIT(0)
 
#define AD7490_CFG_MASK   NO_OS_GENMASK(2, 0)
 

Enumerations

enum  ad7490_vdd {
  AD7490_VDD_3V3 ,
  AD7490_VDD_5V
}
 
enum  ad7490_address {
  AD7490_CHAN_ADDR_VIN0 ,
  AD7490_CHAN_ADDR_VIN1 ,
  AD7490_CHAN_ADDR_VIN2 ,
  AD7490_CHAN_ADDR_VIN3 ,
  AD7490_CHAN_ADDR_VIN4 ,
  AD7490_CHAN_ADDR_VIN5 ,
  AD7490_CHAN_ADDR_VIN6 ,
  AD7490_CHAN_ADDR_VIN7 ,
  AD7490_CHAN_ADDR_VIN8 ,
  AD7490_CHAN_ADDR_VIN9 ,
  AD7490_CHAN_ADDR_VIN10 ,
  AD7490_CHAN_ADDR_VIN11 ,
  AD7490_CHAN_ADDR_VIN12 ,
  AD7490_CHAN_ADDR_VIN13 ,
  AD7490_CHAN_ADDR_VIN14 ,
  AD7490_CHAN_ADDR_VIN15 ,
  AD7490_CHAN_OFF
}
 
enum  ad7490_op_mode {
  AD7490_MODE_AUTOSTANDBY ,
  AD7490_MODE_AUTOSHUTDOWN ,
  AD7490_MODE_FULLSHUTDOWN ,
  AD7490_MODE_NORMAL
}
 
enum  ad7490_dout_state {
  AD7490_DOUT_TRISTATE ,
  AD7490_DOUT_WEAK
}
 
enum  ad7490_range {
  AD7490_RANGE_2XREFIN ,
  AD7490_RANGE_REFIN
}
 
enum  ad7490_coding {
  AD7490_CODING_TWOS ,
  AD7490_CODING_BINARY
}
 
enum  ad7490_seq_op {
  AD7490_NO_SEQ ,
  AD7490_SHADOW_SEQ ,
  AD7490_CONTROL_SEQ ,
  AD7490_CONSECUTIVE_SEQ
}
 

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

Header 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.

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

◆ AD7490_ADD_MASK

#define AD7490_ADD_MASK   NO_OS_GENMASK(9, 6)

◆ AD7490_CFG_MASK

#define AD7490_CFG_MASK   NO_OS_GENMASK(2, 0)

◆ AD7490_CODING_MASK

#define AD7490_CODING_MASK   NO_OS_BIT(0)

◆ AD7490_HIGH_BYTE_MASK

#define AD7490_HIGH_BYTE_MASK   NO_OS_GENMASK(15, 8)

◆ AD7490_LOW_BYTE_MASK

#define AD7490_LOW_BYTE_MASK   NO_OS_GENMASK(7, 0)

◆ AD7490_PM_MASK

#define AD7490_PM_MASK   NO_OS_GENMASK(5, 4)

◆ AD7490_RANGE_MASK

#define AD7490_RANGE_MASK   NO_OS_BIT(1)

◆ AD7490_SEQ_MASK

#define AD7490_SEQ_MASK   NO_OS_BIT(10)

◆ AD7490_SHADOW_MASK

#define AD7490_SHADOW_MASK   NO_OS_BIT(3)

◆ AD7490_VAL_MASK

#define AD7490_VAL_MASK   NO_OS_GENMASK(11, 0)

◆ AD7490_WEAKTRI_MASK

#define AD7490_WEAKTRI_MASK   NO_OS_BIT(2)

◆ AD7490_WRITE_MASK

#define AD7490_WRITE_MASK   NO_OS_BIT(11)

Enumeration Type Documentation

◆ ad7490_address

Enumerator
AD7490_CHAN_ADDR_VIN0 
AD7490_CHAN_ADDR_VIN1 
AD7490_CHAN_ADDR_VIN2 
AD7490_CHAN_ADDR_VIN3 
AD7490_CHAN_ADDR_VIN4 
AD7490_CHAN_ADDR_VIN5 
AD7490_CHAN_ADDR_VIN6 
AD7490_CHAN_ADDR_VIN7 
AD7490_CHAN_ADDR_VIN8 
AD7490_CHAN_ADDR_VIN9 
AD7490_CHAN_ADDR_VIN10 
AD7490_CHAN_ADDR_VIN11 
AD7490_CHAN_ADDR_VIN12 
AD7490_CHAN_ADDR_VIN13 
AD7490_CHAN_ADDR_VIN14 
AD7490_CHAN_ADDR_VIN15 
AD7490_CHAN_OFF 

◆ ad7490_coding

Enumerator
AD7490_CODING_TWOS 
AD7490_CODING_BINARY 

◆ ad7490_dout_state

Enumerator
AD7490_DOUT_TRISTATE 
AD7490_DOUT_WEAK 

◆ ad7490_op_mode

Enumerator
AD7490_MODE_AUTOSTANDBY 
AD7490_MODE_AUTOSHUTDOWN 
AD7490_MODE_FULLSHUTDOWN 
AD7490_MODE_NORMAL 

◆ ad7490_range

Enumerator
AD7490_RANGE_2XREFIN 
AD7490_RANGE_REFIN 

◆ ad7490_seq_op

Enumerator
AD7490_NO_SEQ 
AD7490_SHADOW_SEQ 
AD7490_CONTROL_SEQ 
AD7490_CONSECUTIVE_SEQ 

◆ ad7490_vdd

enum ad7490_vdd
Enumerator
AD7490_VDD_3V3 
AD7490_VDD_5V 

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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function:

◆ 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.
Here is the caller graph for this function: