Version of Richard Lane's library, with #define CABLE_EXT_DELAYS to extend reset() settling delays for extension cable

Fork of DS18B20_1wire by Richard Lane

Revision:
2:b07b40825282
Parent:
1:00972ed59ba3
Child:
3:a2306865901f
--- a/DS18B20.h	Fri Jul 05 22:35:43 2013 +0000
+++ b/DS18B20.h	Tue Mar 25 19:01:36 2014 +0000
@@ -4,6 +4,12 @@
 #include "mbed.h"
 #include <stdint.h>
 
+//
+// 25 March,2014 MHey add #define option for larger H,I,J delay values 
+// to allow extra 1-bit bus settling time accommodating 3ft extension  
+// cable with higher parasitic capacitance
+// If extension cable, add #define CABLE_EXT_DELAYS 
+
 /** A DS18B20 Dallas 1-wire digital thermometer interface.
  *
  * Currently supports 9, 10, 11 or 12-bit conversions. Fewer bits
@@ -11,11 +17,17 @@
  * reading back the 8-byte internal ROM. Orignal code copied from
  * DS18B20 C program by Niall Cooling (thanks!) and wrapped in C++
  * class by this library.
+ 
+ * modified H,I,J delay values to allow extra 1-bit bus 
+ * settling time accommodating 3ft extension cable 
+ * (with higher parasitic capacitance)
+ * #define CABLE_EXT_DELAYS // extend reset() settling delays for extension cable
  *
  * @code
  * #include "mbed.h"
  * #include <stdint.h>
  * #include "DS18B20.h"
+ * #define CABLE_EXT_DELAYS //longer reset() settling delays if extension cable
  *
  * Serial pc(USBTX, USBRX);     // serial comms over usb back to console
  * DS18B20 thermom(p16, DS18B20::RES_12_BIT); // Dallas 1-wire
@@ -109,9 +121,15 @@
     unsigned SetResolution(unsigned resolution);
 
 protected:
-
+   // 25 March,2014 MHey modified H,I,J to allow extra settling time with longer cable (capacitance)
     // Timing delay for 1-wire serial standard option
+#ifndef CABLE_EXT_DELAYS
     enum DELAY { A = 6, B = 64, C = 60, D = 10, E = 9, F = 55, G = 0, H = 480, I = 70, J = 410 };
+#endif
+
+#ifdef CABLE_EXT_DELAYS
+       enum DELAY { A = 6, B = 64, C = 60, D = 10, E = 9, F = 55, G = 0, H = 580, I = 90, J = 510 };
+#endif
 
     // Device byte commands over 1-wire serial
     enum COMMANDS { READ_ROM = 0x33, CONVERT = 0x44, READ_SCRATCHPAD = 0xBE,  WRITE_SCRATCHPAD = 0x4E, SKIP_ROM = 0xCC };