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 7:58b61681818f, committed 2014-04-08
- Comitter:
- Sissors
- Date:
- Tue Apr 08 09:59:18 2014 +0000
- Parent:
- 6:abfdd851218a
- Commit message:
- Added define for invalid conversion
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 |
--- a/DS1820.cpp Wed Apr 02 19:10:34 2014 +0000
+++ b/DS1820.cpp Tue Apr 08 09:59:18 2014 +0000
@@ -353,7 +353,7 @@
read_RAM();
if (RAM_checksum_error())
// Indicate we got a CRC error
- answer = -1000.0;
+ answer = invalid_conversion;
else {
reading = (RAM[1] << 8) + RAM[0];
if (reading & 0x8000) { // negative degrees C
--- a/DS1820.h Wed Apr 02 19:10:34 2014 +0000
+++ b/DS1820.h Tue Apr 08 09:59:18 2014 +0000
@@ -54,6 +54,10 @@
enum devices{
this_device, // command applies to only this device
all_devices }; // command applies to all devices
+
+ enum {
+ invalid_conversion = -1000
+ };
/** Create a probe object connected to the specified pins
*
@@ -91,7 +95,7 @@
* probe to read its RAM, do CRC check and convert temperature on the LPC1768.
*
* @param scale, may be either 'c' or 'f'
- * @returns temperature for that scale, or -1000.0 if CRC error detected.
+ * @returns temperature for that scale, or DS1820::invalid_conversion (-1000) if CRC error detected.
*/
float temperature(char scale='c');
