no-OS
Loading...
Searching...
No Matches
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.
 
int32_t ad799x_remove (struct ad799x_dev *dev)
 Free the resources allocated by ad799x_init().
 
void ad799x_set_configuration_reg (struct ad799x_dev *dev, uint8_t register_value)
 Writes data into the Configuration Register.
 
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.
 
float ad799x_convert_to_volts (struct ad799x_dev *dev, int16_t raw_sample, float v_ref)
 Converts a raw sample to volts.
 

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.

SPDX-License-Identifier: BSD-3-Clause

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.

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