63 #define BETA_KELVIN (273.15f)
77 #if BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true
78 #define BETA_ADC_VOLTAGE_V_MAX_V \
79 (float)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(1400)) / (BETA_ResistanceFromTemperature(1400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
80 #define BETA_ADC_VOLTAGE_V_MIN_V \
81 (float)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(-400)) / (BETA_ResistanceFromTemperature(-400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm))
83 #define BETA_ADC_VOLTAGE_V_MIN_V \
84 ((float)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(1400)) / (BETA_ResistanceFromTemperature(1400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
85 #define BETA_ADC_VOLTAGE_V_MAX_V \
86 ((float)((BETA_RESISTOR_DIVIDER_SUPPLY_VOLTAGE_V * BETA_ResistanceFromTemperature(-400)) / (BETA_ResistanceFromTemperature(-400) + BETA_RESISTOR_DIVIDER_RESISTANCE_R_1_R_2_Ohm)))
97 int16_t temperature_ddegC = 0;
98 float resistance_Ohm = 0.0f;
99 float adcVoltage_V = (float)adcVoltage_mV / 1000.0f;
104 temperature_ddegC = INT16_MIN;
107 temperature_ddegC = INT16_MAX;
110 #if BETA_POSITION_IN_RESISTOR_DIVIDER_IS_R_1 == true
124 return temperature_ddegC;
128 int16_t temperature_ddegC = 0;
129 if (resistance_Ohm > 0.0f) {
133 temperature_ddegC = (int16_t)(10.0f * temperature_degC);
136 temperature_ddegC = INT16_MIN;
138 return temperature_ddegC;
142 float resistance_Ohm = 0.0f;
146 return resistance_Ohm;
int16_t BETA_TemperatureFromResistance(float resistance_Ohm)
returns temperature corresponding to NTC resistance
float BETA_ResistanceFromTemperature(int16_t temperature_ddegC)
returns NTC resistance corresponding to temperature, used to compute Vmin and Vmax of the divider
#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