131 #if defined(TS_EPCOS_B57251V5103J060_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && \
132 (TS_EPCOS_B57251V5103J060_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
133 #define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MAX_V \
134 ((float_t)((TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_b57251v5103j060Lut[b57251v5103j060LutSize-1].resistance_Ohm) / (ts_b57251v5103j060Lut[b57251v5103j060LutSize-1].resistance_Ohm+TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
135 #define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MIN_V \
136 ((float_t)((TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_b57251v5103j060Lut[0].resistance_Ohm) / (ts_b57251v5103j060Lut[0].resistance_Ohm+TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
138 #define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MIN_V \
139 ((float_t)((TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_b57251v5103j060Lut[b57251v5103j060LutSize-1].resistance_Ohm) / (ts_b57251v5103j060Lut[b57251v5103j060LutSize-1].resistance_Ohm+TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
140 #define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MAX_V \
141 ((float_t)((TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * ts_b57251v5103j060Lut[0].resistance_Ohm) / (ts_b57251v5103j060Lut[0].resistance_Ohm+TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
154 int16_t temperature_ddegC = 0;
155 float_t resistance_Ohm = 0.0f;
156 float_t adcVoltage_V = adcVoltage_mV / 1000.0f;
161 temperature_ddegC = INT16_MIN;
164 temperature_ddegC = INT16_MAX;
167 #if defined(TS_EPCOS_B57251V5103J060_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && \
168 (TS_EPCOS_B57251V5103J060_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
179 uint16_t between_high = 0;
180 uint16_t between_low = 0;
183 between_low = i + 1u;
189 if (!(((between_high == 0u) && (between_low == 0u)) ||
201 return temperature_ddegC;
207 float_t temperature_degC = 0.0f;
208 float_t vadc_V = adcVoltage_mV / 1000.0;
209 float_t vadc2 = vadc_V * vadc_V;
210 float_t vadc3 = vadc2 * vadc_V;
211 float_t vadc4 = vadc3 * vadc_V;
212 float_t vadc5 = vadc4 * vadc_V;
213 float_t vadc6 = vadc5 * vadc_V;
215 temperature_degC = (6.8405f * vadc6) - (74.815f * vadc5) + (317.48f * vadc4) - (669.16f * vadc3) +
216 (740.82f * vadc2) - (444.97f * vadc_V) + 166.48f;
218 return (int16_t)(temperature_degC * 10.0f);
222 #ifdef UNITY_UNIT_TEST
int16_t TS_Epc00GetTemperatureFromPolynomial(uint16_t adcVoltage_mV)
returns temperature based on measured ADC voltage
static uint16_t b57251v5103j060LutSize
#define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MAX_V
Defines for calculating the ADC voltage on the ends of the operating range.
static const TS_TEMPERATURE_SENSOR_LUT_s ts_b57251v5103j060Lut[]
int16_t TS_Epc00GetTemperatureFromLut(uint16_t adcVoltage_mV)
returns temperature based on measured ADC voltage
#define TS_EPCOS_B57251V5103J060_ADC_VOLTAGE_V_MIN_V
Defines for calculating the ADC voltage on the ends of the operating range.
Resistive divider used for measuring temperature.
#define TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm
#define TS_EPCOS_B57251V5103J060_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V
float_t MATH_LinearInterpolation(const float_t x1, const float_t y1, const float_t x2, const float_t y2, const float_t x_interpolate)
Linear inter-/extrapolates a third point according to two given points.
math library for often used math functions