no-OS
|
Implementation of ad5770r Driver. More...
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "no_os_error.h"
#include "ad5770r.h"
#include "no_os_alloc.h"
Functions | |
int32_t | ad5770r_spi_reg_read (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data) |
int32_t | ad5770r_spi_reg_read_multiple (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count) |
int32_t | ad5770r_spi_reg_write (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t reg_data) |
int32_t | ad5770r_spi_reg_write_multiple (struct ad5770r_dev *dev, uint8_t reg_addr, uint8_t *reg_data, uint16_t count) |
int32_t | ad5770r_spi_write_mask (struct ad5770r_dev *dev, uint8_t reg_addr, uint32_t mask, uint8_t data) |
int32_t | ad5770r_set_device_spi (struct ad5770r_dev *dev, const struct ad5770r_device_spi_settings *spi_settings) |
int32_t | ad5770r_channel_config (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *channel_config) |
int32_t | ad5770r_set_output_mode (struct ad5770r_dev *dev, const struct ad5770r_output_range *output_mode, enum ad5770r_channels channel) |
int32_t | ad5770r_set_reference (struct ad5770r_dev *dev, bool external_reference, enum ad5770r_reference_voltage reference_selector) |
int32_t | ad5770r_set_alarm (struct ad5770r_dev *dev, const struct ad5770r_alarm_cfg *const alarm_config) |
int32_t | ad5770r_set_output_filter (struct ad5770r_dev *dev, enum ad5770r_output_filter_resistor output_filter, enum ad5770r_channels channel) |
int32_t | ad5770r_set_hw_ldac (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_hw_ldac) |
int32_t | ad5770r_set_dac_value (struct ad5770r_dev *dev, uint16_t dac_value, enum ad5770r_channels channel) |
int32_t | ad5770r_set_dac_input (struct ad5770r_dev *dev, uint16_t dac_input, enum ad5770r_channels channel) |
int32_t | ad5770r_set_page_mask (struct ad5770r_dev *dev, const struct ad5770r_dac_page_mask *page_mask) |
int32_t | ad5770r_set_mask_channel (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *mask_channel_sel) |
int32_t | ad5770r_set_sw_ldac (struct ad5770r_dev *dev, const struct ad5770r_channel_switches *sw_ldac) |
int32_t | ad5770r_get_status (struct ad5770r_dev *dev, uint8_t *status) |
int32_t | ad5770r_get_interface_status (struct ad5770r_dev *dev, uint8_t *status) |
int32_t | ad5770r_set_monitor_setup (struct ad5770r_dev *dev, const struct ad5770r_monitor_setup *mon_setup) |
int32_t | ad5770r_init (struct ad5770r_dev **device, const struct ad5770r_init_param *init_param) |
int32_t | ad5770r_remove (struct ad5770r_dev *dev) |
Implementation of ad5770r Driver.
Copyright 2018, 2020(c) Analog Devices, Inc.
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, INC. “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 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.
int32_t ad5770r_channel_config | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | channel_config | ||
) |
Set the channel configuration.
dev | - The device structure. |
channel_config | - The structure that contains the channel configuration. |
int32_t ad5770r_get_interface_status | ( | struct ad5770r_dev * | dev, |
uint8_t * | status | ||
) |
Get interface status value.
dev | - The device structure. |
status | - The INTERFACE STATUS A register value. |
int32_t ad5770r_get_status | ( | struct ad5770r_dev * | dev, |
uint8_t * | status | ||
) |
Get status value.
dev | - The device structure. |
status | - The status of the device. |
int32_t ad5770r_init | ( | struct ad5770r_dev ** | device, |
const struct ad5770r_init_param * | init_param | ||
) |
Initialize the device.
device | - The device structure. |
init_param | - The structure that contains the device initial parameters. |
int32_t ad5770r_remove | ( | struct ad5770r_dev * | dev | ) |
Delete and remove the device.
dev | - The device structure. |
int32_t ad5770r_set_alarm | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_alarm_cfg *const | alarm_config | ||
) |
Set reference configuration.
dev | - The device structure. |
alarm_config | - Pointer to the array that contains the alarms that will be enabled. |
int32_t ad5770r_set_dac_input | ( | struct ad5770r_dev * | dev, |
uint16_t | dac_input, | ||
enum ad5770r_channels | channel | ||
) |
Set dac value.
dev | - The device structure. |
dac_input | - value that will be set in the register. |
channel | - the selected channel. |
int32_t ad5770r_set_dac_value | ( | struct ad5770r_dev * | dev, |
uint16_t | dac_value, | ||
enum ad5770r_channels | channel | ||
) |
Set dac value.
dev | - The device structure. |
dac_value | - value that will be set in the register. |
channel | - the selected channel. |
int32_t ad5770r_set_device_spi | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_device_spi_settings * | spi_settings | ||
) |
Set device spi settings.
dev | - The device structure. |
spi_settings | - The structure that contains the device spi parameters. |
int32_t ad5770r_set_hw_ldac | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | mask_hw_ldac | ||
) |
Set the hardware ldac configuration.
dev | - The device structure. |
mask_hw_ldac | - The array contains HW LDAC channel masks. |
int32_t ad5770r_set_mask_channel | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | mask_channel_sel | ||
) |
Set channel select.
dev | - The device structure. |
mask_channel_sel | - The array contains channel selection options. |
int32_t ad5770r_set_monitor_setup | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_monitor_setup * | mon_setup | ||
) |
Set the channel monitor configuration.
dev | - The device structure. |
mon_setup | - The structure that contains the monitor setup values. |
int32_t ad5770r_set_output_filter | ( | struct ad5770r_dev * | dev, |
enum ad5770r_output_filter_resistor | output_filter, | ||
enum ad5770r_channels | channel | ||
) |
Set the channel output filter resistor.
dev | - The device structure. |
output_filter | - The structure that contains the channel output filter resistor values. |
channel | - The channel number. |
int32_t ad5770r_set_output_mode | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_output_range * | output_mode, | ||
enum ad5770r_channels | channel | ||
) |
Set the channel configuration.
dev | - The device structure. |
output_mode | - The structure that contains the channel output parameters. |
channel | - The channel number. |
int32_t ad5770r_set_page_mask | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_dac_page_mask * | page_mask | ||
) |
Set page mask for dac value and input.
dev | - The device structure. |
page_mask | - The structure contains the page mask values. |
int32_t ad5770r_set_reference | ( | struct ad5770r_dev * | dev, |
bool | external_reference, | ||
enum ad5770r_reference_voltage | reference_selector | ||
) |
Set reference configuration.
dev | - The device structure. |
external_reference | - Enable external reference. |
reference_selector | - The reference to be selected. |
int32_t ad5770r_set_sw_ldac | ( | struct ad5770r_dev * | dev, |
const struct ad5770r_channel_switches * | sw_ldac | ||
) |
Set software LDAC.
dev | - The device structure. |
sw_ldac | - The array contains channel selection options. |
int32_t ad5770r_spi_reg_read | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data | ||
) |
Read from device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
int32_t ad5770r_spi_reg_read_multiple | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data, | ||
uint16_t | count | ||
) |
Multibyte read from device. A register read begins with the address and autoincrements for each aditional byte in the transfer.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
count | - Number of bytes to read. |
int32_t ad5770r_spi_reg_write | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t | reg_data | ||
) |
Write to device.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
int32_t ad5770r_spi_reg_write_multiple | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint8_t * | reg_data, | ||
uint16_t | count | ||
) |
Multibyte write from device. A register write begins with the address and autoincrements for each additional byte in the transfer.
dev | - The device structure. |
reg_addr | - The register address. |
reg_data | - The register data. |
count | - Number of bytes to read. |
int32_t ad5770r_spi_write_mask | ( | struct ad5770r_dev * | dev, |
uint8_t | reg_addr, | ||
uint32_t | mask, | ||
uint8_t | data | ||
) |
SPI write to device using a mask.
dev | - The device structure. |
reg_addr | - The register address. |
mask | - The mask. |
data | - The register data. |