ArduinoAm29F010

Changeset

12:44bf682cef17
2015-01-20 Paul Boddie raw files shortlog changelog graph Changed the completion detection to possibly be more correct. Added serial flush and bad command echoing.
ArduinoAm29F010.cpp (file)
     1.1 --- a/ArduinoAm29F010.cpp	Tue Jan 20 14:52:20 2015 +0100
     1.2 +++ b/ArduinoAm29F010.cpp	Tue Jan 20 19:33:23 2015 +0100
     1.3 @@ -165,16 +165,24 @@
     1.4  {
     1.5      int data, then = millis();
     1.6  
     1.7 +    setDataIn();
     1.8 +    digitalWrite(CE, LOW);
     1.9 +    digitalWrite(OE, LOW);
    1.10 +
    1.11      do
    1.12      {
    1.13          delay(10);
    1.14 -        data = readOp(high, low);
    1.15 +        data = sampleData();
    1.16      } while (
    1.17          ((data & 0x80) != (written & 0x80)) &&
    1.18          ((data & 0x20) == 0) &&
    1.19          (millis() - then < 2000)
    1.20          );
    1.21  
    1.22 +    digitalWrite(OE, HIGH);
    1.23 +    digitalWrite(CE, HIGH);
    1.24 +    setDataOut();
    1.25 +    delay(10);
    1.26      return readOp(high, low) == written;
    1.27  }
    1.28  
    1.29 @@ -299,9 +307,11 @@
    1.30              break;
    1.31  
    1.32              default:
    1.33 -            Serial.println("?");
    1.34 +            Serial.println(inbuffer[0]);
    1.35              break;
    1.36          }
    1.37 +
    1.38 +        Serial.flush();
    1.39      }
    1.40  }
    1.41