Implementation of AD5446 Driver. This driver supporting the following devices: AD5553, AD5543, AD5542A, AD5541A, AD5512A, AD5453, AD5452, AD5451, AD5450, AD5446, AD5444.
More...
#include <stdlib.h>
#include "ad5446.h"
#include "no_os_alloc.h"
Implementation of AD5446 Driver. This driver supporting the following devices: AD5553, AD5543, AD5542A, AD5541A, AD5512A, AD5453, AD5452, AD5451, AD5450, AD5446, AD5444.
- Author
- Istvan Csomortani (istva.nosp@m.n.cs.nosp@m.omort.nosp@m.ani@.nosp@m.analo.nosp@m.g.co.nosp@m.m)
Copyright 2013(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ CMD_MASK
◆ CMD_OFFSET
◆ DATA_MASK
Value:
#define MAX_RESOLUTION
Definition ad5446.c:17
◆ DATA_OFFSET
◆ LSB_MASK
◆ LSB_OFFSET
◆ MAX_RESOLUTION
| #define MAX_RESOLUTION 16 /* Maximum resolution of supported devices */ |
◆ MSB_MASK
◆ MSB_OFFSET
◆ PKT_LENGTH
| #define PKT_LENGTH 2 /* SPI packet length in byte */ |
◆ ad5446_init()
Initialize SPI and Initial Values for AD5446 Board.
- Parameters
-
| device | - The device structure. |
| init_param | - The structure that contains the device initial parameters. |
- Returns
- retValue - Result of the initialization. Example: 0 - if initialization was successful; -1 - if initialization was unsuccessful.
◆ ad5446_remove()
Free the resources allocated by ad5446_init().
- Parameters
-
| dev | - The device structure. |
- Returns
- 0 in case of success, negative error code otherwise.
◆ ad5446_set_register()
| void ad5446_set_register |
( |
struct ad5446_dev * | dev, |
|
|
uint8_t | command, |
|
|
uint16_t | data ) |
Writes to input register via SPI.
- Parameters
-
| dev | - The device structure. |
| command | - Command to be transmitted to the device. |
| data | - Data to be written in input register. |
◆ ad5446_set_voltage()
| float ad5446_set_voltage |
( |
struct ad5446_dev * | dev, |
|
|
float | voltage, |
|
|
float | vref, |
|
|
enum vout_type_t | vout_type ) |
Sets the output voltage.
- Parameters
-
| dev | - The device structure. |
| voltage | - The voltage value in volts |
| vref | - The voltage reference used by the device in volts. |
| vout_type | - Voltage output type: unipolar/unipolar_inv/bipolar |
- Returns
- Actual voltage that the device can output.