no-OS
Classes | Macros | Enumerations | Functions | Variables
adc_demo.h File Reference

Header file of ADC Demo Driver. More...

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

Go to the source code of this file.

Classes

struct  adc_demo_desc
 
struct  adc_demo_init_param
 

Macros

#define MAX_ADC_ADDR   16
 
#define TOTAL_ADC_CHANNELS   2
 

Enumerations

enum  iio_adc_demo_attributes {
  ADC_CHANNEL_ATTR,
  ADC_GLOBAL_ATTR
}
 

Functions

int32_t adc_demo_init (struct adc_demo_desc **desc, struct adc_demo_init_param *param)
 init function for the adc demo driver More...
 
int32_t adc_demo_remove (struct adc_demo_desc *desc)
 free allocated resources More...
 
int32_t update_adc_channels (void *dev, uint32_t mask)
 active adc channels More...
 
int32_t close_adc_channels (void *dev)
 close all channels More...
 
int32_t adc_submit_samples (struct iio_device_data *dev_data)
 function for reading samples from the device. More...
 
int32_t adc_demo_reg_read (struct adc_demo_desc *desc, uint8_t reg_index, uint8_t *readval)
 read function for the adc demo driver More...
 
int32_t adc_demo_reg_write (struct adc_demo_desc *desc, uint8_t reg_index, uint8_t writeval)
 write function for the adc demo driver More...
 
int32_t adc_demo_trigger_handler (struct iio_device_data *dev_data)
 Handles trigger: reads one data-set and writes it to the buffer. More...
 

Variables

const uint16_t sine_lut [128]
 

Detailed Description

Header file of ADC Demo Driver.

Author
RNechita (ramon.nosp@m.a.ne.nosp@m.chita.nosp@m.@ana.nosp@m.log.c.nosp@m.om)

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

◆ MAX_ADC_ADDR

#define MAX_ADC_ADDR   16

◆ TOTAL_ADC_CHANNELS

#define TOTAL_ADC_CHANNELS   2

Enumeration Type Documentation

◆ iio_adc_demo_attributes

Enumerator
ADC_CHANNEL_ATTR 
ADC_GLOBAL_ATTR 

Function Documentation

◆ adc_demo_init()

int32_t adc_demo_init ( struct adc_demo_desc **  desc,
struct adc_demo_init_param param 
)

init function for the adc demo driver

Parameters
desc- descriptor for the adc
param- initialization param for adc
Returns
0 in case of success, negative error code otherwise.

◆ adc_demo_reg_read()

int32_t adc_demo_reg_read ( struct adc_demo_desc desc,
uint8_t  reg_index,
uint8_t *  readval 
)

read function for the adc demo driver

Parameters
desc- descriptor for the adc
reg_index- the address at which we want to read
readval-the value read from register
Returns
0 in case of success, negative error code otherwise.

◆ adc_demo_reg_write()

int32_t adc_demo_reg_write ( struct adc_demo_desc desc,
uint8_t  reg_index,
uint8_t  writeval 
)

write function for the adc demo driver

Parameters
desc- descriptor for the adc
reg_index- the address at which we want to write
writeval- the value to be written
Returns
0 in case of success, negative error code otherwise.

◆ adc_demo_remove()

int32_t adc_demo_remove ( struct adc_demo_desc desc)

free allocated resources

Parameters
desc- descriptor for the adc
Returns
0 in case of success, -1 otherwise.

◆ adc_demo_trigger_handler()

int32_t adc_demo_trigger_handler ( struct iio_device_data dev_data)

Handles trigger: reads one data-set and writes it to the buffer.

Parameters
dev_data- The iio device data structure.
Returns
ret - Result of the handling procedure. In case of success, the size of the written data is returned.

◆ adc_submit_samples()

int32_t adc_submit_samples ( struct iio_device_data dev_data)

function for reading samples from the device.

Parameters
dev_data- The iio device data structure.
Returns
the number of read samples.

◆ close_adc_channels()

int32_t close_adc_channels ( void *  dev)

close all channels

Parameters
dev- physical instance of an adc device
Returns
0 in case of success.

◆ update_adc_channels()

int32_t update_adc_channels ( void *  dev,
uint32_t  mask 
)

active adc channels

Parameters
dev- descriptor for the adc
mask- active channels mask
Returns
0 in case of success, -1 otherwise.

Variable Documentation

◆ sine_lut

const uint16_t sine_lut[128]