# HG changeset patch # User Daniel O'Connor # Date 1328659513 -37800 # Node ID d8002c716678d8faa390c8fb1bff27ecaa73bdcb # Parent 6f8f7b87d2f1f5c9d99ddebd5694be22f8b84a64 - 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. diff -r 6f8f7b87d2f1 -r d8002c716678 1wire.c --- 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: