checkpoint
authoradam <adam@megacz.com>
Thu, 21 Sep 2006 14:40:12 +0000 (15:40 +0100)
committeradam <adam@megacz.com>
Thu, 21 Sep 2006 14:40:12 +0000 (15:40 +0100)
src/com/atmel/fpslic/FpslicRawUsb.java
src/com/ftdi/usb/FtdiUart.java

index fd36efd..61b687b 100644 (file)
@@ -35,19 +35,12 @@ public class FpslicRawUsb implements FpslicRaw {
             (1<<5) |
             (1<<6) |
             (1<<7);
             (1<<5) |
             (1<<6) |
             (1<<7);
-        avrrst(false);
-
-        flush();
-        //purge();
-
         ftdiuart.dbus_mode(dmask);
         ftdiuart.dbus_mode(dmask);
-        flush();
 
 
+        avrrst(false);
         clk(false);
         data(false);
         con(false);
         clk(false);
         data(false);
         con(false);
-        flush();
-        //try { Thread.sleep(500); } catch (Exception e) { }
 
         reset(false);
         flush();
 
         reset(false);
         flush();
@@ -165,7 +158,7 @@ public class FpslicRawUsb implements FpslicRaw {
             boolean bit = (dat & (1<<i)) != 0;
             data(bit);
             clk(true);
             boolean bit = (dat & (1<<i)) != 0;
             data(bit);
             clk(true);
-            clk(false);
+            dbits &= ~(1<<6);  // let the clock fall with the next data bit, whenever it goes out
         }
     }
 
         }
     }
 
index 6b398e7..0990079 100644 (file)
@@ -53,6 +53,10 @@ public class FtdiUart {
         FtdiUartNative.ftdi_set_bitmode(context, (short)dbus_mask, (short)0x01);
     }
 
         FtdiUartNative.ftdi_set_bitmode(context, (short)dbus_mask, (short)0x01);
     }
 
+    public synchronized void setBitRate(int bitRate) throws IOException {
+        FtdiUartNative.ftdi_set_baudrate(context, bitRate);
+    }
+
     /** returns the instantaneous value present on the DBUS pins */
     public synchronized int readPins() throws IOException {
         getOutputStream().flush();
     /** returns the instantaneous value present on the DBUS pins */
     public synchronized int readPins() throws IOException {
         getOutputStream().flush();