Working versione for L-tek FF1705

Dependents:   DS1820

Files at this revision

API Documentation at this revision

Comitter:
hudakz
Date:
Sun Jan 20 10:10:20 2019 +0000
Parent:
5:45f3eb39b00c
Child:
7:acf3f0ee66d2
Commit message:
Reading data bits improved.

Changed in this revision

OneWire.cpp Show annotated file Show diff for this revision Revisions of this file
OneWire.h Show annotated file Show diff for this revision Revisions of this file
--- a/OneWire.cpp	Sat Jan 07 11:20:08 2017 +0000
+++ b/OneWire.cpp	Sun Jan 20 10:10:20 2019 +0000
@@ -185,10 +185,12 @@
 
     wire.output();
     wire = 0;
-    //wait_us(1);
+    timer.start();
     wire.input();
-    wait_us(5);
+    wait_us(12 - timer.read_us());
     r = wire.read();
+    timer.stop();
+    timer.reset();
     wait_us(54);
     return r;
 }
@@ -451,3 +453,4 @@
     return crc;
 }
 #endif
+
--- a/OneWire.h	Sat Jan 07 11:20:08 2017 +0000
+++ b/OneWire.h	Sun Jan 20 10:10:20 2019 +0000
@@ -28,6 +28,7 @@
 {
   private:
     DigitalInOut    wire;
+    Timer           timer;
 
 #if ONEWIRE_SEARCH
     // global search state