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

Header file for ad469x Driver. More...

#include <stdbool.h>
#include "spi_engine.h"
#include "clk_axi_clkgen.h"
#include "no_os_pwm.h"
#include "no_os_gpio.h"
Include dependency graph for ad469x.h:

Classes

struct  ad469x_init_param
 Structure containing the init parameters needed by the ad469x device. More...
 
struct  ad469x_dev
 Structure representing an ad469x device. More...
 

Macros

#define AD469x_REG_IF_CONFIG_A   0x000
 
#define AD469x_REG_IF_CONFIG_B   0x001
 
#define AD469x_REG_DEVICE_TYPE   0x003
 
#define AD469x_REG_DEVICE_ID_L   0x004
 
#define AD469x_REG_DEVICE_ID_H   0x005
 
#define AD469x_REG_SCRATCH_PAD   0x00A
 
#define AD469x_REG_VENDOR_L   0x00C
 
#define AD469x_REG_VENDOR_H   0x00D
 
#define AD469x_REG_LOOP_MODE   0x00E
 
#define AD469x_REG_IF_CONFIG_C   0x010
 
#define AD469x_REG_IF_STATUS   0x011
 
#define AD469x_REG_STATUS   0x014
 
#define AD469x_REG_ALERT_STATUS1   0x015
 
#define AD469x_REG_ALERT_STATUS2   0x016
 
#define AD469x_REG_ALERT_STATUS3   0x017
 
#define AD469x_REG_ALERT_STATUS4   0x018
 
#define AD469x_REG_CLAMP_STATUS1   0x01A
 
#define AD469x_REG_CLAMP_STATUS2   0x01B
 
#define AD469x_REG_SETUP   0x020
 
#define AD469x_REG_REF_CTRL   0x021
 
#define AD469x_REG_SEQ_CTRL   0x022
 
#define AD469x_REG_AC_CTRL   0x023
 
#define AD469x_REG_STD_SEQ_CONFIG   0x024
 
#define AD469x_REG_GPIO_CTRL   0x026
 
#define AD469x_REG_GP_MODE   0x027
 
#define AD469x_REG_GPIO_STATE   0x028
 
#define AD469x_REG_TEMP_CTRL   0x029
 
#define AD469x_REG_CONFIG_IN(x)
 
#define AD469x_REG_THRESHOLD_UB(x)
 
#define AD469x_REG_THRESHOLD_LB(x)
 
#define AD469x_REG_HYST_IN(x)
 
#define AD469x_REG_OFFSET_IN(x)
 
#define AD469x_REG_GAIN_IN(x)
 
#define AD469x_REG_AS_SLOT(x)
 
#define AD469x_CMD_REG_CONFIG_MODE   (0x0A << 3)
 
#define AD469x_CMD_SEL_TEMP_SNSOR_CH   (0x0F << 3)
 
#define AD469x_CMD_CONFIG_CH_SEL(x)
 
#define AD469x_REG_STATUS_RESET_MASK   (0x01 << 5)
 
#define AD469x_SETUP_IF_MODE_MASK   (0x01 << 2)
 
#define AD469x_SETUP_IF_MODE_CONV   (0x01 << 2)
 
#define AD469x_SETUP_CYC_CTRL_MASK   (0x01 << 1)
 
#define AD469x_SETUP_CYC_CTRL_SINGLE(x)
 
#define AD469x_REG_REF_VREF_SET_MASK   (0x07 << 2)
 
#define AD469x_REG_REF_VREF_SET(x)
 
#define AD469x_REG_REF_VREF_REFHIZ_MASK   (0x07 << 1)
 
#define AD469x_REG_REF_VREF_REFHIZ(x)
 
#define AD469x_REG_REF_VREF_REFBUF_MASK   0x01
 
#define AD469x_REG_REF_VREF_REFBUF(x)
 
#define AD469x_GP_MODE_BUSY_GP_EN_MASK   (0x01 << 1)
 
#define AD469x_GP_MODE_BUSY_GP_EN(x)
 
#define AD469x_GP_MODE_BUSY_GP_SEL_MASK   (0x01 << 4)
 
#define AD469x_GP_MODE_BUSY_GP_SEL(x)
 
#define AD469x_SEQ_CTRL_STD_SEQ_EN_MASK   (0x01 << 7)
 
#define AD469x_SEQ_CTRL_STD_SEQ_EN(x)
 
#define AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK   (0x7f << 0)
 
#define AD469x_SEQ_CTRL_NUM_SLOTS_AS(x)
 
#define AD469x_REG_TEMP_CTRL_TEMP_EN_MASK   (0x01 << 0)
 
#define AD469x_REG_TEMP_CTRL_TEMP_EN(x)
 
#define AD469x_REG_AS_SLOT_INX(x)
 
#define AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK   (0x01 << 5)
 
#define AD469x_REG_IF_CONFIG_C_MB_STRICT(x)
 
#define AD469x_REG_CONFIG_IN_OSR_MASK   (0x03 << 0)
 
#define AD469x_REG_CONFIG_IN_OSR(x)
 
#define AD469x_REG_CONFIG_IN_HIZ_EN_MASK   (0x01 << 3)
 
#define AD469x_REG_CONFIG_IN_HIZ_EN(x)
 
#define AD469x_REG_CONFIG_IN_PAIR_MASK   (0x03 << 4)
 
#define AD469x_REG_CONFIG_IN_PAIR(x)
 
#define AD469x_REG_CONFIG_IN_MODE_MASK   (0x01 << 6)
 
#define AD469x_REG_CONFIG_IN_MODE(x)
 
#define AD469x_REG_CONFIG_IN_TD_EN_MASK   (0x01 << 7)
 
#define AD469x_REG_CONFIG_IN_TD_EN(x)
 
#define AD469x_CHANNEL(x)
 
#define AD469x_CHANNEL_NO   16
 
#define AD469x_SLOTS_NO   0x80
 

Enumerations

enum  ad469x_channel_sequencing {
  AD469x_single_cycle ,
  AD469x_two_cycle ,
  AD469x_standard_seq ,
  AD469x_advanced_seq
}
 Channel sequencing modes. More...
 
enum  ad469x_busy_gp_sel {
  AD469x_busy_gp0 = 0 ,
  AD469x_busy_gp3 = 1
}
 Busy state, possible general purpose pin selections. More...
 
enum  ad469x_reg_access {
  AD469x_BYTE_ACCESS ,
  AD469x_WORD_ACCESS
}
 Register access modes. More...
 
enum  ad469x_supported_dev_ids {
  ID_AD4695 ,
  ID_AD4696 ,
  ID_AD4697 ,
  ID_AD4698
}
 Supported devices. More...
 
enum  ad469x_osr_ratios {
  AD469x_OSR_1 ,
  AD469x_OSR_4 ,
  AD469x_OSR_16 ,
  AD469x_OSR_64
}
 Supported oversampling ratios. More...
 
enum  ad469x_pin_pairing {
  AD469x_INx_REF_GND ,
  AD469x_INx_COM ,
  AD469x_INx_EVEN_ODD
}
 Channel pin pairing options. More...
 
enum  ad469x_ref_set {
  AD469x_2P4_2P75 ,
  AD469x_2P75_3P25 ,
  AD469x_3P25_3P75 ,
  AD469x_3P75_4P5 ,
  AD469x_4P5_5P1
}
 Reference input range control. More...
 
enum  ad469x_ain_high_z {
  AD469x_AIN_HIGH_Z_DISABLE ,
  AD469x_AIN_HIGH_Z_ENABLE
}
 Analog input high impedance mode. More...
 

Functions

int32_t ad469x_spi_reg_read (struct ad469x_dev *dev, uint16_t reg_addr, uint8_t *reg_data)
 
int32_t ad469x_spi_reg_write (struct ad469x_dev *dev, uint16_t reg_addr, uint8_t reg_data)
 
int32_t ad469x_spi_read_mask (struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t *data)
 
int32_t ad469x_spi_write_mask (struct ad469x_dev *dev, uint16_t reg_addr, uint8_t mask, uint8_t data)
 
int32_t ad469x_read_data (struct ad469x_dev *dev, uint8_t channel, uint32_t *buf, uint16_t samples)
 Read from device. Enter register mode to read/write registers.
 
int32_t ad469x_seq_read_data (struct ad469x_dev *dev, uint32_t *buf, uint32_t samples)
 Read from device when converter has the channel sequencer activated. Enter register mode to read/write registers.
 
int32_t ad469x_set_channel_sequence (struct ad469x_dev *dev, enum ad469x_channel_sequencing seq)
 Set channel sequence.
 
int32_t ad469x_std_sequence_ch (struct ad469x_dev *dev, uint16_t ch_mask)
 Configure standard sequencer channels.
 
int32_t ad469x_adv_sequence_set_num_slots (struct ad469x_dev *dev, uint8_t num_slots)
 Configure advanced sequencer number of slots, temp channel not included.
 
int32_t ad469x_adv_sequence_set_slot (struct ad469x_dev *dev, uint8_t slot, uint8_t channel)
 Advanced sequencer, assign channel to a slot.
 
int32_t ad469x_sequence_enable_temp (struct ad469x_dev *dev)
 Enable temperature read at the end of the sequence, for standard and advanced sequencer.
 
int32_t ad469x_sequence_disable_temp (struct ad469x_dev *dev)
 Disable temperature read at the end of the sequence, for standard and advanced sequencer.
 
int32_t ad469x_adv_seq_osr (struct ad469x_dev *dev, uint16_t ch, enum ad469x_osr_ratios ratio)
 Configure over sampling ratio in advanced sequencer mode.
 
int32_t ad469x_std_seq_osr (struct ad469x_dev *dev, enum ad469x_osr_ratios ratio)
 Configure over sampling ratio in standard sequencer mode.
 
int32_t ad469x_std_pin_pairing (struct ad469x_dev *dev, enum ad469x_pin_pairing pin_pair)
 Configure the pin pairing option in standard sequencer mode.
 
int32_t ad469x_set_busy (struct ad469x_dev *dev, enum ad469x_busy_gp_sel gp_sel)
 Configure converter busy indicator to the output of the specified port.
 
int32_t ad469x_enter_conversion_mode (struct ad469x_dev *dev)
 Enter conversion mode. To exit conversion mode send a 5 bit conversion mode command AD469x_CMD_REG_CONFIG_MODE.
 
int32_t ad469x_exit_conversion_mode (struct ad469x_dev *dev)
 Exit conversion mode. Enter register mode to read/write registers.
 
int32_t ad469x_reset_dev (struct ad469x_dev *dev)
 Resets the ad469x device.
 
int32_t ad469x_config (struct ad469x_dev *dev, struct ad469x_init_param *config_desc)
 
int32_t ad469x_get_reference (struct ad469x_dev *device, enum ad469x_ref_set *ref_set)
 Get the value of reference.
 
int32_t ad469x_set_reference (struct ad469x_dev *device, enum ad469x_ref_set ref_set)
 Set the value of reference.
 
int32_t ad469x_configure_ain_high_z (struct ad469x_dev *dev, uint8_t ch, enum ad469x_ain_high_z status)
 Configure analog input high Z mode.
 
int32_t ad469x_get_ain_high_z_status (struct ad469x_dev *dev, uint8_t ch, enum ad469x_ain_high_z *status)
 Get the status of analog input high Z mode.
 
int32_t ad469x_get_num_channels (struct ad469x_dev *dev, uint8_t *num_channels)
 
bool ad469x_is_temp_channel (struct ad469x_dev *dev, uint8_t channel)
 
int32_t ad469x_init (struct ad469x_dev **device, struct ad469x_init_param *init_param)
 
int32_t ad469x_remove (struct ad469x_dev *dev)
 Free the memory allocated by ad469x_init().
 

Detailed Description

Header file for ad469x Driver.

Author
Cristian Pop (crist.nosp@m.ian..nosp@m.pop@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2020-22(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ AD469x_CHANNEL

#define AD469x_CHANNEL ( x)
Value:
(NO_OS_BIT(x) & 0xFFFF)
#define NO_OS_BIT(x)
Definition no_os_util.h:23

◆ AD469x_CHANNEL_NO

#define AD469x_CHANNEL_NO   16

◆ AD469x_CMD_CONFIG_CH_SEL

#define AD469x_CMD_CONFIG_CH_SEL ( x)
Value:
((0x10 | (0x0F & x)) << 3)

◆ AD469x_CMD_REG_CONFIG_MODE

#define AD469x_CMD_REG_CONFIG_MODE   (0x0A << 3)

◆ AD469x_CMD_SEL_TEMP_SNSOR_CH

#define AD469x_CMD_SEL_TEMP_SNSOR_CH   (0x0F << 3)

◆ AD469x_GP_MODE_BUSY_GP_EN

#define AD469x_GP_MODE_BUSY_GP_EN ( x)
Value:
((x & 0x01) << 1)

◆ AD469x_GP_MODE_BUSY_GP_EN_MASK

#define AD469x_GP_MODE_BUSY_GP_EN_MASK   (0x01 << 1)

◆ AD469x_GP_MODE_BUSY_GP_SEL

#define AD469x_GP_MODE_BUSY_GP_SEL ( x)
Value:
((x & 0x01) << 4)

◆ AD469x_GP_MODE_BUSY_GP_SEL_MASK

#define AD469x_GP_MODE_BUSY_GP_SEL_MASK   (0x01 << 4)

◆ AD469x_REG_AC_CTRL

#define AD469x_REG_AC_CTRL   0x023

◆ AD469x_REG_ALERT_STATUS1

#define AD469x_REG_ALERT_STATUS1   0x015

◆ AD469x_REG_ALERT_STATUS2

#define AD469x_REG_ALERT_STATUS2   0x016

◆ AD469x_REG_ALERT_STATUS3

#define AD469x_REG_ALERT_STATUS3   0x017

◆ AD469x_REG_ALERT_STATUS4

#define AD469x_REG_ALERT_STATUS4   0x018

◆ AD469x_REG_AS_SLOT

#define AD469x_REG_AS_SLOT ( x)
Value:
((x & 0x7F) | 0x100)

◆ AD469x_REG_AS_SLOT_INX

#define AD469x_REG_AS_SLOT_INX ( x)
Value:
((x & 0x0f) << 0)

◆ AD469x_REG_CLAMP_STATUS1

#define AD469x_REG_CLAMP_STATUS1   0x01A

◆ AD469x_REG_CLAMP_STATUS2

#define AD469x_REG_CLAMP_STATUS2   0x01B

◆ AD469x_REG_CONFIG_IN

#define AD469x_REG_CONFIG_IN ( x)
Value:
((x & 0x0F) | 0x30)

◆ AD469x_REG_CONFIG_IN_HIZ_EN

#define AD469x_REG_CONFIG_IN_HIZ_EN ( x)
Value:
((x & 0x01) << 3)

◆ AD469x_REG_CONFIG_IN_HIZ_EN_MASK

#define AD469x_REG_CONFIG_IN_HIZ_EN_MASK   (0x01 << 3)

◆ AD469x_REG_CONFIG_IN_MODE

#define AD469x_REG_CONFIG_IN_MODE ( x)
Value:
((x & 0x01) << 6)

◆ AD469x_REG_CONFIG_IN_MODE_MASK

#define AD469x_REG_CONFIG_IN_MODE_MASK   (0x01 << 6)

◆ AD469x_REG_CONFIG_IN_OSR

#define AD469x_REG_CONFIG_IN_OSR ( x)
Value:
((x & 0x03) << 0)

◆ AD469x_REG_CONFIG_IN_OSR_MASK

#define AD469x_REG_CONFIG_IN_OSR_MASK   (0x03 << 0)

◆ AD469x_REG_CONFIG_IN_PAIR

#define AD469x_REG_CONFIG_IN_PAIR ( x)
Value:
((x & 0x03) << 4)

◆ AD469x_REG_CONFIG_IN_PAIR_MASK

#define AD469x_REG_CONFIG_IN_PAIR_MASK   (0x03 << 4)

◆ AD469x_REG_CONFIG_IN_TD_EN

#define AD469x_REG_CONFIG_IN_TD_EN ( x)
Value:
((x & 0x01) << 7)

◆ AD469x_REG_CONFIG_IN_TD_EN_MASK

#define AD469x_REG_CONFIG_IN_TD_EN_MASK   (0x01 << 7)

◆ AD469x_REG_DEVICE_ID_H

#define AD469x_REG_DEVICE_ID_H   0x005

◆ AD469x_REG_DEVICE_ID_L

#define AD469x_REG_DEVICE_ID_L   0x004

◆ AD469x_REG_DEVICE_TYPE

#define AD469x_REG_DEVICE_TYPE   0x003

◆ AD469x_REG_GAIN_IN

#define AD469x_REG_GAIN_IN ( x)
Value:
((x << 1) | 0x0C0)

◆ AD469x_REG_GP_MODE

#define AD469x_REG_GP_MODE   0x027

◆ AD469x_REG_GPIO_CTRL

#define AD469x_REG_GPIO_CTRL   0x026

◆ AD469x_REG_GPIO_STATE

#define AD469x_REG_GPIO_STATE   0x028

◆ AD469x_REG_HYST_IN

#define AD469x_REG_HYST_IN ( x)
Value:
((x << 1) | 0x80)

◆ AD469x_REG_IF_CONFIG_A

#define AD469x_REG_IF_CONFIG_A   0x000

◆ AD469x_REG_IF_CONFIG_B

#define AD469x_REG_IF_CONFIG_B   0x001

◆ AD469x_REG_IF_CONFIG_C

#define AD469x_REG_IF_CONFIG_C   0x010

◆ AD469x_REG_IF_CONFIG_C_MB_STRICT

#define AD469x_REG_IF_CONFIG_C_MB_STRICT ( x)
Value:
((x & 0x01) << 5)

◆ AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK

#define AD469x_REG_IF_CONFIG_C_MB_STRICT_MASK   (0x01 << 5)

◆ AD469x_REG_IF_STATUS

#define AD469x_REG_IF_STATUS   0x011

◆ AD469x_REG_LOOP_MODE

#define AD469x_REG_LOOP_MODE   0x00E

◆ AD469x_REG_OFFSET_IN

#define AD469x_REG_OFFSET_IN ( x)
Value:
((x << 1) | 0xA0)

◆ AD469x_REG_REF_CTRL

#define AD469x_REG_REF_CTRL   0x021

◆ AD469x_REG_REF_VREF_REFBUF

#define AD469x_REG_REF_VREF_REFBUF ( x)
Value:
(x & 0x01)

◆ AD469x_REG_REF_VREF_REFBUF_MASK

#define AD469x_REG_REF_VREF_REFBUF_MASK   0x01

◆ AD469x_REG_REF_VREF_REFHIZ

#define AD469x_REG_REF_VREF_REFHIZ ( x)
Value:
((x & 0x01) << 1)

◆ AD469x_REG_REF_VREF_REFHIZ_MASK

#define AD469x_REG_REF_VREF_REFHIZ_MASK   (0x07 << 1)

◆ AD469x_REG_REF_VREF_SET

#define AD469x_REG_REF_VREF_SET ( x)
Value:
((x & 0x07) << 2)

◆ AD469x_REG_REF_VREF_SET_MASK

#define AD469x_REG_REF_VREF_SET_MASK   (0x07 << 2)

◆ AD469x_REG_SCRATCH_PAD

#define AD469x_REG_SCRATCH_PAD   0x00A

◆ AD469x_REG_SEQ_CTRL

#define AD469x_REG_SEQ_CTRL   0x022

◆ AD469x_REG_SETUP

#define AD469x_REG_SETUP   0x020

◆ AD469x_REG_STATUS

#define AD469x_REG_STATUS   0x014

◆ AD469x_REG_STATUS_RESET_MASK

#define AD469x_REG_STATUS_RESET_MASK   (0x01 << 5)

◆ AD469x_REG_STD_SEQ_CONFIG

#define AD469x_REG_STD_SEQ_CONFIG   0x024

◆ AD469x_REG_TEMP_CTRL

#define AD469x_REG_TEMP_CTRL   0x029

◆ AD469x_REG_TEMP_CTRL_TEMP_EN

#define AD469x_REG_TEMP_CTRL_TEMP_EN ( x)
Value:
((x & 0x01) << 0)

◆ AD469x_REG_TEMP_CTRL_TEMP_EN_MASK

#define AD469x_REG_TEMP_CTRL_TEMP_EN_MASK   (0x01 << 0)

◆ AD469x_REG_THRESHOLD_LB

#define AD469x_REG_THRESHOLD_LB ( x)
Value:
((x << 1) | 0x60)

◆ AD469x_REG_THRESHOLD_UB

#define AD469x_REG_THRESHOLD_UB ( x)
Value:
((x << 1) | 0x40)

◆ AD469x_REG_VENDOR_H

#define AD469x_REG_VENDOR_H   0x00D

◆ AD469x_REG_VENDOR_L

#define AD469x_REG_VENDOR_L   0x00C

◆ AD469x_SEQ_CTRL_NUM_SLOTS_AS

#define AD469x_SEQ_CTRL_NUM_SLOTS_AS ( x)
Value:
((x & 0x7f) << 0)

◆ AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK

#define AD469x_SEQ_CTRL_NUM_SLOTS_AS_MASK   (0x7f << 0)

◆ AD469x_SEQ_CTRL_STD_SEQ_EN

#define AD469x_SEQ_CTRL_STD_SEQ_EN ( x)
Value:
((x & 0x01) << 7)

◆ AD469x_SEQ_CTRL_STD_SEQ_EN_MASK

#define AD469x_SEQ_CTRL_STD_SEQ_EN_MASK   (0x01 << 7)

◆ AD469x_SETUP_CYC_CTRL_MASK

#define AD469x_SETUP_CYC_CTRL_MASK   (0x01 << 1)

◆ AD469x_SETUP_CYC_CTRL_SINGLE

#define AD469x_SETUP_CYC_CTRL_SINGLE ( x)
Value:
((x & 0x01) << 1)

◆ AD469x_SETUP_IF_MODE_CONV

#define AD469x_SETUP_IF_MODE_CONV   (0x01 << 2)

◆ AD469x_SETUP_IF_MODE_MASK

#define AD469x_SETUP_IF_MODE_MASK   (0x01 << 2)

◆ AD469x_SLOTS_NO

#define AD469x_SLOTS_NO   0x80

Enumeration Type Documentation

◆ ad469x_ain_high_z

Analog input high impedance mode.

Enumerator
AD469x_AIN_HIGH_Z_DISABLE 
AD469x_AIN_HIGH_Z_ENABLE 

◆ ad469x_busy_gp_sel

Busy state, possible general purpose pin selections.

Enumerator
AD469x_busy_gp0 

Busy on gp0

AD469x_busy_gp3 

Busy on gp3

◆ ad469x_channel_sequencing

Channel sequencing modes.

Enumerator
AD469x_single_cycle 

Single cycle read

AD469x_two_cycle 

Two cycle read

AD469x_standard_seq 

Sequence trough channels, standard mode

AD469x_advanced_seq 

Sequence trough channels, advanced mode

◆ ad469x_osr_ratios

Supported oversampling ratios.

Enumerator
AD469x_OSR_1 
AD469x_OSR_4 
AD469x_OSR_16 
AD469x_OSR_64 

◆ ad469x_pin_pairing

Channel pin pairing options.

Enumerator
AD469x_INx_REF_GND 
AD469x_INx_COM 
AD469x_INx_EVEN_ODD 

◆ ad469x_ref_set

Reference input range control.

Enumerator
AD469x_2P4_2P75 
AD469x_2P75_3P25 
AD469x_3P25_3P75 
AD469x_3P75_4P5 
AD469x_4P5_5P1 

◆ ad469x_reg_access

Register access modes.

Enumerator
AD469x_BYTE_ACCESS 
AD469x_WORD_ACCESS 

◆ ad469x_supported_dev_ids

Supported devices.

Enumerator
ID_AD4695 
ID_AD4696 
ID_AD4697 
ID_AD4698 

Function Documentation

◆ ad469x_adv_seq_osr()

int32_t ad469x_adv_seq_osr ( struct ad469x_dev * dev,
uint16_t ch,
enum ad469x_osr_ratios ratio )

Configure over sampling ratio in advanced sequencer mode.

Parameters
[in]dev- ad469x_dev device handler.
[in]ch- Channel to configure.
[in]ratio- OSR ratio.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_adv_sequence_set_num_slots()

int32_t ad469x_adv_sequence_set_num_slots ( struct ad469x_dev * dev,
uint8_t num_slots )

Configure advanced sequencer number of slots, temp channel not included.

Parameters
[in]dev- ad469x_dev device handler.
[in]num_slots- Number of slots, max value = 0x7f
Returns
0 in case of success, -1 otherwise.

◆ ad469x_adv_sequence_set_slot()

int32_t ad469x_adv_sequence_set_slot ( struct ad469x_dev * dev,
uint8_t slot,
uint8_t channel )

Advanced sequencer, assign channel to a slot.

Parameters
[in]dev- ad469x_dev device handler.
[in]slot- Slot number [0x00, 0x7f]
[in]channel- Assigned channel [0x00, 0x0f].
Returns
0 in case of success, -1 otherwise.

◆ ad469x_config()

int32_t ad469x_config ( struct ad469x_dev * dev,
struct ad469x_init_param * config_desc )

Configure the device with initial parameters.

Parameters
[in,out]dev- The device structure.
[in]config_desc- Pointer to structure containing configuration parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_configure_ain_high_z()

int32_t ad469x_configure_ain_high_z ( struct ad469x_dev * dev,
uint8_t ch,
enum ad469x_ain_high_z status )

Configure analog input high Z mode.

Parameters
devThe device structure
chChannel ID
statusStatus of analog input high Z bit
Returns
0 in case of success, negative error code otherwise

◆ ad469x_enter_conversion_mode()

int32_t ad469x_enter_conversion_mode ( struct ad469x_dev * dev)

Enter conversion mode. To exit conversion mode send a 5 bit conversion mode command AD469x_CMD_REG_CONFIG_MODE.

Parameters
[in]dev- ad469x_dev device handler.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_exit_conversion_mode()

int32_t ad469x_exit_conversion_mode ( struct ad469x_dev * dev)

Exit conversion mode. Enter register mode to read/write registers.

Parameters
[in]dev- ad469x_dev device handler.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_get_ain_high_z_status()

int32_t ad469x_get_ain_high_z_status ( struct ad469x_dev * dev,
uint8_t ch,
enum ad469x_ain_high_z * status )

Get the status of analog input high Z mode.

Parameters
devThe device structure
chChannel ID
statusStatus of analog input high Z bit
Returns
0 in case of success, negative error code otherwise

◆ ad469x_get_num_channels()

int32_t ad469x_get_num_channels ( struct ad469x_dev * dev,
uint8_t * num_channels )

◆ ad469x_get_reference()

int32_t ad469x_get_reference ( struct ad469x_dev * device,
enum ad469x_ref_set * ref_set )

Get the value of reference.

Parameters
deviceAD469x Device instance.
ref_setValue of VREF_SET
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_init()

int32_t ad469x_init ( struct ad469x_dev ** device,
struct ad469x_init_param * init_param )

Initialize the device.

Parameters
[out]device- The device structure.
[in]init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_is_temp_channel()

bool ad469x_is_temp_channel ( struct ad469x_dev * dev,
uint8_t channel )

◆ ad469x_read_data()

int32_t ad469x_read_data ( struct ad469x_dev * dev,
uint8_t channel,
uint32_t * buf,
uint16_t samples )

Read from device. Enter register mode to read/write registers.

Parameters
[in]dev- ad469x_dev device handler.
[in]channel- ad469x selected channel.
[out]buf- data buffer.
[in]samples- sample number.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_remove()

int32_t ad469x_remove ( struct ad469x_dev * dev)

Free the memory allocated by ad469x_init().

Parameters
[in]dev- Pointer to the device handler.
Returns
0 in case of success, -1 otherwise

◆ ad469x_reset_dev()

int32_t ad469x_reset_dev ( struct ad469x_dev * dev)

Resets the ad469x device.

Parameters
[in]dev- ad469x_dev device handler.
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_seq_read_data()

int32_t ad469x_seq_read_data ( struct ad469x_dev * dev,
uint32_t * buf,
uint32_t samples )

Read from device when converter has the channel sequencer activated. Enter register mode to read/write registers.

Parameters
[in]dev- ad469x_dev device handler.
[out]buf- data buffer.
[in]samples- Number of samples per channel. For example, if with ad469x_std_sequence_ch 2 channel where activated, buf will be filled with 10 samples for each of them. If temp is enable, the there will be an other 10 samples for temperature
Returns
0 in case of success, -1 otherwise.

◆ ad469x_sequence_disable_temp()

int32_t ad469x_sequence_disable_temp ( struct ad469x_dev * dev)

Disable temperature read at the end of the sequence, for standard and advanced sequencer.

Parameters
[in]dev- ad469x_dev device handler.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_sequence_enable_temp()

int32_t ad469x_sequence_enable_temp ( struct ad469x_dev * dev)

Enable temperature read at the end of the sequence, for standard and advanced sequencer.

Parameters
[in]dev- ad469x_dev device handler.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_set_busy()

int32_t ad469x_set_busy ( struct ad469x_dev * dev,
enum ad469x_busy_gp_sel gp_sel )

Configure converter busy indicator to the output of the specified port.

Parameters
[in]dev- ad469x_dev device handler.
[in]gp_sel- Port.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_set_channel_sequence()

int32_t ad469x_set_channel_sequence ( struct ad469x_dev * dev,
enum ad469x_channel_sequencing seq )

Set channel sequence.

Parameters
[in]dev- ad469x_dev device handler.
[in]seq- Channel sequence.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_set_reference()

int32_t ad469x_set_reference ( struct ad469x_dev * device,
enum ad469x_ref_set ref_set )

Set the value of reference.

Parameters
deviceAD469x Device instance.
ref_setValue of VREF_SET
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_spi_read_mask()

int32_t ad469x_spi_read_mask ( struct ad469x_dev * dev,
uint16_t reg_addr,
uint8_t mask,
uint8_t * data )

SPI read from device using a mask.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- The mask.
data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_spi_reg_read()

int32_t ad469x_spi_reg_read ( struct ad469x_dev * dev,
uint16_t reg_addr,
uint8_t * reg_data )

Read from device.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_spi_reg_write()

int32_t ad469x_spi_reg_write ( struct ad469x_dev * dev,
uint16_t reg_addr,
uint8_t reg_data )

Write to device.

Parameters
dev- The device structure.
reg_addr- The register address.
reg_data- The register data. @eturn 0 in case of success, negative error code otherwise.

◆ ad469x_spi_write_mask()

int32_t ad469x_spi_write_mask ( struct ad469x_dev * dev,
uint16_t reg_addr,
uint8_t mask,
uint8_t data )

SPI write to device using a mask.

Parameters
dev- The device structure.
reg_addr- The register address.
mask- The mask.
data- The register data.
Returns
0 in case of success, negative error code otherwise.

◆ ad469x_std_pin_pairing()

int32_t ad469x_std_pin_pairing ( struct ad469x_dev * dev,
enum ad469x_pin_pairing pin_pair )

Configure the pin pairing option in standard sequencer mode.

Parameters
[in]dev- ad469x_dev device handler.
[in]pin_pair- Pin pairing selection.
Returns
0 in case of success, negative error code otherwise.
Note
In standard sequencer the pin pair option is common for all channels.

◆ ad469x_std_seq_osr()

int32_t ad469x_std_seq_osr ( struct ad469x_dev * dev,
enum ad469x_osr_ratios ratio )

Configure over sampling ratio in standard sequencer mode.

Parameters
[in]dev- ad469x_dev device handler.
[in]ratio- OSR ratio.
Returns
0 in case of success, -1 otherwise.

◆ ad469x_std_sequence_ch()

int32_t ad469x_std_sequence_ch ( struct ad469x_dev * dev,
uint16_t ch_mask )

Configure standard sequencer channels.

Parameters
[in]dev- ad469x_dev device handler.
[in]ch_mask- Extra channels to activate.
Returns
0 in case of success, -1 otherwise.