no-OS
Functions | Variables
ad400x.c File Reference

Implementation of ad400x Driver. More...

#include "stdio.h"
#include "stdlib.h"
#include "stdbool.h"
#include "string.h"
#include "ad400x.h"
#include "spi_engine.h"
#include "no_os_error.h"
#include "no_os_alloc.h"
#include "no_os_util.h"
Include dependency graph for ad400x.c:

Functions

int32_t ad400x_spi_reg_read (struct ad400x_dev *dev, uint8_t *reg_data)
 
int32_t ad400x_spi_reg_write (struct ad400x_dev *dev, uint8_t reg_data)
 
int32_t ad400x_read_data (struct ad400x_dev *dev, uint32_t *buf, uint16_t samples)
 
int32_t ad400x_init (struct ad400x_dev **device, struct ad400x_init_param *init_param)
 
int32_t ad400x_remove (struct ad400x_dev *dev)
 Free the resources allocated by ad400x_init(). More...
 

Variables

const struct ad400x_dev_info ad400x_devices []
 

Detailed Description

Implementation of ad400x Driver.

Author
Mircea Caprioru (mirce.nosp@m.a.ca.nosp@m.prior.nosp@m.u@an.nosp@m.alog..nosp@m.com)

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

◆ ad400x_init()

int32_t ad400x_init ( struct ad400x_dev **  device,
struct ad400x_init_param init_param 
)

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad400x_read_data()

int32_t ad400x_read_data ( struct ad400x_dev dev,
uint32_t *  buf,
uint16_t  samples 
)

Read conversion results from device.

Parameters
dev- The device structure.
buf- Buffer to hold the conversion results data
samples- number of samples to read
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad400x_remove()

int32_t ad400x_remove ( struct ad400x_dev dev)

Free the resources allocated by ad400x_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad400x_spi_reg_read()

int32_t ad400x_spi_reg_read ( struct ad400x_dev dev,
uint8_t *  reg_data 
)

Read from device.

Parameters
dev- The device structure.
reg_data- The register data.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ad400x_spi_reg_write()

int32_t ad400x_spi_reg_write ( struct ad400x_dev dev,
uint8_t  reg_data 
)

Write to device.

Parameters
dev- The device structure.
reg_data- The register data.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

Variable Documentation

◆ ad400x_devices

const struct ad400x_dev_info ad400x_devices[]
Initial value:
= {
[ID_AD4000] = {.resolution = 16, .sign = 'u'},
[ID_AD4001] = {.resolution = 16, .sign = 's'},
[ID_AD4002] = {.resolution = 18, .sign = 'u'},
[ID_AD4003] = {.resolution = 18, .sign = 's'},
[ID_AD4004] = {.resolution = 16, .sign = 'u'},
[ID_AD4005] = {.resolution = 16, .sign = 's'},
[ID_AD4006] = {.resolution = 18, .sign = 'u'},
[ID_AD4007] = {.resolution = 18, .sign = 's'},
[ID_AD4011] = {.resolution = 18, .sign = 's'},
[ID_AD4020] = {.resolution = 20, .sign = 's'},
[ID_ADAQ4003] = {.resolution = 18, .sign = 's'}
}
ID_ADAQ4003
@ ID_ADAQ4003
Definition: ad400x.h:77
ID_AD4002
@ ID_AD4002
Definition: ad400x.h:69
ID_AD4000
@ ID_AD4000
Definition: ad400x.h:67
ID_AD4003
@ ID_AD4003
Definition: ad400x.h:70
ID_AD4004
@ ID_AD4004
Definition: ad400x.h:71
ID_AD4001
@ ID_AD4001
Definition: ad400x.h:68
ID_AD4020
@ ID_AD4020
Definition: ad400x.h:76
ID_AD4007
@ ID_AD4007
Definition: ad400x.h:74
ID_AD4006
@ ID_AD4006
Definition: ad400x.h:73
ID_AD4011
@ ID_AD4011
Definition: ad400x.h:75
ID_AD4005
@ ID_AD4005
Definition: ad400x.h:72