Implementation of AD7091R Driver.
More...
#include <stdlib.h>
#include "ad7091r.h"
#include "no_os_alloc.h"
#include "no_os_error.h"
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
◆ 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()
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()
Puts the device in power-down mode.
- Parameters
-
| dev | - The device structure. |
◆ ad7091r_power_up()
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()
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. |