DS1820 library for multiple devices
Dependencies: LinkedList
Dependents: DS1820_HelloWorld FindingTemp ThermalWake ThermalWake2019Code
Fork of DS1820 by
Revision 15:00ec4f27d7f5, committed 2017-03-09
- Comitter:
- JLarkin
- Date:
- Thu Mar 09 04:00:53 2017 +0000
- Parent:
- 14:c591209285e9
- Commit message:
- Add a whoAmI function to get device address
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 c591209285e9 -r 00ec4f27d7f5 DS1820.cpp --- a/DS1820.cpp Sun Jan 08 17:26:21 2017 +0000 +++ b/DS1820.cpp Thu Mar 09 04:00:53 2017 +0000 @@ -466,3 +466,12 @@ } +// Contributed by John M. Larkin (jlarkin@whitworth.edu) +unsigned long long DS1820::whoAmI() { +// This will return the 64 bit address of the connected DS1820 + unsigned long long myName = 0; + for (int i = 0; i<8; i++) { + myName = (myName<<8) | _ROM[i]; + } + return myName; +} \ No newline at end of file
diff -r c591209285e9 -r 00ec4f27d7f5 DS1820.h --- a/DS1820.h Sun Jan 08 17:26:21 2017 +0000 +++ b/DS1820.h Thu Mar 09 04:00:53 2017 +0000 @@ -107,6 +107,16 @@ */ bool setResolution(unsigned int resolution); + + /** This function returns the 64 bit address associated with a + * particular DS18B20. + * + * Contributed by John M. Larkin (jlarkin@whitworth.edu) + * + * @returns unsigned long long + */ + unsigned long long whoAmI(); + private: bool _parasite_power; bool _power_mosfet;