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

Interface of aducm3029_adc.c. More...

#include <stdint.h>
Include dependency graph for aducm3029_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 aducm3029_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.

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

◆ 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
0 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
0 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
0

◆ 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
0 in case of success, negative value otherwise.