no-OS
Loading...
Searching...
No Matches
ad7091r.c File Reference

Implementation of AD7091R Driver. More...

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

Functions

int8_t ad7091r_init (struct ad7091r_dev **device, struct ad7091r_init_param init_param)
 Initializes the communication peripheral and the initial Values for AD7092R Board.
 
int32_t ad7091r_remove (struct ad7091r_dev *dev)
 Free the resources allocated by ad7091r_init().
 
void ad7091r_software_reset (struct ad7091r_dev *dev)
 Initiate a software reset of the device. The AD7091R requires the user to initiate a software reset when power is first applied.
 
uint16_t ad7091r_read_sample (struct ad7091r_dev *dev)
 Initiates one conversion and reads back the result. During this process the device runs in normal mode and operates without the busy indicator.
 
void ad7091r_power_down (struct ad7091r_dev *dev)
 Puts the device in power-down mode.
 
void ad7091r_power_up (struct ad7091r_dev *dev)
 Powers up the device by pulling CONVST high. After calling this function, a time delay is required before initiating another conversion:
 
float ad7091r_convert_to_volts (int16_t raw_sample, float v_ref)
 Converts a 12-bit raw sample to volts.
 

Detailed Description

Implementation of AD7091R 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

◆ ad7091r_convert_to_volts()

float ad7091r_convert_to_volts ( int16_t raw_sample,
float v_ref )

Converts a 12-bit raw sample to volts.

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

◆ ad7091r_init()

int8_t ad7091r_init ( struct ad7091r_dev ** device,
struct ad7091r_init_param init_param )

Initializes the communication peripheral and the initial Values for AD7092R Board.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
ret - The result of the initialization procedure. Example: -1 - SPI peripheral was not initialized or the device is not present. 0 - SPI peripheral was initialized and the device is present.

◆ ad7091r_power_down()

void ad7091r_power_down ( struct ad7091r_dev * dev)

Puts the device in power-down mode.

Parameters
dev- The device structure.

◆ ad7091r_power_up()

void ad7091r_power_up ( struct ad7091r_dev * dev)

Powers up the device by pulling CONVST high. After calling this function, a time delay is required before initiating another conversion:

  • 50 ms delay, when internal reference is used.(with 2.2uF capacitor)
  • 100 us delay, when external reference is used.
Parameters
dev- The device structure.

◆ ad7091r_read_sample()

uint16_t ad7091r_read_sample ( struct ad7091r_dev * dev)

Initiates one conversion and reads back the result. During this process the device runs in normal mode and operates without the busy indicator.

Parameters
dev- The device structure.
Returns
conversionResult - 12bit conversion result.

◆ ad7091r_remove()

int32_t ad7091r_remove ( struct ad7091r_dev * dev)

Free the resources allocated by ad7091r_init().

Parameters
dev- The device structure.
Returns
ret - The result of the remove procedure.

◆ ad7091r_software_reset()

void ad7091r_software_reset ( struct ad7091r_dev * dev)

Initiate a software reset of the device. The AD7091R requires the user to initiate a software reset when power is first applied.

Parameters
dev- The device structure.