Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: tempsensors adi_console_menu platform_drivers
app/ad7124_temperature_sensor.cpp@1:c863d7e9e272, 2021-02-22 (annotated)
- Committer:
- mahphalke
- Date:
- Mon Feb 22 05:13:58 2021 +0000
- Revision:
- 1:c863d7e9e272
- Child:
- 3:f20f09251190
Initial commit- Added source files
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| mahphalke | 1:c863d7e9e272 | 1 | |
| mahphalke | 1:c863d7e9e272 | 2 | /***************************************************************************//* |
| mahphalke | 1:c863d7e9e272 | 3 | * @file ad7124_temperature_sensor.cpp |
| mahphalke | 1:c863d7e9e272 | 4 | * @brief AD7124 temperature sensor functionality |
| mahphalke | 1:c863d7e9e272 | 5 | * @details |
| mahphalke | 1:c863d7e9e272 | 6 | ****************************************************************************** |
| mahphalke | 1:c863d7e9e272 | 7 | * Copyright (c) 2021 Analog Devices, Inc. All Rights Reserved. |
| mahphalke | 1:c863d7e9e272 | 8 | * |
| mahphalke | 1:c863d7e9e272 | 9 | * This software is proprietary to Analog Devices, Inc. and its licensors. |
| mahphalke | 1:c863d7e9e272 | 10 | * By using this software you agree to the terms of the associated |
| mahphalke | 1:c863d7e9e272 | 11 | * Analog Devices Software License Agreement. |
| mahphalke | 1:c863d7e9e272 | 12 | ******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 13 | |
| mahphalke | 1:c863d7e9e272 | 14 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 15 | /***************************** Include Files **********************************/ |
| mahphalke | 1:c863d7e9e272 | 16 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 17 | |
| mahphalke | 1:c863d7e9e272 | 18 | #include <stdint.h> |
| mahphalke | 1:c863d7e9e272 | 19 | #include <math.h> |
| mahphalke | 1:c863d7e9e272 | 20 | |
| mahphalke | 1:c863d7e9e272 | 21 | #include <thermocouple.h> |
| mahphalke | 1:c863d7e9e272 | 22 | #include <ptxxx.h> |
| mahphalke | 1:c863d7e9e272 | 23 | #include <ntc_10k_44031.h> |
| mahphalke | 1:c863d7e9e272 | 24 | #include <ptc_ky81_110.h> |
| mahphalke | 1:c863d7e9e272 | 25 | |
| mahphalke | 1:c863d7e9e272 | 26 | #include "ad7124_temperature_sensor.h" |
| mahphalke | 1:c863d7e9e272 | 27 | |
| mahphalke | 1:c863d7e9e272 | 28 | #ifdef __cplusplus |
| mahphalke | 1:c863d7e9e272 | 29 | extern "C" |
| mahphalke | 1:c863d7e9e272 | 30 | { |
| mahphalke | 1:c863d7e9e272 | 31 | #endif // _cplusplus |
| mahphalke | 1:c863d7e9e272 | 32 | |
| mahphalke | 1:c863d7e9e272 | 33 | #include "ad7124_regs_configs.h" |
| mahphalke | 1:c863d7e9e272 | 34 | #include "ad7124_support.h" |
| mahphalke | 1:c863d7e9e272 | 35 | |
| mahphalke | 1:c863d7e9e272 | 36 | #ifdef __cplusplus // Closing extern c |
| mahphalke | 1:c863d7e9e272 | 37 | } |
| mahphalke | 1:c863d7e9e272 | 38 | #endif // _cplusplus |
| mahphalke | 1:c863d7e9e272 | 39 | |
| mahphalke | 1:c863d7e9e272 | 40 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 41 | /********************* Macros and Constants Definitions ***********************/ |
| mahphalke | 1:c863d7e9e272 | 42 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 43 | |
| mahphalke | 1:c863d7e9e272 | 44 | /* NTC thermistor Rsense value (in ohms) */ |
| mahphalke | 1:c863d7e9e272 | 45 | #define NTC_RSENSE 10000 |
| mahphalke | 1:c863d7e9e272 | 46 | |
| mahphalke | 1:c863d7e9e272 | 47 | /* PTC thermistor Ref Resistance value (in ohms) */ |
| mahphalke | 1:c863d7e9e272 | 48 | #define PTC_RREF 5110 |
| mahphalke | 1:c863d7e9e272 | 49 | |
| mahphalke | 1:c863d7e9e272 | 50 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 51 | /******************** Variables and User Defined Data Types *******************/ |
| mahphalke | 1:c863d7e9e272 | 52 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 53 | |
| mahphalke | 1:c863d7e9e272 | 54 | /* Calibration constant (iout ratio) for RTD resistance measurement */ |
| mahphalke | 1:c863d7e9e272 | 55 | static float calibration_iout_ratio = 1; |
| mahphalke | 1:c863d7e9e272 | 56 | |
| mahphalke | 1:c863d7e9e272 | 57 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 58 | /************************** Functions Definitions *****************************/ |
| mahphalke | 1:c863d7e9e272 | 59 | /******************************************************************************/ |
| mahphalke | 1:c863d7e9e272 | 60 | |
| mahphalke | 1:c863d7e9e272 | 61 | /*! |
| mahphalke | 1:c863d7e9e272 | 62 | * @brief Convert the ADC raw value into equivalent RTD resistance |
| mahphalke | 1:c863d7e9e272 | 63 | * @param adc_raw[in]- ADC raw sample |
| mahphalke | 1:c863d7e9e272 | 64 | * @return RTD resistance value |
| mahphalke | 1:c863d7e9e272 | 65 | * @note RTD is biased with constant excitation current. Below formula |
| mahphalke | 1:c863d7e9e272 | 66 | * is based on ratiometric measurement, where fixed value of RTD RREF |
| mahphalke | 1:c863d7e9e272 | 67 | * (reference resistor) and gain is taken into account |
| mahphalke | 1:c863d7e9e272 | 68 | */ |
| mahphalke | 1:c863d7e9e272 | 69 | static float convert_adc_raw_into_rtd_resistance(int32_t adc_raw) |
| mahphalke | 1:c863d7e9e272 | 70 | { |
| mahphalke | 1:c863d7e9e272 | 71 | float rtd_res; |
| mahphalke | 1:c863d7e9e272 | 72 | |
| mahphalke | 1:c863d7e9e272 | 73 | /* Below equation is for bipolar inputs as all ADC configurations for |
| mahphalke | 1:c863d7e9e272 | 74 | * sensor measurement are having default bipolar mode */ |
| mahphalke | 1:c863d7e9e272 | 75 | rtd_res = (((float)adc_raw - (1 << (AD7124_ADC_N_BITS - 1))) * |
| mahphalke | 1:c863d7e9e272 | 76 | (calibration_iout_ratio * RTD_RREF)) / (( |
| mahphalke | 1:c863d7e9e272 | 77 | AD7124_PGA_GAIN(RTD_GAIN_VALUE)) * (1 << (AD7124_ADC_N_BITS - 1))); |
| mahphalke | 1:c863d7e9e272 | 78 | |
| mahphalke | 1:c863d7e9e272 | 79 | return rtd_res; |
| mahphalke | 1:c863d7e9e272 | 80 | } |
| mahphalke | 1:c863d7e9e272 | 81 | |
| mahphalke | 1:c863d7e9e272 | 82 | |
| mahphalke | 1:c863d7e9e272 | 83 | /*! |
| mahphalke | 1:c863d7e9e272 | 84 | * @brief Store the RTD calibration Iout ratio for 3-wire RTD calibration |
| mahphalke | 1:c863d7e9e272 | 85 | * based measurement |
| mahphalke | 1:c863d7e9e272 | 86 | * @param iout_ratio[in]- Iout1/Iout0 ratio |
| mahphalke | 1:c863d7e9e272 | 87 | * @param status[in] - Calibration ratio set/reset flag |
| mahphalke | 1:c863d7e9e272 | 88 | * @return none |
| mahphalke | 1:c863d7e9e272 | 89 | */ |
| mahphalke | 1:c863d7e9e272 | 90 | void store_rtd_calibrated_iout_ratio(float iout_ratio, bool status) |
| mahphalke | 1:c863d7e9e272 | 91 | { |
| mahphalke | 1:c863d7e9e272 | 92 | if (status) { |
| mahphalke | 1:c863d7e9e272 | 93 | calibration_iout_ratio = 1 + iout_ratio; |
| mahphalke | 1:c863d7e9e272 | 94 | } else { |
| mahphalke | 1:c863d7e9e272 | 95 | calibration_iout_ratio = 1; |
| mahphalke | 1:c863d7e9e272 | 96 | } |
| mahphalke | 1:c863d7e9e272 | 97 | } |
| mahphalke | 1:c863d7e9e272 | 98 | |
| mahphalke | 1:c863d7e9e272 | 99 | |
| mahphalke | 1:c863d7e9e272 | 100 | /*! |
| mahphalke | 1:c863d7e9e272 | 101 | * @brief Convert the ADC raw value into equivalent PTC thermistor resistance |
| mahphalke | 1:c863d7e9e272 | 102 | * @param adc_raw[in]- ADC raw sample |
| mahphalke | 1:c863d7e9e272 | 103 | * @return PTC resistance value |
| mahphalke | 1:c863d7e9e272 | 104 | * @note PTC is biased with constant excitation current. Below formula |
| mahphalke | 1:c863d7e9e272 | 105 | * is based on ratiometric measurement, where fixed value of PTC RREF |
| mahphalke | 1:c863d7e9e272 | 106 | * (reference resistor) and gain is taken into account |
| mahphalke | 1:c863d7e9e272 | 107 | */ |
| mahphalke | 1:c863d7e9e272 | 108 | static float convert_adc_raw_into_ptc_resistance(int32_t adc_raw) |
| mahphalke | 1:c863d7e9e272 | 109 | { |
| mahphalke | 1:c863d7e9e272 | 110 | float ptc_res; |
| mahphalke | 1:c863d7e9e272 | 111 | |
| mahphalke | 1:c863d7e9e272 | 112 | /* Below equation is for bipolar inputs as all ADC configurations for |
| mahphalke | 1:c863d7e9e272 | 113 | * sensor measurement are having default bipolar mode */ |
| mahphalke | 1:c863d7e9e272 | 114 | ptc_res = (((float)adc_raw - (1 << (AD7124_ADC_N_BITS - 1))) * PTC_RREF) / (( |
| mahphalke | 1:c863d7e9e272 | 115 | AD7124_PGA_GAIN(THERMISTOR_GAIN_VALUE)) * (1 << (AD7124_ADC_N_BITS - 1))); |
| mahphalke | 1:c863d7e9e272 | 116 | |
| mahphalke | 1:c863d7e9e272 | 117 | return ptc_res; |
| mahphalke | 1:c863d7e9e272 | 118 | } |
| mahphalke | 1:c863d7e9e272 | 119 | |
| mahphalke | 1:c863d7e9e272 | 120 | |
| mahphalke | 1:c863d7e9e272 | 121 | /*! |
| mahphalke | 1:c863d7e9e272 | 122 | * @brief Convert the ADC raw value into equivalent NTC thermistor voltage |
| mahphalke | 1:c863d7e9e272 | 123 | * @param adc_raw[in]- ADC raw sample |
| mahphalke | 1:c863d7e9e272 | 124 | * @return NTC Thermistor voltage value |
| mahphalke | 1:c863d7e9e272 | 125 | * @note The NTC is biased with constant ADC reference voltage. Below formula |
| mahphalke | 1:c863d7e9e272 | 126 | * is based on ratiometric measurement, where fixed value of ADC REF |
| mahphalke | 1:c863d7e9e272 | 127 | * and gain is taken into account |
| mahphalke | 1:c863d7e9e272 | 128 | */ |
| mahphalke | 1:c863d7e9e272 | 129 | static float convert_adc_raw_into_ntc_voltage(int32_t adc_raw) |
| mahphalke | 1:c863d7e9e272 | 130 | { |
| mahphalke | 1:c863d7e9e272 | 131 | float ntc_voltage; |
| mahphalke | 1:c863d7e9e272 | 132 | |
| mahphalke | 1:c863d7e9e272 | 133 | /* Below equation is for bipolar inputs as all ADC configurations for |
| mahphalke | 1:c863d7e9e272 | 134 | * sensor measurement are having default bipolar mode */ |
| mahphalke | 1:c863d7e9e272 | 135 | ntc_voltage = (((float)adc_raw - (1 << (AD7124_ADC_N_BITS - 1))) * |
| mahphalke | 1:c863d7e9e272 | 136 | AD7124_REF_VOLTAGE) / (( |
| mahphalke | 1:c863d7e9e272 | 137 | AD7124_PGA_GAIN(THERMISTOR_GAIN_VALUE)) * (1 << (AD7124_ADC_N_BITS - 1))); |
| mahphalke | 1:c863d7e9e272 | 138 | |
| mahphalke | 1:c863d7e9e272 | 139 | return ntc_voltage; |
| mahphalke | 1:c863d7e9e272 | 140 | } |
| mahphalke | 1:c863d7e9e272 | 141 | |
| mahphalke | 1:c863d7e9e272 | 142 | |
| mahphalke | 1:c863d7e9e272 | 143 | /*! |
| mahphalke | 1:c863d7e9e272 | 144 | * @brief Convert the NTC thermistor voltage into equivalent resistance |
| mahphalke | 1:c863d7e9e272 | 145 | * @param voltage[in]- NTC Thermistor voltage |
| mahphalke | 1:c863d7e9e272 | 146 | * @return NTC Thermistor resistance value |
| mahphalke | 1:c863d7e9e272 | 147 | */ |
| mahphalke | 1:c863d7e9e272 | 148 | static float convert_ntc_voltage_into_resistance(float ntc_voltage) |
| mahphalke | 1:c863d7e9e272 | 149 | { |
| mahphalke | 1:c863d7e9e272 | 150 | float ntc_resistance = (ntc_voltage * NTC_RSENSE) / (AD7124_REF_VOLTAGE - |
| mahphalke | 1:c863d7e9e272 | 151 | ntc_voltage); |
| mahphalke | 1:c863d7e9e272 | 152 | return ntc_resistance; |
| mahphalke | 1:c863d7e9e272 | 153 | } |
| mahphalke | 1:c863d7e9e272 | 154 | |
| mahphalke | 1:c863d7e9e272 | 155 | |
| mahphalke | 1:c863d7e9e272 | 156 | /** |
| mahphalke | 1:c863d7e9e272 | 157 | * @brief Converts raw ADC code to millivolts |
| mahphalke | 1:c863d7e9e272 | 158 | * @param raw_adc_code[in] Raw ADC code |
| mahphalke | 1:c863d7e9e272 | 159 | * @return voltage in millivolts |
| mahphalke | 1:c863d7e9e272 | 160 | * @details This converts the raw ADC code to millivolts for thermocouple channel, |
| mahphalke | 1:c863d7e9e272 | 161 | * based on the AD7124 Eval board configuration |
| mahphalke | 1:c863d7e9e272 | 162 | */ |
| mahphalke | 1:c863d7e9e272 | 163 | static float convert_raw_adc_into_tc_mv(uint32_t raw_adc_code) |
| mahphalke | 1:c863d7e9e272 | 164 | { |
| mahphalke | 1:c863d7e9e272 | 165 | return (((((float)raw_adc_code - (1 << (AD7124_ADC_N_BITS - 1))) / |
| mahphalke | 1:c863d7e9e272 | 166 | (AD7124_PGA_GAIN(THERMOCOUPLE_GAIN_VALUE) * |
| mahphalke | 1:c863d7e9e272 | 167 | (1 << (AD7124_ADC_N_BITS - 1)))) * AD7124_REF_VOLTAGE) * 1000); |
| mahphalke | 1:c863d7e9e272 | 168 | } |
| mahphalke | 1:c863d7e9e272 | 169 | |
| mahphalke | 1:c863d7e9e272 | 170 | |
| mahphalke | 1:c863d7e9e272 | 171 | /** |
| mahphalke | 1:c863d7e9e272 | 172 | * @brief Convert ADC raw value into TC temperature |
| mahphalke | 1:c863d7e9e272 | 173 | * @param tc_sample[in] Raw TC sample |
| mahphalke | 1:c863d7e9e272 | 174 | * @param cjc_sample[in] Raw CJC sample |
| mahphalke | 1:c863d7e9e272 | 175 | * @param cjc_sensor[in] CJC sensor type |
| mahphalke | 1:c863d7e9e272 | 176 | * @return TC temperature |
| mahphalke | 1:c863d7e9e272 | 177 | */ |
| mahphalke | 1:c863d7e9e272 | 178 | float get_tc_temperature(float tc_sample, float cjc_sample, |
| mahphalke | 1:c863d7e9e272 | 179 | cjc_sensor_type cjc_sensor) |
| mahphalke | 1:c863d7e9e272 | 180 | { |
| mahphalke | 1:c863d7e9e272 | 181 | Thermocouple_Type_T tcSensor; |
| mahphalke | 1:c863d7e9e272 | 182 | float tc_mv; |
| mahphalke | 1:c863d7e9e272 | 183 | float tc_temperature; |
| mahphalke | 1:c863d7e9e272 | 184 | float cjc_temperature; |
| mahphalke | 1:c863d7e9e272 | 185 | |
| mahphalke | 1:c863d7e9e272 | 186 | tc_mv = convert_raw_adc_into_tc_mv(tc_sample); |
| mahphalke | 1:c863d7e9e272 | 187 | tc_temperature = tcSensor.convert(tc_mv); |
| mahphalke | 1:c863d7e9e272 | 188 | |
| mahphalke | 1:c863d7e9e272 | 189 | if (cjc_sensor == PT100_4WIRE_RTD) { |
| mahphalke | 1:c863d7e9e272 | 190 | cjc_temperature = get_rtd_temperature(cjc_sample); |
| mahphalke | 1:c863d7e9e272 | 191 | } else if (cjc_sensor == THERMISTOR_PTC_KY81_110) { |
| mahphalke | 1:c863d7e9e272 | 192 | cjc_temperature = get_ptc_thermistor_temperature(cjc_sample); |
| mahphalke | 1:c863d7e9e272 | 193 | } else if (cjc_sensor == PT1000_4WIRE_RTD) { |
| mahphalke | 1:c863d7e9e272 | 194 | PT1000 rtd_sensor; |
| mahphalke | 1:c863d7e9e272 | 195 | float rtd_resistance; |
| mahphalke | 1:c863d7e9e272 | 196 | |
| mahphalke | 1:c863d7e9e272 | 197 | rtd_resistance = convert_adc_raw_into_rtd_resistance(cjc_sample); |
| mahphalke | 1:c863d7e9e272 | 198 | cjc_temperature = rtd_sensor.convertResistanceToTemperature(rtd_resistance); |
| mahphalke | 1:c863d7e9e272 | 199 | } else { |
| mahphalke | 1:c863d7e9e272 | 200 | return 0; |
| mahphalke | 1:c863d7e9e272 | 201 | } |
| mahphalke | 1:c863d7e9e272 | 202 | |
| mahphalke | 1:c863d7e9e272 | 203 | /* NOTE The simplest approach of adding the CJC temperature to TC temperature is taken here. |
| mahphalke | 1:c863d7e9e272 | 204 | * A better method is to convert RTD back to thermocouple mV, and add that to TC value |
| mahphalke | 1:c863d7e9e272 | 205 | * then do the thermocouple to degC conversion. |
| mahphalke | 1:c863d7e9e272 | 206 | * */ |
| mahphalke | 1:c863d7e9e272 | 207 | return (tc_temperature + cjc_temperature); |
| mahphalke | 1:c863d7e9e272 | 208 | } |
| mahphalke | 1:c863d7e9e272 | 209 | |
| mahphalke | 1:c863d7e9e272 | 210 | |
| mahphalke | 1:c863d7e9e272 | 211 | /** |
| mahphalke | 1:c863d7e9e272 | 212 | * @brief Convert ADC raw value into RTD temperature |
| mahphalke | 1:c863d7e9e272 | 213 | * @param rtd_sample[in] Raw RTD sample |
| mahphalke | 1:c863d7e9e272 | 214 | * @return RTD temperature |
| mahphalke | 1:c863d7e9e272 | 215 | * @note Fixed PT100 RTD sensor is used |
| mahphalke | 1:c863d7e9e272 | 216 | */ |
| mahphalke | 1:c863d7e9e272 | 217 | float get_rtd_temperature(int32_t rtd_sample) |
| mahphalke | 1:c863d7e9e272 | 218 | { |
| mahphalke | 1:c863d7e9e272 | 219 | PT100 rtd_sensor; |
| mahphalke | 1:c863d7e9e272 | 220 | float rtd_resistance; |
| mahphalke | 1:c863d7e9e272 | 221 | |
| mahphalke | 1:c863d7e9e272 | 222 | rtd_resistance = convert_adc_raw_into_rtd_resistance(rtd_sample); |
| mahphalke | 1:c863d7e9e272 | 223 | |
| mahphalke | 1:c863d7e9e272 | 224 | return rtd_sensor.convertResistanceToTemperature(rtd_resistance); |
| mahphalke | 1:c863d7e9e272 | 225 | } |
| mahphalke | 1:c863d7e9e272 | 226 | |
| mahphalke | 1:c863d7e9e272 | 227 | |
| mahphalke | 1:c863d7e9e272 | 228 | /** |
| mahphalke | 1:c863d7e9e272 | 229 | * @brief Convert ADC raw value into NTC temperature |
| mahphalke | 1:c863d7e9e272 | 230 | * @param ntc_sample[in] Raw NTC sample |
| mahphalke | 1:c863d7e9e272 | 231 | * @return NTC temperature |
| mahphalke | 1:c863d7e9e272 | 232 | * @note Fixed NTC 10K 44031RC sensor is used |
| mahphalke | 1:c863d7e9e272 | 233 | */ |
| mahphalke | 1:c863d7e9e272 | 234 | float get_ntc_thermistor_temperature(int32_t ntc_sample) |
| mahphalke | 1:c863d7e9e272 | 235 | { |
| mahphalke | 1:c863d7e9e272 | 236 | ntc_10k_44031rc ntc_thermistor; |
| mahphalke | 1:c863d7e9e272 | 237 | float ntc_voltage; |
| mahphalke | 1:c863d7e9e272 | 238 | float ntc_resistance; |
| mahphalke | 1:c863d7e9e272 | 239 | |
| mahphalke | 1:c863d7e9e272 | 240 | ntc_voltage = convert_adc_raw_into_ntc_voltage(ntc_sample); |
| mahphalke | 1:c863d7e9e272 | 241 | ntc_resistance = convert_ntc_voltage_into_resistance(ntc_voltage); |
| mahphalke | 1:c863d7e9e272 | 242 | |
| mahphalke | 1:c863d7e9e272 | 243 | return ntc_thermistor.convert(ntc_resistance); |
| mahphalke | 1:c863d7e9e272 | 244 | } |
| mahphalke | 1:c863d7e9e272 | 245 | |
| mahphalke | 1:c863d7e9e272 | 246 | |
| mahphalke | 1:c863d7e9e272 | 247 | /** |
| mahphalke | 1:c863d7e9e272 | 248 | * @brief Convert ADC raw value into PTC temperature |
| mahphalke | 1:c863d7e9e272 | 249 | * @param ptc_sample[in] Raw PTC sample |
| mahphalke | 1:c863d7e9e272 | 250 | * @return PTC temperature |
| mahphalke | 1:c863d7e9e272 | 251 | * @note Fixed PTC KY81/110 Thermistor sensor is used |
| mahphalke | 1:c863d7e9e272 | 252 | */ |
| mahphalke | 1:c863d7e9e272 | 253 | float get_ptc_thermistor_temperature(int32_t ptc_sample) |
| mahphalke | 1:c863d7e9e272 | 254 | { |
| mahphalke | 1:c863d7e9e272 | 255 | ptc_ky81_110 ptc_thermistor; |
| mahphalke | 1:c863d7e9e272 | 256 | float ptc_resistance; |
| mahphalke | 1:c863d7e9e272 | 257 | |
| mahphalke | 1:c863d7e9e272 | 258 | ptc_resistance = convert_adc_raw_into_ptc_resistance(ptc_sample); |
| mahphalke | 1:c863d7e9e272 | 259 | |
| mahphalke | 1:c863d7e9e272 | 260 | return ptc_thermistor.convert(ptc_resistance); |
| mahphalke | 1:c863d7e9e272 | 261 | } |
| mahphalke | 1:c863d7e9e272 | 262 |