move thermistor calculation to watch utilities

This commit is contained in:
Joey Castillo
2021-11-22 17:31:51 -05:00
parent fb8f4584a5
commit 0ca729eaba
4 changed files with 66 additions and 65 deletions

View File

@@ -38,4 +38,20 @@
*/
const char * watch_utility_get_weekday(watch_date_time date_time);
/** @brief Returns a temperature in degrees Celsius for a given thermistor voltage divider circuit.
* @param value The raw analog reading from the thermistor pin (0-65535)
* @param highside True if the thermistor is connected to VCC and the series resistor is connected
* to GND; false if the thermistor is connected to GND and the series resistor is
* connected to VCC.
* @param b_coefficient From your thermistor's data sheet, the B25/85 coefficient. A typical value
* will be between 2000 and 5000.
* @param nominal_temperature From your thermistor's data sheet, the temperature (in Celsius) at
* which the thermistor's resistance is at its nominal value.
* @param nominal_resistance The thermistor's resistance at the nominal temperature.
* @param series_resistance The value of the other resistor in the voltage divider.
* @note Ported from Adafruit's MIT-licensed CircuitPython thermistor code, (c) 2017 Scott Shawcroft:
* https://github.com/adafruit/Adafruit_CircuitPython_Thermistor/blob/main/adafruit_thermistor.py
*/
float watch_utility_thermistor_temperature(uint16_t value, bool highside, float b_coefficient, float nominal_temperature, float nominal_resistance, float series_resistance);
#endif