Header file of CN0391 board support.
More...
|
| int | cn0391_init (struct cn0391_dev **dev, struct cn0391_init_param *init_param) |
| | Initialize CN0391 device: set up AD7124 and configure IOUT.
|
| |
| int | cn0391_remove (struct cn0391_dev *dev) |
| | Remove CN0391 device and free resources.
|
| |
| int | cn0391_read_temperature (struct cn0391_dev *dev, uint8_t ch_idx, double *hot_junction_temp, double *cold_junction_temp, double *thermocouple_voltage, double *rtd_resistance) |
| | Perform a full temperature measurement cycle. Reads all 3 ADC channels (thermocouple, reference resistor, CJC RTD), computes cold junction temperature, cold junction compensation voltage, and hot junction temperature.
|
| |
Header file of CN0391 board support.
- Author
- Mircea Vlasin (mirce.nosp@m.a.vl.nosp@m.asin@.nosp@m.anal.nosp@m.og.co.nosp@m.m)
Copyright 2026(c) Analog Devices, Inc.
SPDX-License-Identifier: BSD-3-Clause
◆ CN0391_ADC_CHANNELS_PER_IIO_CH
| #define CN0391_ADC_CHANNELS_PER_IIO_CH 3 |
◆ CN0391_ADC_CLK_HZ
| #define CN0391_ADC_CLK_HZ 614400ULL |
◆ CN0391_ADC_FULL_SCALE
◆ CN0391_ADC_MIDSCALE
◆ CN0391_ADC_REF_VOLTAGE
| #define CN0391_ADC_REF_VOLTAGE 2.5 |
◆ CN0391_ADC_RESOLUTION
| #define CN0391_ADC_RESOLUTION 24 /* AD7124 is a high precision 24-bit Sigma-Delta ADC */ |
◆ CN0391_CH0_ID
◆ CN0391_CH1_ID
◆ CN0391_CH2_ID
◆ CN0391_CH3_ID
◆ CN0391_CONV_TIME_US
| #define CN0391_CONV_TIME_US |
Value:
#define CN0391_FILTER_ORDER
Definition cn0391.h:56
#define CN0391_ADC_CLK_HZ
Definition cn0391.h:32
#define CN0391_FILTER_FS
Definition cn0391.h:34
◆ CN0391_FILTER_FS
| #define CN0391_FILTER_FS 384U |
◆ CN0391_FILTER_ORDER
| #define CN0391_FILTER_ORDER 4U /* Sinc4: 4-period settling */ |
◆ CN0391_FILTER_REG_VAL
◆ CN0391_FILTER_TYPE
| #define CN0391_FILTER_TYPE 0 /* Sinc4 */ |
◆ CN0391_GAIN
◆ CN0391_NUM_IIO_CHANNELS
| #define CN0391_NUM_IIO_CHANNELS 4 |
◆ CN0391_RTD_GAIN
| #define CN0391_RTD_GAIN 1 |
◆ CN0391_SETUP_RTD_IDX
| #define CN0391_SETUP_RTD_IDX 1 /* R5 + CJC RTD: Gain=1, bipolar, internal ref */ |
◆ CN0391_SETUP_TC_IDX
| #define CN0391_SETUP_TC_IDX 0 /* Thermocouple: Gain=32, bipolar, internal ref */ |
◆ CN0391_SPI_RDY_POLL_CNT
| #define CN0391_SPI_RDY_POLL_CNT |
( |
| spi_hz | ) |
|
Value:
#define CN0391_CONV_TIME_US
Definition cn0391.h:76
◆ CN0391_THERMO_RES
| #define CN0391_THERMO_RES 1600 |
◆ cn0391_init()
Initialize CN0391 device: set up AD7124 and configure IOUT.
- Parameters
-
| dev | - Pointer to pointer to CN0391 device descriptor. |
| init_param | - Initialization parameters. |
- Returns
- 0 on success, negative error code otherwise.
◆ cn0391_read_temperature()
| int cn0391_read_temperature |
( |
struct cn0391_dev * | dev, |
|
|
uint8_t | ch_idx, |
|
|
double * | hot_junction_temp, |
|
|
double * | cold_junction_temp, |
|
|
double * | thermocouple_voltage, |
|
|
double * | rtd_resistance ) |
Perform a full temperature measurement cycle. Reads all 3 ADC channels (thermocouple, reference resistor, CJC RTD), computes cold junction temperature, cold junction compensation voltage, and hot junction temperature.
- Parameters
-
| dev | - CN0391 device descriptor. |
| ch_idx | - IIO channel index (CN0391_CH0_ID..CN0391_CH3_ID). |
| hot_junction_temp | - Pointer to store hot junction temperature (°C). |
| cold_junction_temp | - Pointer to store cold junction temperature (°C). |
| thermocouple_voltage | - Pointer to store thermocouple voltage (mV). |
| rtd_resistance | - Pointer to store measured RTD resistance (Ohms). |
- Returns
- 0 on success, negative error code otherwise.
◆ cn0391_remove()
Remove CN0391 device and free resources.
- Parameters
-
| dev | - CN0391 device descriptor. |
- Returns
- 0 on success, negative error code otherwise.