DS18B20 library

Dependencies:   LinkedList

Fork of DS1820 by Erik -

Files at this revision

API Documentation at this revision

Comitter:
Sissors
Date:
Tue Apr 08 09:59:18 2014 +0000
Parent:
6:abfdd851218a
Child:
8:d87e11e8d012
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');