Fork of DS1820 that can function with the data and parasite power pin being the same.

Dependents:   AutonomousDAQ AutonomousDAQ

Fork of DS1820 by David Pairman

Revision:
5:00539fbc6d79
Parent:
4:29264b0a2c9f
Child:
7:aceafdd78b28
--- a/DS1820.cpp	Wed Aug 07 11:02:10 2013 +0000
+++ b/DS1820.cpp	Mon Sep 22 00:21:07 2014 +0000
@@ -269,6 +269,7 @@
     }
     onewire_byte_out( 0x44);  // perform temperature conversion
     if (_parasite_power) {
+        _parasitepin.output();
         _parasitepin = 1;     // Parasite power strong pullup
         wait_ms(delay_time);
         _parasitepin = 0;
@@ -334,11 +335,15 @@
     else
         match_ROM();
     onewire_byte_out(0x48);   // Write scratchpad into E2 command
-    if (_parasite_power)
+    if (_parasite_power) {
+        _parasitepin.output();
         _parasitepin=1;
+    }
     wait_ms(10);            // Parasite power strong pullup for 10ms
-    if (_parasite_power)
+    if (_parasite_power) {
+        _parasitepin.output();
         _parasitepin=0;
+    }
 }
  
 int DS1820::recall_scratchpad(devices device) {