checkpoint
authoradam <adam@megacz.com>
Wed, 20 Sep 2006 08:51:43 +0000 (09:51 +0100)
committeradam <adam@megacz.com>
Wed, 20 Sep 2006 08:51:43 +0000 (09:51 +0100)
src/com/atmel/fpslic/ChipImpl.java
src/com/ftdi/usb/FtdiUart.java

index 66557fa..f43ae48 100644 (file)
@@ -15,10 +15,16 @@ public class ChipImpl extends FtdiUart implements Chip {
         (1<<7);
 
     public ChipImpl() {
-        super(0x6666, 0x3133);
+        super(0x6666, 0x3133, 1500 * 1000);
         doReset();
     }
 
+    public void flush() {
+        try {
+            getOutputStream().flush();
+        } catch (Exception e) { throw new RuntimeException(e); }
+    }
+
     public void doReset() {
 
         dmask =
index 51007f5..9e7819c 100644 (file)
@@ -3,16 +3,16 @@ import java.io.*;
 
 public class FtdiUart {
 
-    protected SWIGTYPE_p_ftdi_context context = example.new_ftdi_context();
+    private SWIGTYPE_p_ftdi_context context = example.new_ftdi_context();
 
     public OutputStream getOutputStream() { return out; }
     public InputStream  getInputStream() { return in; }
 
-    public FtdiUart(int vendor, int product) {
+    public FtdiUart(int vendor, int product, int baud) {
         example.ftdi_init(context);
         example.ftdi_usb_open(context, vendor, product);
         example.ftdi_usb_reset(context);
-        example.ftdi_set_baudrate(context, 1500 * 1000);
+        example.ftdi_set_baudrate(context, baud);
         example.ftdi_set_line_property(context, 8, 0, 0);
         purge();
     }
@@ -24,12 +24,6 @@ public class FtdiUart {
         return b[0];
     }
 
-    public void flush() {
-        try {
-            getOutputStream().flush();
-        } catch (Exception e) { throw new RuntimeException(e); }
-    }
-
     public synchronized void purge() {
         example.ftdi_usb_purge_buffers(context);
     }