![]() |
no-OS
|
Header file of CN0391 board support. More...
Go to the source code of this file.
Classes | |
| struct | cn0391_adc_ch_map |
| struct | cn0391_cache |
| struct | cn0391_dev |
| struct | cn0391_init_param |
Functions | |
| 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.
Copyright 2026(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:
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.
| #define CN0391_ADC_CHANNELS_PER_IIO_CH 3 |
| #define CN0391_ADC_CLK_HZ 614400ULL |
| #define CN0391_ADC_FULL_SCALE (1U << CN0391_ADC_RESOLUTION) /* 2^24 */ |
| #define CN0391_ADC_MIDSCALE (CN0391_ADC_FULL_SCALE >> 1) /* 2^23, bipolar zero-code */ |
| #define CN0391_ADC_REF_VOLTAGE 2.5 |
| #define CN0391_ADC_RESOLUTION 24 /* AD7124 is a high precision 24-bit Sigma-Delta ADC */ |
| #define CN0391_CH0_ID 0 |
| #define CN0391_CH1_ID 1 |
| #define CN0391_CH2_ID 2 |
| #define CN0391_CH3_ID 3 |
| #define CN0391_CONV_TIME_US |
| #define CN0391_FILTER_FS 384U |
| #define CN0391_FILTER_ORDER 4U /* Sinc4: 4-period settling */ |
| #define CN0391_FILTER_REG_VAL (AD7124_FILT_REG_FILTER(CN0391_FILTER_TYPE) | AD7124_FILT_REG_FS(CN0391_FILTER_FS)) |
| #define CN0391_FILTER_TYPE 0 /* Sinc4 */ |
| #define CN0391_GAIN 32 |
| #define CN0391_NUM_IIO_CHANNELS 4 |
| #define CN0391_RTD_GAIN 1 |
| #define CN0391_SETUP_RTD_IDX 1 /* R5 + CJC RTD: Gain=1, bipolar, internal ref */ |
| #define CN0391_SETUP_TC_IDX 0 /* Thermocouple: Gain=32, bipolar, internal ref */ |
| #define CN0391_SPI_RDY_POLL_CNT | ( | spi_hz | ) |
| #define CN0391_THERMO_RES 1600 |
| int cn0391_init | ( | struct cn0391_dev ** | dev, |
| struct cn0391_init_param * | init_param ) |
Initialize CN0391 device: set up AD7124 and configure IOUT.
| dev | - Pointer to pointer to CN0391 device descriptor. |
| init_param | - Initialization parameters. |
| 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.
| 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). |
| int cn0391_remove | ( | struct cn0391_dev * | dev | ) |
Remove CN0391 device and free resources.
| dev | - CN0391 device descriptor. |