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

Implementation of the AD417x and AD419x IIO driver. More...

#include <stdint.h>
#include "ad4170.h"
#include "iio_ad4170.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
#include "no_os_print_log.h"
#include "no_os_util.h"
Include dependency graph for iio_ad4170.c:

Macros

#define AD4170_IIO_INT_CLOCK_HZ   16000000UL
 
#define AD4170_IIO_EXT_CLOCK_MIN_HZ   1000000UL
 
#define AD4170_IIO_EXT_CLOCK_MAX_HZ   17000000UL
 
#define AD4170_IIO_INT_REF_MV   2500
 
#define AD4170_IIO_FS_MULT   32
 
#define AD4170_IIO_FS_STEP   4
 
#define AD4170_IIO_SINC3_MIN_FS   4
 
#define AD4170_IIO_SINC3_MAX_FS   65532
 
#define AD4170_IIO_SINC5_MIN_FS   1
 
#define AD4170_IIO_SINC5_MAX_FS   256
 
#define AD4170_IIO_CONV_TIMEOUT   1000000
 
#define AD4170_IIO_REALBITS   24
 
#define AD4170_IIO_STORAGEBITS   32
 
#define AD4170_IIO_BYTE_MASK   0xff
 
#define AD4170_IIO_BYTE_BITS   8
 
#define AD4170_IIO_MAX_REG_ADDR
 

Functions

int ad4170_iio_init (struct ad4170_iio_dev **device, struct ad4170_iio_dev_init_param *init_param)
 Initialize the AD4170 IIO driver.
 
int ad4170_iio_remove (struct ad4170_iio_dev *device)
 Free the resources allocated by ad4170_iio_init().
 

Detailed Description

Implementation of the AD417x and AD419x IIO driver.

Author
Janani Sunil (janan.nosp@m.i.su.nosp@m.nil@a.nosp@m.nalo.nosp@m.g.com)

Copyright 2026(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

◆ AD4170_IIO_BYTE_BITS

#define AD4170_IIO_BYTE_BITS   8

◆ AD4170_IIO_BYTE_MASK

#define AD4170_IIO_BYTE_MASK   0xff

◆ AD4170_IIO_CONV_TIMEOUT

#define AD4170_IIO_CONV_TIMEOUT   1000000

◆ AD4170_IIO_EXT_CLOCK_MAX_HZ

#define AD4170_IIO_EXT_CLOCK_MAX_HZ   17000000UL

◆ AD4170_IIO_EXT_CLOCK_MIN_HZ

#define AD4170_IIO_EXT_CLOCK_MIN_HZ   1000000UL

◆ AD4170_IIO_FS_MULT

#define AD4170_IIO_FS_MULT   32

◆ AD4170_IIO_FS_STEP

#define AD4170_IIO_FS_STEP   4

◆ AD4170_IIO_INT_CLOCK_HZ

#define AD4170_IIO_INT_CLOCK_HZ   16000000UL

◆ AD4170_IIO_INT_REF_MV

#define AD4170_IIO_INT_REF_MV   2500

◆ AD4170_IIO_MAX_REG_ADDR

#define AD4170_IIO_MAX_REG_ADDR
Value:
AD4170_TRANSF_LEN(AD4170_REG_INPUT_DATA) - 1)
#define AD4170_REG_INPUT_DATA
Definition ad4170.h:92
#define AD4170_ADDR(x)
Definition ad4170.h:28

◆ AD4170_IIO_REALBITS

#define AD4170_IIO_REALBITS   24

◆ AD4170_IIO_SINC3_MAX_FS

#define AD4170_IIO_SINC3_MAX_FS   65532

◆ AD4170_IIO_SINC3_MIN_FS

#define AD4170_IIO_SINC3_MIN_FS   4

◆ AD4170_IIO_SINC5_MAX_FS

#define AD4170_IIO_SINC5_MAX_FS   256

◆ AD4170_IIO_SINC5_MIN_FS

#define AD4170_IIO_SINC5_MIN_FS   1

◆ AD4170_IIO_STORAGEBITS

#define AD4170_IIO_STORAGEBITS   32

Function Documentation

◆ ad4170_iio_init()

int ad4170_iio_init ( struct ad4170_iio_dev ** device,
struct ad4170_iio_dev_init_param * init_param )

Initialize the AD4170 IIO driver.

Parameters
device- The IIO device structure.
init_param- The structure holding the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ad4170_iio_remove()

int ad4170_iio_remove ( struct ad4170_iio_dev * device)

Free the resources allocated by ad4170_iio_init().

Parameters
device- The IIO device structure.
Returns
0 in case of success, negative error code otherwise.