C code and C++ library, driver software for the low-power small WLP package MAX31875 temperature sensor. Code supports one-shot, shut-down/standby, hysteresis, alarm limits.

Dependents:   MAX31875_Temperature_Sensor_Small_WLP Click-Sensor-MAX31875 NuMaker-mbed-Sensor-MAX31875

Files at this revision

API Documentation at this revision

Comitter:
phonemacro
Date:
Wed Feb 13 22:17:06 2019 +0000
Parent:
5:228e67722322
Commit message:
correct initialization in write_trip_low, high.

Changed in this revision

max31875_c.cpp Show annotated file Show diff for this revision Revisions of this file
max31875_cpp.cpp Show annotated file Show diff for this revision Revisions of this file
max31875_cpp.h Show annotated file Show diff for this revision Revisions of this file
diff -r 228e67722322 -r 61f3693edd6c max31875_c.cpp
--- a/max31875_c.cpp	Wed Feb 13 08:15:29 2019 +0000
+++ b/max31875_c.cpp	Wed Feb 13 22:17:06 2019 +0000
@@ -155,6 +155,7 @@
 int max31875_write_trip_low(float temperature, I2C &i2c_bus)
 {
     max31875_raw_data raw;
+    raw.uwrd = 0;
     if (temperature < 0) {
         raw.sign_bit = 1;
         temperature = -temperature;
@@ -163,7 +164,7 @@
         temperature /= MAX31875_CF_EXTENDED_FORMAT;
     else
         temperature /= MAX31875_CF_NORMAL_FORMAT;
-    raw.magnitude_bits= uint16_t(temperature);
+    raw.magnitude_bits = uint16_t(temperature);
     return max31875_write_reg(raw.uwrd, MAX31875_REG_THYST_LOW_TRIP, i2c_bus);
 }
 
@@ -171,6 +172,7 @@
 int max31875_write_trip_high(float temperature, I2C &i2c_bus)
 {
     max31875_raw_data raw;
+    raw.uwrd = 0;
     if (temperature < 0) {
         raw.sign_bit = 1;
         temperature = -temperature;
@@ -179,7 +181,7 @@
         temperature /= MAX31875_CF_EXTENDED_FORMAT;
     else
         temperature /= MAX31875_CF_NORMAL_FORMAT;
-    raw.magnitude_bits= uint16_t(temperature);
+    raw.magnitude_bits = uint16_t(temperature);
     return max31875_write_reg(raw.uwrd, MAX31875_REG_TOS_HIGH_TRIP, i2c_bus);
 }
 
diff -r 228e67722322 -r 61f3693edd6c max31875_cpp.cpp
--- a/max31875_cpp.cpp	Wed Feb 13 08:15:29 2019 +0000
+++ b/max31875_cpp.cpp	Wed Feb 13 22:17:06 2019 +0000
@@ -151,6 +151,7 @@
 int MAX31875::write_trip_low(float temperature)
 {
     max31875_raw_data raw;
+    raw.uwrd = 0;
     if (temperature < 0) {
         raw.sign_bit = 1;
         temperature = -temperature;
@@ -159,7 +160,7 @@
         temperature /= MAX31875_CF_EXTENDED_FORMAT;
     else
         temperature /= MAX31875_CF_NORMAL_FORMAT;
-    raw.magnitude_bits= uint16_t(temperature);
+    raw.magnitude_bits = uint16_t(temperature);
     return write_reg(raw.uwrd, MAX31875_REG_THYST_LOW_TRIP);
 }
 
@@ -167,6 +168,7 @@
 int MAX31875::write_trip_high(float temperature)
 {
     max31875_raw_data raw;
+    raw.uwrd = 0;
     if (temperature < 0) {
         raw.sign_bit = 1;
         temperature = -temperature;
@@ -175,7 +177,7 @@
         temperature /= MAX31875_CF_EXTENDED_FORMAT;
     else
         temperature /= MAX31875_CF_NORMAL_FORMAT;
-    raw.magnitude_bits= uint16_t(temperature);
+    raw.magnitude_bits = uint16_t(temperature);
     return write_reg(raw.uwrd, MAX31875_REG_TOS_HIGH_TRIP);
 }
 
diff -r 228e67722322 -r 61f3693edd6c max31875_cpp.h
--- a/max31875_cpp.h	Wed Feb 13 08:15:29 2019 +0000
+++ b/max31875_cpp.h	Wed Feb 13 22:17:06 2019 +0000
@@ -39,7 +39,7 @@
 
 /**
  * @brief Extremely small low-power temperature sensor.
- * @version 1.0000.0002
+ * @version 1.0000.0003
  *
  * @details The MAX31875 is a small WLP package temperature sensor.
  * It supports high, low triggers stored in EEPROM for hystersis