42#define LTC2983_STATUS_REG 0x0000
43#define LTC2983_TEMP_RES_START_REG 0x0010
44#define LTC2983_EEPROM_KEY_REG 0x00B0
45#define LTC2983_EEPROM_READ_STATUS_REG 0x00D0
46#define LTC2983_GLOBAL_CONFIG_REG 0x00F0
47#define LTC2986_EEPROM_STATUS_REG 0x00F9
48#define LTC2983_MUX_CONFIG_REG 0x00FF
49#define LTC2983_CHAN_ASSIGN_START_REG 0x0200
50#define LTC2983_CUST_SENS_TBL_START_REG 0x0250
51#define LTC2983_CUST_SENS_TBL_END_REG 0x03CF
53#define LTC2983_CUST_SENS_TBL_SIZE LTC2983_CUST_SENS_TBL_END_REG - \
54 LTC2983_CUST_SENS_TBL_START_REG + 1
53#define LTC2983_CUST_SENS_TBL_SIZE LTC2983_CUST_SENS_TBL_END_REG - \ …
55#define LTC2983_SPI_READ_BYTE 0x3
56#define LTC2983_SPI_WRITE_BYTE 0x2
58#define LTC2983_EEPROM_KEY 0xA53C0F5A
59#define LTC2983_EEPROM_WRITE_CMD 0x15
60#define LTC2983_EEPROM_READ_CMD 0x16
61#define LTC2983_EEPROM_STATUS_FAILURE_MASK NO_OS_GENMASK(3, 1)
62#define LTC2983_EEPROM_READ_FAILURE_MASK NO_OS_GENMASK(7, 0)
64#define LTC2983_EEPROM_WRITE_TIME_MS 2600
65#define LTC2983_EEPROM_READ_TIME_MS 20
67#define LTC2983_CHAN_START_ADDR(chan) \
68 (((chan - 1) * 4) + LTC2983_CHAN_ASSIGN_START_REG)
67#define LTC2983_CHAN_START_ADDR(chan) \ …
69#define LTC2983_CHAN_RES_ADDR(chan) \
70 (((chan - 1) * 4) + LTC2983_TEMP_RES_START_REG)
69#define LTC2983_CHAN_RES_ADDR(chan) \ …
72#define LTC2983_COMMON_HARD_FAULT_MASK NO_OS_GENMASK(31, 30)
73#define LTC2983_COMMON_SOFT_FAULT_MASK NO_OS_GENMASK(27, 25)
75#define LTC2983_STATUS_START_MASK NO_OS_BIT(7)
76#define LTC2983_STATUS_START(x) no_os_field_prep(LTC2983_STATUS_START_MASK, x)
77#define LTC2983_STATUS_UP_MASK NO_OS_GENMASK(7, 6)
78#define LTC2983_STATUS_UP(reg) no_os_field_get(LTC2983_STATUS_UP_MASK, reg)
80#define LTC2983_STATUS_CHAN_SEL_MASK NO_OS_GENMASK(4, 0)
81#define LTC2983_STATUS_CHAN_SEL(x) \
82 no_os_field_prep(LTC2983_STATUS_CHAN_SEL_MASK, x)
81#define LTC2983_STATUS_CHAN_SEL(x) \ …
84#define LTC2983_NOTCH_FREQ_MASK NO_OS_GENMASK(1, 0)
86#define LTC2983_RES_VALID_MASK NO_OS_BIT(24)
87#define LTC2983_DATA_SIGN_BIT 23
88#define LTC2983_DATA_MASK NO_OS_GENMASK(LTC2983_DATA_SIGN_BIT, 0)
90#define LTC2983_CHAN_TYPE_MASK NO_OS_GENMASK(31, 27)
91#define LTC2983_CHAN_TYPE(x) no_os_field_prep(LTC2983_CHAN_TYPE_MASK, x)
93#define LTC2983_CHAN_ASSIGN_MASK NO_OS_GENMASK(26, 22)
94#define LTC2983_CHAN_ASSIGN(x) no_os_field_prep(LTC2983_CHAN_ASSIGN_MASK, x)
96#define LTC2983_CUSTOM_LEN_MASK NO_OS_GENMASK(5, 0)
97#define LTC2983_CUSTOM_LEN(x) no_os_field_prep(LTC2983_CUSTOM_LEN_MASK, x)
99#define LTC2983_CUSTOM_ADDR_MASK NO_OS_GENMASK(11, 6)
100#define LTC2983_CUSTOM_ADDR(x) no_os_field_prep(LTC2983_CUSTOM_ADDR_MASK, x)
102#define LTC2983_THERMOCOUPLE_CFG_MASK NO_OS_GENMASK(21, 18)
103#define LTC2983_THERMOCOUPLE_CFG(x) \
104 no_os_field_prep(LTC2983_THERMOCOUPLE_CFG_MASK, x)
103#define LTC2983_THERMOCOUPLE_CFG(x) \ …
105#define LTC2983_THERMOCOUPLE_HARD_FAULT_MASK NO_OS_GENMASK(31, 29)
106#define LTC2983_THERMOCOUPLE_SOFT_FAULT_MASK NO_OS_GENMASK(28, 25)
108#define LTC2983_RTD_CFG_MASK NO_OS_GENMASK(21, 18)
109#define LTC2983_RTD_CFG(x) no_os_field_prep(LTC2983_RTD_CFG_MASK, x)
110#define LTC2983_RTD_EXC_CURRENT_MASK NO_OS_GENMASK(17, 14)
111#define LTC2983_RTD_EXC_CURRENT(x) \
112 no_os_field_prep(LTC2983_RTD_EXC_CURRENT_MASK, x)
111#define LTC2983_RTD_EXC_CURRENT(x) \ …
113#define LTC2983_RTD_CURVE_MASK NO_OS_GENMASK(13, 12)
114#define LTC2983_RTD_CURVE(x) no_os_field_prep(LTC2983_RTD_CURVE_MASK, x)
116#define LTC2983_THERMISTOR_CFG_MASK NO_OS_GENMASK(21, 19)
117#define LTC2983_THERMISTOR_CFG(x) \
118 no_os_field_prep(LTC2983_THERMISTOR_CFG_MASK, x)
117#define LTC2983_THERMISTOR_CFG(x) \ …
119#define LTC2983_THERMISTOR_EXC_CURRENT_MASK NO_OS_GENMASK(18, 15)
120#define LTC2983_THERMISTOR_EXC_CURRENT(x) \
121 no_os_field_prep(LTC2983_THERMISTOR_EXC_CURRENT_MASK, x)
120#define LTC2983_THERMISTOR_EXC_CURRENT(x) \ …
123#define LTC2983_DIODE_CFG_MASK NO_OS_GENMASK(26, 24)
124#define LTC2983_DIODE_CFG(x) no_os_field_prep(LTC2983_DIODE_CFG_MASK, x)
125#define LTC2983_DIODE_EXC_CURRENT_MASK NO_OS_GENMASK(23, 22)
126#define LTC2983_DIODE_EXC_CURRENT(x) \
127 no_os_field_prep(LTC2983_DIODE_EXC_CURRENT_MASK, x)
126#define LTC2983_DIODE_EXC_CURRENT(x) \ …
128#define LTC2983_DIODE_IDEAL_FACTOR_MASK NO_OS_GENMASK(21, 0)
129#define LTC2983_DIODE_IDEAL_FACTOR(x) \
130 no_os_field_prep(LTC2983_DIODE_IDEAL_FACTOR_MASK, x)
129#define LTC2983_DIODE_IDEAL_FACTOR(x) \ …
132#define LTC2983_R_SENSE_VAL_MASK NO_OS_GENMASK(26, 0)
133#define LTC2983_R_SENSE_VAL(x) no_os_field_prep(LTC2983_R_SENSE_VAL_MASK, x)
135#define LTC2983_ADC_SINGLE_ENDED_MASK NO_OS_BIT(26)
136#define LTC2983_ADC_SINGLE_ENDED(x) \
137 no_os_field_prep(LTC2983_ADC_SINGLE_ENDED_MASK, x)
136#define LTC2983_ADC_SINGLE_ENDED(x) \ …
196#define to_thermocouple(_sensor) \
197 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_thermocouple, sensor)
196#define to_thermocouple(_sensor) \ …
199#define to_rtd(_sensor) \
200 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_rtd, sensor)
199#define to_rtd(_sensor) \ …
202#define to_thermistor(_sensor) \
203 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_thermistor, sensor)
202#define to_thermistor(_sensor) \ …
205#define to_diode(_sensor) \
206 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_diode, sensor)
205#define to_diode(_sensor) \ …
208#define to_rsense(_sensor) \
209 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_rsense, sensor)
208#define to_rsense(_sensor) \ …
211#define to_adc(_sensor) \
212 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_adc, sensor)
211#define to_adc(_sensor) \ …
214#define to_temp(_sensor) \
215 NO_OS_CONTAINER_OF(_sensor, struct ltc2983_temp, sensor)
214#define to_temp(_sensor) \ …
int ltc2983_reg_update_bits(struct ltc2983_desc *, uint16_t, uint8_t, uint8_t)
Update register value.
Definition ltc2983.c:201
int ltc2983_common_fault_handler(const uint32_t)
Fault handling of sensors other than thermocouple.
Definition ltc2983.c:675
int ltc2983_setup(struct ltc2983_desc *)
Device setup.
Definition ltc2983.c:221
int ltc2983_chan_read(struct ltc2983_desc *, const int, int *)
Read channel data / temperature.
Definition ltc2983.c:317
int ltc2983_init(struct ltc2983_desc **, struct ltc2983_init_param *)
Device and comm init function.
Definition ltc2983.c:48
int ltc2983_diode_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for diode sensors.
Definition ltc2983.c:567
int ltc2983_chan_read_raw(struct ltc2983_desc *, const int, uint32_t *)
Read raw channel data / temperature.
Definition ltc2983.c:347
int ltc2983_reg_write(struct ltc2983_desc *, uint16_t, uint8_t)
Write raw register value.
Definition ltc2983.c:175
int ltc2983_rtd_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for RTD sensors.
Definition ltc2983.c:510
int ltc2983_reg_read(struct ltc2983_desc *, uint16_t, uint8_t *)
Read raw register value.
Definition ltc2983.c:149
int ltc2983_r_sense_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for rsense.
Definition ltc2983.c:589
int ltc2983_temp_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Definition ltc2983.c:619
int ltc2983_thermocouple_fault_handler(const uint32_t)
Fault handling of thermocouple sensors.
Definition ltc2983.c:663
int ltc2983_thermocouple_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for thermocouple sensors.
Definition ltc2983.c:483
int ltc2983_chan_read_scale(struct ltc2983_desc *, const int, uint32_t *, uint32_t *)
Set scale of raw channel data / temperature.
Definition ltc2983.c:399
ltc2983_filter_notch_freq
Notch frequency of the digital filter.
Definition ltc2983.h:152
@ LTC2983_50HZ_REJECTION
Definition ltc2983.h:155
@ LTC2983_60HZ_REJECTION
Definition ltc2983.h:154
@ LTC2983_50_60HZ_REJECTION
Definition ltc2983.h:153
int ltc2983_remove(struct ltc2983_desc *)
Remove resources allocated by the init function.
Definition ltc2983.c:123
ltc2983_sensor_type
LTC2983 Sensor Type.
Definition ltc2983.h:161
@ LTC2983_DIRECT_ADC
Definition ltc2983.h:192
@ LTC2983_THERMOCOUPLE_R
Definition ltc2983.h:167
@ LTC2983_ACTIVE_TEMP
Definition ltc2983.h:193
@ LTC2983_THERMOCOUPLE_E
Definition ltc2983.h:165
@ LTC2983_RTD_PT_200
Definition ltc2983.h:175
@ LTC2983_THERMISTOR_44004_44033
Definition ltc2983.h:181
@ LTC2983_RTD_PT_100
Definition ltc2983.h:174
@ LTC2983_THERMOCOUPLE_N
Definition ltc2983.h:166
@ LTC2983_THERMISTOR_CUSTOM
Definition ltc2983.h:189
@ LTC2983_THERMOCOUPLE_CUSTOM
Definition ltc2983.h:171
@ LTC2983_UNASSIGNED
Definition ltc2983.h:162
@ LTC2983_THERMISTOR_44007_44034
Definition ltc2983.h:183
@ LTC2983_RTD_PT_50
Definition ltc2983.h:173
@ LTC2983_THERMISTOR_44006_44031
Definition ltc2983.h:184
@ LTC2983_THERMISTOR_44008_44032
Definition ltc2983.h:185
@ LTC2983_THERMOCOUPLE_T
Definition ltc2983.h:169
@ LTC2983_RTD_PT_10
Definition ltc2983.h:172
@ LTC2983_RTD_NI_120
Definition ltc2983.h:179
@ LTC2983_RTD_PT_500
Definition ltc2983.h:176
@ LTC2983_THERMOCOUPLE_B
Definition ltc2983.h:170
@ LTC2983_THERMISTOR_44005_44030
Definition ltc2983.h:182
@ LTC2983_THERMOCOUPLE_K
Definition ltc2983.h:164
@ LTC2983_THERMISTOR_SPECTRUM_1003K
Definition ltc2983.h:187
@ LTC2983_RTD_CUSTOM
Definition ltc2983.h:180
@ LTC2983_RTD_PT_1000
Definition ltc2983.h:177
@ LTC2983_RTD_1000
Definition ltc2983.h:178
@ LTC2983_THERMISTOR_YSI_400
Definition ltc2983.h:186
@ LTC2983_THERMOCOUPLE_S
Definition ltc2983.h:168
@ LTC2983_THERMISTOR_CUSTOM_STEINHART_HART
Definition ltc2983.h:188
@ LTC2983_THERMOCOUPLE_J
Definition ltc2983.h:163
@ LTC2983_RSENSE
Definition ltc2983.h:191
@ LTC2983_DIODE
Definition ltc2983.h:190
int ltc2983_thermistor_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for thermistor sensors.
Definition ltc2983.c:538
ltc298x_id
Definition ltc2983.h:143
@ ID_LTC2984
Definition ltc2983.h:145
@ ID_LTC2983
Definition ltc2983.h:144
@ ID_LTC2986
Definition ltc2983.h:146
int ltc2983_adc_assign_chan(struct ltc2983_desc *, const struct ltc2983_sensor *)
Channel assignment for direct ADC.
Definition ltc2983.c:608
Header file of GPIO Interface.
Header file of SPI Interface.
Header file of utility functions.
LTC2983 diode ideal factor value.
Definition ltc2983.h:332
uint32_t ideal_factor_val_dec_1048576
Definition ltc2983.h:336
uint32_t ideal_factor_val_int
Definition ltc2983.h:334
direct ADC descriptor for LTC2983
Definition ltc2983.h:376
bool single_ended
Definition ltc2983.h:380
struct ltc2983_sensor sensor
Definition ltc2983.h:378
custom LTC2983 sensor struct
Definition ltc2983.h:272
size_t len
Definition ltc2983.h:276
bool is_steinhart
Definition ltc2983.h:278
uint32_t * table
Definition ltc2983.h:274
LTC2983 descriptor.
Definition ltc2983.h:240
uint8_t max_channels_nr
Definition ltc2983.h:256
struct ltc2983_sensor * sensors[20]
Definition ltc2983.h:252
uint16_t custom_addr_ptr
Definition ltc2983.h:254
struct no_os_spi_desc * comm_desc
Definition ltc2983.h:242
enum ltc2983_filter_notch_freq filter_notch_freq
Definition ltc2983.h:248
struct no_os_gpio_desc * gpio_rstn
Definition ltc2983.h:244
uint32_t mux_delay_config_us
Definition ltc2983.h:246
uint8_t num_channels
Definition ltc2983.h:250
diode sensor descriptor for LTC2983
Definition ltc2983.h:342
uint32_t excitation_current
Definition ltc2983.h:348
uint32_t sensor_config
Definition ltc2983.h:346
struct ltc2983_sensor sensor
Definition ltc2983.h:344
struct ideal_factor_value ideal_factor_val
Definition ltc2983.h:350
LTC2983 init param.
Definition ltc2983.h:220
enum ltc2983_filter_notch_freq filter_notch_freq
Definition ltc2983.h:228
enum ltc298x_id dev_type
Definition ltc2983.h:234
struct no_os_spi_init_param spi_init
Definition ltc2983.h:222
uint32_t mux_delay_config_us
Definition ltc2983.h:226
struct ltc2983_sensor * sensors[20]
Definition ltc2983.h:230
struct no_os_gpio_init_param gpio_rstn
Definition ltc2983.h:224
uint16_t custom_addr_ptr
Definition ltc2983.h:232
sense resistor descriptor for LTC2983
Definition ltc2983.h:366
struct r_sense_value r_sense_val
Definition ltc2983.h:370
struct ltc2983_sensor sensor
Definition ltc2983.h:368
RTD sensor descriptor for LTC2983.
Definition ltc2983.h:298
uint32_t r_sense_chan
Definition ltc2983.h:306
struct ltc2983_sensor sensor
Definition ltc2983.h:300
uint32_t sensor_config
Definition ltc2983.h:304
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:302
uint32_t excitation_current
Definition ltc2983.h:308
uint32_t rtd_curve
Definition ltc2983.h:310
common LTC2983 sensor struct
Definition ltc2983.h:262
uint8_t chan
Definition ltc2983.h:264
uint8_t type
Definition ltc2983.h:266
analog temperature sensor descriptor for LTC2983
Definition ltc2983.h:386
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:390
struct ltc2983_sensor sensor
Definition ltc2983.h:388
bool single_ended
Definition ltc2983.h:392
thermistor sensor descriptor for LTC2983
Definition ltc2983.h:316
struct ltc2983_sensor sensor
Definition ltc2983.h:318
uint32_t sensor_config
Definition ltc2983.h:322
uint32_t excitation_current
Definition ltc2983.h:326
uint32_t r_sense_chan
Definition ltc2983.h:324
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:320
thermocouple sensor descriptor for LTC2983
Definition ltc2983.h:284
struct ltc2983_sensor sensor
Definition ltc2983.h:286
struct ltc2983_custom_sensor * custom
Definition ltc2983.h:288
uint32_t cold_junction_chan
Definition ltc2983.h:292
uint32_t sensor_config
Definition ltc2983.h:290
Structure holding the GPIO descriptor.
Definition no_os_gpio.h:84
Structure holding the parameters for GPIO initialization.
Definition no_os_gpio.h:67
Structure holding SPI descriptor.
Definition no_os_spi.h:180
Structure holding the parameters for SPI initialization.
Definition no_os_spi.h:128
LTC2983 sense resistance value.
Definition ltc2983.h:356
uint32_t r_sense_val_int
Definition ltc2983.h:358
uint32_t r_sense_val_dec_1024
Definition ltc2983.h:360