no-OS
Functions
ltc2688.c File Reference

Implementation of LTC2688 Driver. More...

#include <stdlib.h>
#include <stdio.h>
#include "no_os_error.h"
#include "ltc2688.h"
Include dependency graph for ltc2688.c:

Functions

int32_t ltc2688_set_pwr_dac (struct ltc2688_dev *dev, uint16_t setting)
 
int32_t ltc2688_set_dither_toggle (struct ltc2688_dev *dev, uint16_t setting)
 
int32_t ltc2688_set_dither_mode (struct ltc2688_dev *dev, uint8_t channel, bool en)
 
int32_t ltc2688_set_span (struct ltc2688_dev *dev, uint8_t channel, enum ltc2688_voltage_range range)
 
int32_t ltc2688_set_dither_phase (struct ltc2688_dev *dev, uint8_t channel, enum ltc2688_dither_phase phase)
 
int32_t ltc2688_set_dither_period (struct ltc2688_dev *dev, uint8_t channel, enum ltc2688_dither_period period)
 
int32_t ltc2688_select_reg (struct ltc2688_dev *dev, uint8_t channel, enum ltc2688_a_b_register sel_reg)
 
int32_t ltc2688_select_tg_dith_clk (struct ltc2688_dev *dev, uint8_t channel, enum ltc2688_clk_input clk_input)
 
int32_t ltc2688_software_toggle (struct ltc2688_dev *dev, uint8_t channel)
 
int32_t ltc2688_software_reset (struct ltc2688_dev *dev)
 
int32_t ltc2688_set_voltage (struct ltc2688_dev *dev, uint8_t channel, float voltage)
 
int32_t ltc2688_init (struct ltc2688_dev **device, struct ltc2688_init_param init_param)
 
int32_t ltc2688_remove (struct ltc2688_dev *dev)
 Free the resources allocated by ltc2688_init(). More...
 

Detailed Description

Implementation of LTC2688 Driver.

Author
Mircea Caprioru (mirce.nosp@m.a.ca.nosp@m.prior.nosp@m.u@an.nosp@m.alog..nosp@m.com)

Copyright 2021(c) Analog Devices, Inc.

All rights reserved.

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 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, 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.

Function Documentation

◆ ltc2688_init()

int32_t ltc2688_init ( struct ltc2688_dev **  device,
struct ltc2688_init_param  init_param 
)

Initialize the device.

Parameters
device- The device structure.
init_param- The structure that contains the device initial parameters.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2688_remove()

int32_t ltc2688_remove ( struct ltc2688_dev dev)

Free the resources allocated by ltc2688_init().

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2688_select_reg()

int32_t ltc2688_select_reg ( struct ltc2688_dev dev,
uint8_t  channel,
enum ltc2688_a_b_register  sel_reg 
)

Select register A or B for value.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
sel_reg- Select register A or B to store DAC output value.
Returns
0 in case of success, negative error code otherwise.

◆ ltc2688_select_tg_dith_clk()

int32_t ltc2688_select_tg_dith_clk ( struct ltc2688_dev dev,
uint8_t  channel,
enum ltc2688_clk_input  clk_input 
)

Select dither/toggle clock input.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
clk_input- Select the source for the clock input.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_dither_mode()

int32_t ltc2688_set_dither_mode ( struct ltc2688_dev dev,
uint8_t  channel,
bool  en 
)

Set channel to dither mode.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
en- enable or disable dither mode
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_dither_period()

int32_t ltc2688_set_dither_period ( struct ltc2688_dev dev,
uint8_t  channel,
enum ltc2688_dither_period  period 
)

Set channel dither period.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
period- Dither period.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_dither_phase()

int32_t ltc2688_set_dither_phase ( struct ltc2688_dev dev,
uint8_t  channel,
enum ltc2688_dither_phase  phase 
)

Set channel dither phase.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
phase- Dither phase.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_dither_toggle()

int32_t ltc2688_set_dither_toggle ( struct ltc2688_dev dev,
uint16_t  setting 
)

Enable dither/toggle for selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: LTC2688_DITH_EN(x) | LTC2688_DITH_EN(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_pwr_dac()

int32_t ltc2688_set_pwr_dac ( struct ltc2688_dev dev,
uint16_t  setting 
)

Power down the selected channels.

Parameters
dev- The device structure.
setting- The setting. Accepted values: LTC2688_PWDN(x) | LTC2688_PWDN(y) | ...
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_span()

int32_t ltc2688_set_span ( struct ltc2688_dev dev,
uint8_t  channel,
enum ltc2688_voltage_range  range 
)

Set channel span.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
range- Voltage range.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_set_voltage()

int32_t ltc2688_set_voltage ( struct ltc2688_dev dev,
uint8_t  channel,
float  voltage 
)

Sets the output voltage of a channel.

Parameters
dev- The device structure.
channel- Channel option.
voltage- Value to be outputted by the DAC(Volts).
Returns
The actual voltage value that can be outputted by the channel.

◆ ltc2688_software_reset()

int32_t ltc2688_software_reset ( struct ltc2688_dev dev)

Software reset the device.

Parameters
dev- The device structure.
Returns
0 in case of success, negative error code otherwise.
Here is the caller graph for this function:

◆ ltc2688_software_toggle()

int32_t ltc2688_software_toggle ( struct ltc2688_dev dev,
uint8_t  channel 
)

Toggle the software source for dither/toggle.

Parameters
dev- The device structure.
channel- The channel for which to change the mode.
Returns
0 in case of success, negative error code otherwise.