![]() |
no-OS
|
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"Functions | |
| int | ltc2983_init (struct ltc2983_desc **device, struct ltc2983_init_param *init_param) |
| Device and comm init function. | |
| int | ltc2983_remove (struct ltc2983_desc *device) |
| Remove resources allocated by the init function. | |
| int | ltc2983_reg_read (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t *val) |
| Read raw register value. | |
| int | ltc2983_reg_write (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t val) |
| Write raw register value. | |
| int | ltc2983_reg_update_bits (struct ltc2983_desc *device, uint16_t reg_addr, uint8_t mask, uint8_t val) |
| Update register value. | |
| int | ltc2983_setup (struct ltc2983_desc *device) |
| Device setup. | |
| int | ltc2983_chan_read_resistance (struct ltc2983_desc *device, const int chan, uint32_t *val) |
| Read raw resistance from the ADT7604 resistance result bank (0x0060) | |
| int | ltc2983_chan_read (struct ltc2983_desc *device, const int chan, int *val) |
| Read channel data / temperature. | |
| int | ltc2983_chan_read_raw (struct ltc2983_desc *device, const int chan, uint32_t *val) |
| Read raw channel data / temperature. | |
| 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. | |
| int | ltc2983_chan_read_scale_resistance (struct ltc2983_desc *device, const int chan, uint32_t *val, uint32_t *val2) |
| Get resistance scale for copper trace or leak detector channels. | |
| int | ltc2983_thermocouple_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for thermocouple sensors. | |
| int | ltc2983_rtd_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for RTD sensors. | |
| int | ltc2983_thermistor_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for thermistor sensors. | |
| int | ltc2983_diode_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for diode sensors. | |
| int | ltc2983_r_sense_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for rsense. | |
| int | ltc2983_adc_assign_chan (struct ltc2983_desc *device, const struct ltc2983_sensor *sensor) |
| Channel assignment for direct ADC. | |
| 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. | |
| int | ltc2983_common_fault_handler (const uint32_t result) |
| Fault handling of sensors other than thermocouple. | |
Implementation of LTC2983 Driver.
Copyright 2024(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
| int ltc2983_adc_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for direct ADC.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_chan_read | ( | struct ltc2983_desc * | device, |
| const int | chan, | ||
| int * | val ) |
Read channel data / temperature.
| device | - LTC2983 descriptor |
| chan | - channel number |
| val | - channel data / temperature |
For copper trace (LTC2983_RTD_CUSTOM) and leak detector (LTC2983_THERMISTOR_CUSTOM) channels, use ltc2983_chan_read_resistance() to read raw resistance from the ADT7604 resistance bank. The IIO resistance scales (1/1024000 Ohm/LSB for copper trace, 1/1024 Ohm/LSB for leak detector) cause precision loss in integer arithmetic.
| int ltc2983_chan_read_raw | ( | struct ltc2983_desc * | device, |
| const int | chan, | ||
| uint32_t * | val ) |
Read raw channel data / temperature.
| device | - LTC2983 descriptor |
| chan | - channel number |
| val | - raw channel data / temperature |
| int ltc2983_chan_read_resistance | ( | struct ltc2983_desc * | device, |
| const int | chan, | ||
| uint32_t * | val ) |
Read raw resistance from the ADT7604 resistance result bank (0x0060)
| device | - LTC2983 descriptor |
| chan | - channel number (1-indexed) |
| val | - raw resistance value (bits[30:0], unsigned) |
| 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.
| device | - LTC2983 descriptor |
| chan | - channel number |
| val | - scale numerator |
| val2 | - scale denominator |
| int ltc2983_chan_read_scale_resistance | ( | struct ltc2983_desc * | device, |
| const int | chan, | ||
| uint32_t * | val, | ||
| uint32_t * | val2 ) |
Get resistance scale for copper trace or leak detector channels.
| device | - LTC2983 descriptor |
| chan | - channel number |
| val | - scale numerator |
| val2 | - scale denominator |
| int ltc2983_common_fault_handler | ( | const uint32_t | result | ) |
Fault handling of sensors other than thermocouple.
| result | - result captured that contains the faults |
| int ltc2983_diode_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for diode sensors.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_init | ( | struct ltc2983_desc ** | device, |
| struct ltc2983_init_param * | init_param ) |
Device and comm init function.
| device | - LTC2983 descriptor to be initialized |
| init_param | - Init parameter for descriptor |
| int ltc2983_r_sense_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for rsense.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_reg_read | ( | struct ltc2983_desc * | device, |
| uint16_t | reg_addr, | ||
| uint8_t * | val ) |
Read raw register value.
| device | - LTC2983 descriptor |
| reg_addr | - register address |
| val | - register value |
| int ltc2983_reg_update_bits | ( | struct ltc2983_desc * | device, |
| uint16_t | reg_addr, | ||
| uint8_t | mask, | ||
| uint8_t | val ) |
Update register value.
| device | - LTC2983 descriptor |
| reg_addr | - register address |
| mask | - Mask for specific register bits to be updated |
| val | - register value to be written |
| int ltc2983_reg_write | ( | struct ltc2983_desc * | device, |
| uint16_t | reg_addr, | ||
| uint8_t | val ) |
Write raw register value.
| device | - LTC2983 descriptor |
| reg_addr | - register address |
| val | - register value |
| int ltc2983_remove | ( | struct ltc2983_desc * | device | ) |
Remove resources allocated by the init function.
| device | - LTC2983 descriptor |
| int ltc2983_rtd_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for RTD sensors.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_setup | ( | struct ltc2983_desc * | device | ) |
Device setup.
| device | - LTC2983 descriptor |
make sure the device is up: start bit (7) is 0 and done bit (6) is 1
| int ltc2983_temp_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for analog temp sensor
| int ltc2983_thermistor_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for thermistor sensors.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_thermocouple_assign_chan | ( | struct ltc2983_desc * | device, |
| const struct ltc2983_sensor * | sensor ) |
Channel assignment for thermocouple sensors.
| device | - LTC2983 descriptor |
| sensor | - LTC2983 common sensor descriptor |
| int ltc2983_thermocouple_fault_handler | ( | const uint32_t | result | ) |
Fault handling of thermocouple sensors.
| result | - result captured that contains the faults |