checkpoint
authoradam <adam@megacz.com>
Mon, 11 Sep 2006 13:13:53 +0000 (14:13 +0100)
committeradam <adam@megacz.com>
Mon, 11 Sep 2006 13:13:53 +0000 (14:13 +0100)
src/edu/berkeley/obits/device/atmel/ChipImpl.java
src/edu/berkeley/obits/device/atmel/FtdiBoard.java
src/edu/berkeley/obits/device/atmel/FtdiChip.java

index 9e7cd7f..677bf5f 100644 (file)
@@ -53,7 +53,7 @@ public class ChipImpl extends FtdiChip implements Chip {
         }
     }
 
-    protected static int dmask =
+    protected int dmask =
         //(1<<0) |
         (1<<1) |
         (1<<2) |
@@ -68,10 +68,10 @@ public class ChipImpl extends FtdiChip implements Chip {
         uart();
     }
     public void avrrst(boolean on) { dbang(7, on); }
-    public boolean initErr()       { return (readPins() & (1<<4))!=0; }
     public void clk(boolean on)    { dbang(6, on); }
     public void data(boolean on)   { dbang(5, on); }
 
+    public boolean initErr()       { return (readPins() & (1<<4))!=0; }
     public boolean con() {
         dmask &= ~(1<<0);
         dbangmode(dmask);
@@ -82,5 +82,4 @@ public class ChipImpl extends FtdiChip implements Chip {
         dbangmode(dmask);
         dbang(0, on);
     }
-
 }
index dcf4981..43cbf10 100644 (file)
@@ -24,10 +24,9 @@ public class FtdiBoard extends Board {
         chip.porte(4, true);
 
         boot(new InputStreamReader(new FileInputStream("bitstreams/usbdrone.bst")));
-        System.out.println("       pins: " + pad(Integer.toString(chip.readPins()&0xff,2),8));
 
-        in = new BufferedInputStream(chip.getInputStream());
-        out = new BufferedOutputStream(chip.getOutputStream());
+        in = chip.getInputStream();
+        out = chip.getOutputStream();
         for(int i=0; i<255; i++) out.write(0);
         out.flush();
     }
@@ -105,7 +104,6 @@ public class FtdiBoard extends Board {
             if (!d.initErr())
                 throw new RuntimeException("initialization failed at " + bytes);
             try { Thread.sleep(20); } catch (Exception e) { }
-            System.out.print("cts="+""+"  pins=" + pad(Integer.toString(d.readPins()&0xff,2),8)+"      \r");
             d.config(0,1);
         }
 
index 828c1a2..18b4087 100644 (file)
@@ -95,7 +95,7 @@ public class FtdiChip {
             }
         };
 
-    private final OutputStream out = new OutputStream() {
+    private final OutputStream out = new BufferedOutputStream(new OutputStream() {
             public void write(int b) throws IOException {
                 byte[] d = new byte[1];
                 d[0] = (byte)b;
@@ -113,5 +113,5 @@ public class FtdiChip {
                     len -= result;
                 }
             }
-        };
+        });
 }