checkpoint
[slipway.git] / src / edu / berkeley / slipway / FtdiBoard.java
index 885aa11..a2a2123 100644 (file)
@@ -10,7 +10,7 @@ import gnu.io.*;
 public class FtdiBoard extends Board {
 
     static {
-        System.load(new File("build/"+System.mapLibraryName("Ftdi")).getAbsolutePath());
+        System.load(new File("build/"+System.mapLibraryName("FtdiUartNative")).getAbsolutePath());
     }
 
     private final ChipImpl chip;
@@ -22,14 +22,17 @@ public class FtdiBoard extends Board {
 
     public FtdiBoard() throws Exception {
         chip = new ChipImpl();
-        boot(new InputStreamReader(new FileInputStream("bitstreams/usbdrone.bst")));
+        String bstFile = this.getClass().getName();
+        bstFile = bstFile.substring(0, bstFile.lastIndexOf('.'));
+        bstFile = bstFile.replace('.', '/')+"/slipway_drone.bst";
+        boot(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(bstFile)));
         in = chip.getInputStream();
         out = chip.getOutputStream();
         for(int i=0; i<255; i++) out.write(0);
         out.flush();
     }
 
-    public void reset() {
+    public void reset() throws IOException {
         chip.doReset();
     }
 
@@ -135,7 +138,7 @@ public class FtdiBoard extends Board {
 
         //System.out.println("avr reset => true");
         chip.purge();
-        chip.uart(1<<1, 1<<1);
+        chip.uart_and_cbus_mode(1<<1, 1<<1);
         
         //d.avrrst(true);
         //try { Thread.sleep(500); } catch (Exception e) { }