no-OS
Functions
ad799x.c File Reference

Implementation of AD799x Driver. More...

#include <stdlib.h>
#include "ad799x.h"
#include "no_os_alloc.h"
Include dependency graph for ad799x.c:

Functions

int8_t ad799x_init (struct ad799x_dev **device, struct ad799x_init_param init_param)
 Initializes I2C. More...
 
int32_t ad799x_remove (struct ad799x_dev *dev)
 Free the resources allocated by ad799x_init(). More...
 
void ad799x_set_configuration_reg (struct ad799x_dev *dev, uint8_t register_value)
 Writes data into the Configuration Register. More...
 
void ad799x_get_conversion_result (struct ad799x_dev *dev, int16_t *conv_value, int8_t *channel)
 Reads the High byte and the Low byte of the conversion. More...
 
float ad799x_convert_to_volts (struct ad799x_dev *dev, int16_t raw_sample, float v_ref)
 Converts a raw sample to volts. More...
 

Detailed Description

Implementation of AD799x Driver.

Author
DNechita (Dan.N.nosp@m.echi.nosp@m.ta@an.nosp@m.alog.nosp@m..com)

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

◆ ad799x_convert_to_volts()

float ad799x_convert_to_volts ( struct ad799x_dev dev,
int16_t  raw_sample,
float  v_ref 
)

Converts a raw sample to volts.

Parameters
dev- The device structure.
raw_sample- The data sample.
v_ref- The value of the voltage reference used by the device.
Returns
voltage - The result of the conversion expressed as volts.

◆ ad799x_get_conversion_result()

void ad799x_get_conversion_result ( struct ad799x_dev dev,
int16_t *  conv_value,
int8_t *  channel 
)

Reads the High byte and the Low byte of the conversion.

Parameters
dev- The device structure.
conv_value- It is used to store the conversion value.
channel- Stores the channel number for the current conversion.
Returns
none.

◆ ad799x_init()

int8_t ad799x_init ( struct ad799x_dev **  device,
struct ad799x_init_param  init_param 
)

Initializes I2C.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
status - Initialization status. Example: -1 - Initialization failed; 0 - Initialization succeeded.

◆ ad799x_remove()

int32_t ad799x_remove ( struct ad799x_dev dev)

Free the resources allocated by ad799x_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ad799x_set_configuration_reg()

void ad799x_set_configuration_reg ( struct ad799x_dev dev,
uint8_t  register_value 
)

Writes data into the Configuration Register.

Parameters
dev- The device structure.
register_value- Data value to write.
Returns
None.