no-OS
Functions
ltc2312.c File Reference
#include <stdlib.h>
#include <math.h>
#include "ltc2312.h"
Include dependency graph for ltc2312.c:

Functions

int32_t ltc2312_setup (struct ltc2312_dev **device, struct ltc2312_init_param *init_param)
 
int32_t ltc2312_remove (struct ltc2312_dev *dev)
 
int32_t ltc2312_read (struct ltc2312_dev *dev, uint16_t *ptr_adc_code)
 
void ltc2312_code_to_voltage (struct ltc2312_dev *dev, uint16_t adc_code, float vref, float *voltage)
 

Detailed Description

Library for LTC2315: 12/14-Bit 1Msps ADC

Function Documentation

◆ ltc2312_code_to_voltage()

void ltc2312_code_to_voltage ( struct ltc2312_dev dev,
uint16_t  adc_code,
float  vref,
float *  voltage 
)

Calculates the LTC2312 input voltage given the binary data and LSB weight.

Parameters
[in]dev- The device structure.
[in]adc_code- Raw ADC code.
[in]vref- The reference voltage of the ADC.
[out]voltage- Voltage value calculated.
Returns
void

◆ ltc2312_read()

int32_t ltc2312_read ( struct ltc2312_dev dev,
uint16_t *  ptr_adc_code 
)

Reads the LTC2312 and returns 16-bit data in offset binary format.

Parameters
[in]dev- The device structure.
[out]ptr_adc_code- Read data.
Returns
0 for success, or negative error code otherwise.

◆ ltc2312_remove()

int32_t ltc2312_remove ( struct ltc2312_dev dev)

Free the resources allocated by ltc2312_setup().

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

◆ ltc2312_setup()

int32_t ltc2312_setup ( struct ltc2312_dev **  device,
struct ltc2312_init_param init_param 
)

Initializes the ltc2312 device handler.

Parameters
[out]device- The device structure.
[in]init_param- The structure that contains the device initial parameters.
Returns
0 for success, or negative error code otherwise.