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.
Fork of DS1820 by
Revision 19:cabdd07a57e7, committed 2018-03-24
- Comitter:
- Tejas Kale
- Date:
- Sat Mar 24 04:00:34 2018 +0100
- Parent:
- 18:688dc6dca163
- Commit message:
- Add an isValid function to re-search for sensors that error out.
Changed in this revision
| DS1820.cpp | Show annotated file Show diff for this revision Revisions of this file |
| DS1820.h | Show annotated file Show diff for this revision Revisions of this file |
diff -r 688dc6dca163 -r cabdd07a57e7 DS1820.cpp
--- a/DS1820.cpp Fri Mar 23 23:25:22 2018 +0100
+++ b/DS1820.cpp Sat Mar 24 04:00:34 2018 +0100
@@ -50,11 +50,13 @@
if (!unassignedProbe(&_datapin, _ROM)) {
printf("DS18B20:No unassigned DS1820 found!\r\n");
+ valid = false;
}
else {
_datapin.input();
probes.append(this);
_parasite_power = !read_power_supply();
+ valid = true;
}
}
@@ -427,4 +429,7 @@
return onewire_bit_in(&this->_datapin);
}
+bool DS1820::isValid() {
+ return valid;
+}
diff -r 688dc6dca163 -r cabdd07a57e7 DS1820.h
--- a/DS1820.h Fri Mar 23 23:25:22 2018 +0100
+++ b/DS1820.h Sat Mar 24 04:00:34 2018 +0100
@@ -107,6 +107,8 @@
*/
bool setResolution(unsigned int resolution);
+ bool isValid();
+
private:
bool _parasite_power;
bool _power_mosfet;
@@ -134,6 +136,8 @@
char _ROM[8];
char RAM[9];
+ bool valid = false;
+
static LinkedList<node> probes;
};
