diff 1wire.c @ 14:d8002c716678

- Actually wait after reading like the spec says. - Add debug item to show a device was found in the search. - Re-enable test for broken bus.
author Daniel O'Connor <darius@dons.net.au>
date Wed, 08 Feb 2012 10:35:13 +1030
parents 6f8f7b87d2f1
children 0876867347de
line wrap: on
line diff
--- a/1wire.c	Tue Feb 07 13:53:21 2012 +1030
+++ b/1wire.c	Wed Feb 08 10:35:13 2012 +1030
@@ -69,15 +69,19 @@
  */
 uint8_t
 OWTouchReset(void) {
+    uint8_t	i;
+    
     OWDELAY_G;
 
     /* Check the bus isn't being held low (ie it's broken) Do it after
      * the delay so we guarantee we don't see a slave from a previous
      * comms attempt
      */
+#if 1
     OWSETREAD();
     if(OWREADBUS() == 0)
 	return 2;
+#endif
 
     OWSETBUSLOW();
     OWDELAY_H;
@@ -85,7 +89,10 @@
     OWDELAY_I;
 
     OWSETREAD();
-    return(OWREADBUS());
+    i = OWREADBUS();
+
+    OWDELAY_J;
+    return(i);
 }
 
 /*-----------------------------------------------------------------------------
@@ -113,6 +120,8 @@
  */
 uint8_t
 OWReadBit(void) {
+    uint8_t	i;
+    
     OWDELAY_I;
     
     OWSETBUSLOW();
@@ -120,7 +129,9 @@
     OWSETBUSHIGH();
     OWDELAY_E;
     OWSETREAD();
-    return(OWREADBUS());
+    i = OWREADBUS();
+    OWDELAY_F;
+    return(i);
 }
 
 /*-----------------------------------------------------------------------------
@@ -254,6 +265,7 @@
 	    OWPUTSP(PSTR("Resetting\r\n"));
 	    switch (OWTouchReset()) {
 		case 0:
+		    OWPUTSP(PSTR("Found device(s)\r\n"));
 		    break;
 		    
 		case 1: