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

Source file of LTC2378 driver. More...

#include "ltc2378.h"
#include <stdlib.h>
#include "no_os_alloc.h"
#include "no_os_delay.h"
#include "no_os_util.h"
Include dependency graph for ltc2378.c:

Functions

int ltc2378_init (struct ltc2378_dev **device, const struct ltc2378_init_param *init_param)
 Initialize the LTC2378-20 device.
 
int ltc2378_remove (struct ltc2378_dev *dev)
 Remove the LTC2378-20 device and free allocated resources.
 
int ltc2378_start_conversion (struct ltc2378_dev *dev)
 Start a single ADC conversion.
 
int ltc2378_read_raw (struct ltc2378_dev *dev, uint32_t *data)
 Read a single raw ADC conversion result.
 
int ltc2378_read_avg (struct ltc2378_dev *dev, uint32_t *avg_data, uint16_t samples)
 Read and average multiple ADC conversion results.
 
int ltc2378_raw_to_uv (struct ltc2378_dev *dev, uint32_t raw, int32_t *voltage_uv)
 Convert raw ADC value to voltage in microvolts.
 
int ltc2378_power_down (struct ltc2378_dev *dev)
 Put the LTC2378-20 into power-down mode.
 

Detailed Description

Source file of LTC2378 driver.

Author
Cherrence Sarip (cherr.nosp@m.ence.nosp@m..sari.nosp@m.p@an.nosp@m.alog..nosp@m.com)

Copyright 2025(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:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Analog Devices, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

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.

Function Documentation

◆ ltc2378_init()

int ltc2378_init ( struct ltc2378_dev ** device,
const struct ltc2378_init_param * init_param )

Initialize the LTC2378-20 device.

Parameters
device- Pointer to device structure pointer
init_param- Pointer to initialization parameters structure
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2378_power_down()

int ltc2378_power_down ( struct ltc2378_dev * dev)

Put the LTC2378-20 into power-down mode.

Parameters
dev- Device structure pointer
Returns
0 in case of success, negative error code otherwise

◆ ltc2378_raw_to_uv()

int ltc2378_raw_to_uv ( struct ltc2378_dev * dev,
uint32_t raw,
int32_t * voltage_uv )

Convert raw ADC value to voltage in microvolts.

Parameters
dev- Device structure pointer
raw- Raw ADC value (20-bit)
voltage_uv- Pointer to store the voltage in microvolts
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2378_read_avg()

int ltc2378_read_avg ( struct ltc2378_dev * dev,
uint32_t * avg_data,
uint16_t samples )

Read and average multiple ADC conversion results.

Parameters
dev- Device structure pointer
avg_data- Pointer to store the averaged raw ADC data
samples- Number of samples to average (1-65535)
Returns
0 in case of success, negative error code otherwise

◆ ltc2378_read_raw()

int ltc2378_read_raw ( struct ltc2378_dev * dev,
uint32_t * data )

Read a single raw ADC conversion result.

Parameters
dev- Device structure pointer
data- Pointer to store the raw ADC data (20-bit value)
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2378_remove()

int ltc2378_remove ( struct ltc2378_dev * dev)

Remove the LTC2378-20 device and free allocated resources.

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

◆ ltc2378_start_conversion()

int ltc2378_start_conversion ( struct ltc2378_dev * dev)

Start a single ADC conversion.

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