no-OS
Functions
ltc2983.c File Reference

Implementation of LTC2983 Driver. More...

#include <errno.h>
#include "ltc2983.h"
#include "no_os_alloc.h"
#include "no_os_delay.h"
#include "no_os_print_log.h"
Include dependency graph for ltc2983.c:

Functions

int ltc2983_init (struct ltc2983_desc **device, struct ltc2983_init_param *init_param)
 Device and comm init function. More...
 
int ltc2983_remove (struct ltc2983_desc *device)
 Remove resources allocated by the init function. More...
 
int ltc2983_reg_read (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t *val)
 Read raw register value. More...
 
int ltc2983_reg_write (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t val)
 Write raw register value. More...
 
int ltc2983_reg_update_bits (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t mask, uint8_t val)
 Update register value. More...
 
int ltc2983_setup (struct ltc2983_desc *device)
 Device setup. More...
 
int ltc2983_chan_read (struct ltc2983_desc *device, const int chan, int *val)
 Read channel data / temperature. More...
 
int ltc2983_chan_read_raw (struct ltc2983_desc *device, const int chan, uint32_t *val)
 Read raw channel data / temperature. More...
 
int ltc2983_chan_read_scale (struct ltc2983_desc *device, const int chan, uint32_t *val, uint32_t *val2)
 Set scale of raw channel data / temperature. More...
 
int ltc2983_thermocouple_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for thermocouple sensors. More...
 
int ltc2983_rtd_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for RTD sensors. More...
 
int ltc2983_thermistor_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for thermistor sensors. More...
 
int ltc2983_diode_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for diode sensors. More...
 
int ltc2983_r_sense_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for rsense. More...
 
int ltc2983_adc_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 Channel assignment for direct ADC. More...
 
int ltc2983_temp_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor)
 
int ltc2983_thermocouple_fault_handler (const uint32_t result)
 Fault handling of thermocouple sensors. More...
 
int ltc2983_common_fault_handler (const uint32_t result)
 Fault handling of sensors other than thermocouple. More...
 

Detailed Description

Implementation of LTC2983 Driver.

Author
John Erasmus Mari Geronimo (johne.nosp@m.rasm.nosp@m.usmar.nosp@m.i.ge.nosp@m.ronim.nosp@m.o@an.nosp@m.alog..nosp@m.com)

Copyright 2024(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

◆ ltc2983_adc_assign_chan()

int ltc2983_adc_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for direct ADC.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_chan_read()

int ltc2983_chan_read ( struct ltc2983_desc device,
const int  chan,
int *  val 
)

Read channel data / temperature.

Parameters
device- LTC2983 descriptor
chan- channel number
val- channel data / temperature
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_chan_read_raw()

int ltc2983_chan_read_raw ( struct ltc2983_desc device,
const int  chan,
uint32_t *  val 
)

Read raw channel data / temperature.

Parameters
device- LTC2983 descriptor
chan- channel number
val- raw channel data / temperature
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_chan_read_scale()

int ltc2983_chan_read_scale ( struct ltc2983_desc device,
const int  chan,
uint32_t *  val,
uint32_t *  val2 
)

Set scale of raw channel data / temperature.

Parameters
device- LTC2983 descriptor
chan- channel number
val- scale numerator
val2- scale denominator
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_common_fault_handler()

int ltc2983_common_fault_handler ( const uint32_t  result)

Fault handling of sensors other than thermocouple.

Parameters
result- result captured that contains the faults
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_diode_assign_chan()

int ltc2983_diode_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for diode sensors.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_init()

int ltc2983_init ( struct ltc2983_desc **  device,
struct ltc2983_init_param init_param 
)

Device and comm init function.

Parameters
device- LTC2983 descriptor to be initialized
init_param- Init parameter for descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_r_sense_assign_chan()

int ltc2983_r_sense_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for rsense.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_reg_read()

int ltc2983_reg_read ( struct ltc2983_desc device,
uint16_t  reg_addr,
uint8_t *  val 
)

Read raw register value.

Parameters
device- LTC2983 descriptor
reg_addr- register address
val- register value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2983_reg_update_bits()

int ltc2983_reg_update_bits ( struct ltc2983_desc device,
uint16_t  reg_addr,
uint8_t  mask,
uint8_t  val 
)

Update register value.

Parameters
device- LTC2983 descriptor
reg_addr- register address
mask- Mask for specific register bits to be updated
val- register value to be written
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2983_reg_write()

int ltc2983_reg_write ( struct ltc2983_desc device,
uint16_t  reg_addr,
uint8_t  val 
)

Write raw register value.

Parameters
device- LTC2983 descriptor
reg_addr- register address
val- register value
Returns
0 in case of success, negative error code otherwise
Here is the caller graph for this function:

◆ ltc2983_remove()

int ltc2983_remove ( struct ltc2983_desc device)

Remove resources allocated by the init function.

Parameters
device- LTC2983 descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_rtd_assign_chan()

int ltc2983_rtd_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for RTD sensors.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_setup()

int ltc2983_setup ( struct ltc2983_desc device)

Device setup.

Parameters
device- LTC2983 descriptor
Returns
0 in case of success, errno errors otherwise

make sure the device is up: start bit (7) is 0 and done bit (6) is 1

Here is the caller graph for this function:

◆ ltc2983_temp_assign_chan()

int ltc2983_temp_assign_chan ( struct ltc2983_desc ,
const struct ltc2983_sensor  
)

Channel assignment for analog temp sensor

Here is the caller graph for this function:

◆ ltc2983_thermistor_assign_chan()

int ltc2983_thermistor_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for thermistor sensors.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_thermocouple_assign_chan()

int ltc2983_thermocouple_assign_chan ( struct ltc2983_desc device,
const struct ltc2983_sensor sensor 
)

Channel assignment for thermocouple sensors.

Parameters
device- LTC2983 descriptor
sensor- LTC2983 common sensor descriptor
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function:

◆ ltc2983_thermocouple_fault_handler()

int ltc2983_thermocouple_fault_handler ( const uint32_t  result)

Fault handling of thermocouple sensors.

Parameters
result- result captured that contains the faults
Returns
0 in case of success, errno errors otherwise
Here is the caller graph for this function: