Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: MAX31875_Temperature_Sensor_Small_WLP Click-Sensor-MAX31875 NuMaker-mbed-Sensor-MAX31875
Revision 6:61f3693edd6c, committed 2019-02-13
- 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
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