precision-converters-firmware
Macros | Functions
ad7124_support.h File Reference

: Provides useful support functions for the AD7124 NoOS driver More...

#include "ad7124.h"
#include "no_os_util.h"
Include dependency graph for ad7124_support.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define AD7124_PGA_GAIN(x)   (1 << (x))
 
#define AD7124_REF_VOLTAGE   2.5
 
#define AD7124_ADC_N_BITS   24
 
#define AD7124_ADC_CTRL_REG_POWER_MODE_MSK   NO_OS_GENMASK(7,6)
 
#define AD7124_ADC_CTRL_REG_POWER_MODE_RD(x)   (((x) >> 6) & 0x3)
 
#define AD7124_ADC_CTRL_REG_MSK   NO_OS_GENMASK(5,2)
 
#define AD7124_CH_MAP_REG_CH_ENABLE_RD(x)   (((x) >> 15) & 0x1)
 
#define AD7124_CH_MAP_REG_SETUP_MSK   NO_OS_GENMASK(14, 12)
 
#define AD7124_CH_MAP_REG_SETUP_RD(x)   (((x) >> 12) & 0x7)
 
#define AD7124_CH_MAP_REG_AINP_MSK   NO_OS_GENMASK(9, 5)
 
#define AD7124_CH_MAP_REG_AINP_RD(x)   (((x) >> 5) & 0x1F)
 
#define AD7124_CH_MAP_REG_AINM_MSK   NO_OS_GENMASK(4, 0)
 
#define AD7124_CH_MAP_REG_AINM_RD(x)   (((x) >> 0) & 0x1F)
 
#define AD7124_CFG_REG_BIPOLAR_RD(x)   (((x) >> 11) & 0x1)
 
#define AD7124_CFG_REG_REF_BUFP_RD(x)   (((x) >> 8) & 0x1)
 
#define AD7124_CFG_REG_REF_BUFM_RD(x)   (((x) >> 7) & 0x1)
 
#define AD7124_CFG_REG_AIN_BUFP_RD(x)   (((x) >> 6) & 0x1)
 
#define AD7124_CFG_REG_AINM_BUFP_RD(x)   (((x) >> 5) & 0x1)
 
#define AD7124_CFG_REG_REF_SEL_MSK   NO_OS_GENMASK(4, 3)
 
#define AD7124_CFG_REG_REF_SEL_RD(x)   (((x) >> 3) & 0x3)
 
#define AD7124_CFG_REG_PGA_MSK   NO_OS_GENMASK(2, 0)
 
#define AD7124_CFG_REG_PGA_RD(x)   (((x) >> 0) & 0x7)
 
#define AD7124_FILT_REG_FILTER_MSK   NO_OS_GENMASK(23, 21)
 
#define AD7124_FILT_REG_FILTER_RD(x)   (((x) >> 21) & 0x7)
 
#define AD7124_FILT_REG_FS_MSK   NO_OS_GENMASK(10, 0)
 
#define AD7124_FILT_REG_FS_RD(x)   (((x) >> 0) & 0x7FF)
 

Functions

uint8_t ad7124_get_channel_setup (struct ad7124_dev *dev, uint8_t channel)
 
uint8_t ad7124_get_channel_pga (struct ad7124_dev *dev, uint8_t channel)
 
bool ad7124_get_channel_bipolar (struct ad7124_dev *dev, uint8_t channel)
 
float ad7124_convert_sample_to_voltage (struct ad7124_dev *dev, uint8_t channel, uint32_t sample)
 

Detailed Description

: Provides useful support functions for the AD7124 NoOS driver

:

Copyright (c) 2019-2022 Analog Devices, Inc. All rights reserved.

This software is proprietary to Analog Devices, Inc. and its licensors. By using this software you agree to the terms of the associated Analog Devices Software License Agreement.

Macro Definition Documentation

◆ AD7124_ADC_CTRL_REG_MSK

#define AD7124_ADC_CTRL_REG_MSK   NO_OS_GENMASK(5,2)

◆ AD7124_ADC_CTRL_REG_POWER_MODE_MSK

#define AD7124_ADC_CTRL_REG_POWER_MODE_MSK   NO_OS_GENMASK(7,6)

◆ AD7124_ADC_CTRL_REG_POWER_MODE_RD

#define AD7124_ADC_CTRL_REG_POWER_MODE_RD (   x)    (((x) >> 6) & 0x3)

◆ AD7124_ADC_N_BITS

#define AD7124_ADC_N_BITS   24

◆ AD7124_CFG_REG_AIN_BUFP_RD

#define AD7124_CFG_REG_AIN_BUFP_RD (   x)    (((x) >> 6) & 0x1)

◆ AD7124_CFG_REG_AINM_BUFP_RD

#define AD7124_CFG_REG_AINM_BUFP_RD (   x)    (((x) >> 5) & 0x1)

◆ AD7124_CFG_REG_BIPOLAR_RD

#define AD7124_CFG_REG_BIPOLAR_RD (   x)    (((x) >> 11) & 0x1)

◆ AD7124_CFG_REG_PGA_MSK

#define AD7124_CFG_REG_PGA_MSK   NO_OS_GENMASK(2, 0)

◆ AD7124_CFG_REG_PGA_RD

#define AD7124_CFG_REG_PGA_RD (   x)    (((x) >> 0) & 0x7)

◆ AD7124_CFG_REG_REF_BUFM_RD

#define AD7124_CFG_REG_REF_BUFM_RD (   x)    (((x) >> 7) & 0x1)

◆ AD7124_CFG_REG_REF_BUFP_RD

#define AD7124_CFG_REG_REF_BUFP_RD (   x)    (((x) >> 8) & 0x1)

◆ AD7124_CFG_REG_REF_SEL_MSK

#define AD7124_CFG_REG_REF_SEL_MSK   NO_OS_GENMASK(4, 3)

◆ AD7124_CFG_REG_REF_SEL_RD

#define AD7124_CFG_REG_REF_SEL_RD (   x)    (((x) >> 3) & 0x3)

◆ AD7124_CH_MAP_REG_AINM_MSK

#define AD7124_CH_MAP_REG_AINM_MSK   NO_OS_GENMASK(4, 0)

◆ AD7124_CH_MAP_REG_AINM_RD

#define AD7124_CH_MAP_REG_AINM_RD (   x)    (((x) >> 0) & 0x1F)

◆ AD7124_CH_MAP_REG_AINP_MSK

#define AD7124_CH_MAP_REG_AINP_MSK   NO_OS_GENMASK(9, 5)

◆ AD7124_CH_MAP_REG_AINP_RD

#define AD7124_CH_MAP_REG_AINP_RD (   x)    (((x) >> 5) & 0x1F)

◆ AD7124_CH_MAP_REG_CH_ENABLE_RD

#define AD7124_CH_MAP_REG_CH_ENABLE_RD (   x)    (((x) >> 15) & 0x1)

◆ AD7124_CH_MAP_REG_SETUP_MSK

#define AD7124_CH_MAP_REG_SETUP_MSK   NO_OS_GENMASK(14, 12)

◆ AD7124_CH_MAP_REG_SETUP_RD

#define AD7124_CH_MAP_REG_SETUP_RD (   x)    (((x) >> 12) & 0x7)

◆ AD7124_FILT_REG_FILTER_MSK

#define AD7124_FILT_REG_FILTER_MSK   NO_OS_GENMASK(23, 21)

◆ AD7124_FILT_REG_FILTER_RD

#define AD7124_FILT_REG_FILTER_RD (   x)    (((x) >> 21) & 0x7)

◆ AD7124_FILT_REG_FS_MSK

#define AD7124_FILT_REG_FS_MSK   NO_OS_GENMASK(10, 0)

◆ AD7124_FILT_REG_FS_RD

#define AD7124_FILT_REG_FS_RD (   x)    (((x) >> 0) & 0x7FF)

◆ AD7124_PGA_GAIN

#define AD7124_PGA_GAIN (   x)    (1 << (x))

◆ AD7124_REF_VOLTAGE

#define AD7124_REF_VOLTAGE   2.5

Function Documentation

◆ ad7124_convert_sample_to_voltage()

float ad7124_convert_sample_to_voltage ( struct ad7124_dev *  dev,
uint8_t  channel,
uint32_t  sample 
)

◆ ad7124_get_channel_bipolar()

bool ad7124_get_channel_bipolar ( struct ad7124_dev *  dev,
uint8_t  channel 
)

◆ ad7124_get_channel_pga()

uint8_t ad7124_get_channel_pga ( struct ad7124_dev *  dev,
uint8_t  channel 
)

◆ ad7124_get_channel_setup()

uint8_t ad7124_get_channel_setup ( struct ad7124_dev *  dev,
uint8_t  channel 
)