no-OS
Classes | Macros | Functions
adc.h File Reference

Interface of adc.c. More...

#include <stdint.h>
Include dependency graph for adc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  adc_init_param
 This can be extended in the future, no utility for the moment. More...
 

Macros

#define ADUCM3029_ADC_NUM_CH   6
 
#define ADUCM3029_CH(x)   (1 << x)
 

Functions

int32_t aducm3029_adc_update_active_channels (struct adc_desc *desc, uint32_t mask)
 Activate adc channels. More...
 
int32_t aducm3029_adc_read (struct adc_desc *desc, uint16_t *buff, uint32_t nb_samples)
 Read adc data. aducm3029_adc_update_active_channels should be called in order to enable channeles. More...
 
int32_t aducm3029_adc_init (struct adc_desc **desc, struct adc_init_param *param)
 Allocate adc_desc and initialize adc. More...
 
int32_t aducm3029_adc_remove (struct adc_desc *desc)
 Dealocate resources allocated by aducm3029_adc_init. More...
 

Detailed Description

Interface of adc.c.

Author
Mihail Chindris (mihai.nosp@m.l.ch.nosp@m.indri.nosp@m.s@an.nosp@m.alog..nosp@m.com)

Copyright 2020(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.

Macro Definition Documentation

◆ ADUCM3029_ADC_NUM_CH

#define ADUCM3029_ADC_NUM_CH   6

◆ ADUCM3029_CH

#define ADUCM3029_CH (   x)    (1 << x)

Function Documentation

◆ aducm3029_adc_init()

int32_t aducm3029_adc_init ( struct adc_desc **  desc,
struct adc_init_param param 
)

Allocate adc_desc and initialize adc.

Parameters
desc- Adc descriptor
param- Initialization parameter
Returns
SUCCESS in case of success, negative value otherwise.

◆ aducm3029_adc_read()

int32_t aducm3029_adc_read ( struct adc_desc desc,
uint16_t *  buff,
uint32_t  nb_samples 
)

Read adc data. aducm3029_adc_update_active_channels should be called in order to enable channeles.

Parameters
desc- Adc descriptor
buff- Buffer where to store data. The available size should be number of activated channels * nb_samples.
nb_samples- Number of samples to read for each channel.
Returns
SUCCESS in case of success, negative value otherwise.

◆ aducm3029_adc_remove()

int32_t aducm3029_adc_remove ( struct adc_desc desc)

Dealocate resources allocated by aducm3029_adc_init.

Parameters
desc- Adc descriptor
Returns
SUCCESS

◆ aducm3029_adc_update_active_channels()

int32_t aducm3029_adc_update_active_channels ( struct adc_desc desc,
uint32_t  mask 
)

Activate adc channels.

Parameters
desc- Adc descriptor
mask- Channels to activates. Use ADUCM3029_CH define
Returns
SUCCESS in case of success, negative value otherwise.