]> git.earman.xyz Git - sensor-watch.git/commitdiff
clean up after detecting thermistor
authorJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 02:06:11 +0000 (22:06 -0400)
committerJoey Castillo <joeycastillo@utexas.edu>
Sun, 18 May 2025 02:06:11 +0000 (22:06 -0400)
watch-library/shared/driver/thermistor_driver.c

index 0b6839e4b9256c109a779171466063dc11489767..1a76d8059c07d9301bf3cb4e05beccd460ed3324 100644 (file)
@@ -68,6 +68,13 @@ bool thermistor_driver_init(void) {
     // value should be >15000 and <55000 and (between -4° and 76° C)
     if (value < 15000 || value > 55000) has_thermistor = false;
 
+    // clean up, disable everything we enabled earlier.
+    watch_disable_adc();
+    HAL_GPIO_TEMPSENSE_off();
+    HAL_GPIO_TEMPSENSE_pmuxdis();
+    HAL_GPIO_TS_ENABLE_write(!THERMISTOR_ENABLE_VALUE);
+    HAL_GPIO_TS_ENABLE_off();
+
     return has_thermistor;
 }