67 #define BETA_KELVIN (273.15f)
81 #if defined(BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && (BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
82 #define BETA_ADC_VOLTAGE_V_MAX_V \
84 (BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(1400)) / \
85 (BETA_ResistanceFromTemperature(1400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
86 #define BETA_ADC_VOLTAGE_V_MIN_V \
88 (BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(-400)) / \
89 (BETA_ResistanceFromTemperature(-400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
91 #define BETA_ADC_VOLTAGE_V_MIN_V \
92 ((float_t)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(1400)) / (BETA_ResistanceFromTemperature(1400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
93 #define BETA_ADC_VOLTAGE_V_MAX_V \
94 ((float_t)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(-400)) / (BETA_ResistanceFromTemperature(-400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
105 int16_t temperature_ddegC = 0;
106 float_t resistance_Ohm = 0.0f;
107 float_t adcVoltage_V = (float_t)adcVoltage_mV / 1000.0f;
112 temperature_ddegC = INT16_MIN;
115 temperature_ddegC = INT16_MAX;
118 #if defined(BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1) && (BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true)
132 return temperature_ddegC;
136 int16_t temperature_ddegC = 0;
137 if (resistance_Ohm > 0.0f) {
141 temperature_ddegC = (int16_t)(10.0f * temperature_degC);
144 temperature_ddegC = INT16_MIN;
146 return temperature_ddegC;
150 float_t resistance_Ohm = 0.0f;
154 return resistance_Ohm;
158 #ifdef UNITY_UNIT_TEST
float_t BETA_ResistanceFromTemperature(int16_t temperature_ddegC)
returns NTC resistance corresponding to temperature, used to compute Vmin and Vmax of the divider
int16_t BETA_TemperatureFromResistance(float_t resistance_Ohm)
returns temperature corresponding to NTC resistance
#define BETA_ADC_VOLTAGE_V_MAX_V
int16_t BETA_GetTemperatureFromBeta(uint16_t adcVoltage_mV)
returns temperature based on measured ADC voltage
#define BETA_ADC_VOLTAGE_V_MIN_V
Resistive divider used for measuring temperature.
#define BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm
#define BETA_BETACOEFFICIENT
#define BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V
math library for often used math functions