no-OS
Functions | Variables
iio_ad5791.c File Reference

Implementation of AD5791 IIO Driver. More...

#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "iio_ad5791.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
Include dependency graph for iio_ad5791.c:

Functions

int32_t ad5791_iio_init (struct ad5791_iio_desc **iio_dev, struct ad5791_iio_init_param *init_param)
 Initialize the AD5791 IIO driver. More...
 
int32_t ad5791_iio_remove (struct ad5791_iio_desc *desc)
 Free memory allocated by ad5791_iio_init(). More...
 

Variables

struct iio_device const iio_ad5791_device
 

Detailed Description

Implementation of AD5791 IIO Driver.

Author
Andrei Drimbarean (andre.nosp@m.i.dr.nosp@m.imbar.nosp@m.ean@.nosp@m.analo.nosp@m.g.co.nosp@m.m)

Copyright 2021(c) Analog Devices, Inc.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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.

Function Documentation

◆ ad5791_iio_init()

int32_t ad5791_iio_init ( struct ad5791_iio_desc **  iio_dev,
struct ad5791_iio_init_param init_param 
)

Initialize the AD5791 IIO driver.

Parameters
iio_dev- Pointer to the IIO driver handler.
init_param- Pointer to the initialization structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad5791_iio_remove()

int32_t ad5791_iio_remove ( struct ad5791_iio_desc desc)

Free memory allocated by ad5791_iio_init().

Parameters
desc-Pointer to the driver handler.
Returns
0 in case of success, negative error code otherwise.

Variable Documentation

◆ iio_ad5791_device

struct iio_device const iio_ad5791_device
Initial value:
= {
.num_ch = AD5791_CH_NO,
.channels = (struct iio_channel *)ad5791_channels,
.debug_attributes = NULL,
.buffer_attributes = NULL,
.pre_enable = NULL,
.post_disable = NULL,
.read_dev = NULL,
.debug_reg_read = (int32_t (*)())ad5791_get_register_value,
.debug_reg_write = (int32_t (*)())ad5791_set_register_value
}
iio_channel
Struct describing the scan type.
Definition: iio_types.h:173
ad5791_get_register_value
int32_t ad5791_get_register_value(struct ad5791_dev *dev, uint8_t register_address, uint32_t *value)
Reads the value of a register.
Definition: ad5791.c:185
AD5791_CH_NO
#define AD5791_CH_NO
Definition: iio_ad5791.h:47
iio_channel::attributes
struct iio_attribute * attributes
Definition: iio_types.h:191
NULL
#define NULL
Definition: wrapper.h:64
ad5791_set_register_value
int32_t ad5791_set_register_value(struct ad5791_dev *dev, uint8_t register_address, uint32_t register_value)
Writes data into a register.
Definition: ad5791.c:147