package edu.berkeley.obits;
-import static edu.berkeley.obits.device.atmel.AtmelDevice.Constants.*;
-import static edu.berkeley.obits.device.atmel.AtmelDevice.Util.*;
+import edu.berkeley.slipway.*;
+import static com.atmel.fpslic.FpslicConstants.*;
+import static com.atmel.fpslic.Fpslic.Util.*;
import edu.berkeley.obits.device.atmel.*;
import edu.berkeley.obits.gui.*;
import java.awt.*;
public static void main(String[] s) throws Exception {
//AvrDrone device = new AvrDrone(detectObitsPort());
//AvrDrone device = new AvrDrone();
- AvrDrone device = Demo.main2();
+ AvrDrone device = new AvrDrone(new FtdiBoard());
At40k at40k = new At40k.At40k10(device);
try {
long begin = System.currentTimeMillis();
- device.readMode4(System.in);
+ device.readMode4(new ProgressInputStream("configuring fabric", System.in, 111740));
long end = System.currentTimeMillis();
Log.info(AtmelSerial.class, "finished in " + ((end-begin)/1000) + "s");
Thread.sleep(1000);
at40k.cell(6,13).yo(false);
at40k.cell(7,12).xi(SE);
- /*
+ for(int i=0; i<24; i++) {
+ at40k.iob_bot(i, true).enableOutput(NORTH);
+ at40k.iob_bot(i, false).enableOutput(NW);
+ at40k.cell(i, 0).xlut(0xff);
+ at40k.cell(i, 0).ylut(0xff);
+ }
+
+ device.flush();
+
Gui vis = new Gui(at40k, device);
Frame fr = new Frame();
fr.addKeyListener(vis);
fr.repaint();
fr.show();
synchronized(AtmelSerial.class) { AtmelSerial.class.wait(); }
- */
+
+
Visualizer v = new Visualizer(at40k, device);
v.show();
v.setSize(1380, 1080);
At40k.Cell cell = at40k.cell(4, 23);
+
Image img = v.createImage(v.getWidth(), v.getHeight());
/*
int x = 1;
cell.xlut(0xff);
cell.ylut(0xff);
drawCell(getGraphics(), selx, sely);
+ drone.flush();
break;
}
case 'i': {
cell.xlut(0x00);
cell.ylut(0x00);
drawCell(getGraphics(), selx, sely);
+ drone.flush();
break;
}
}
g.setColor(BLUE);
g.drawString(v+"="+(y?"1":"0"), left(cell) + 8, top(cell) + 35);
} };
- scan(dev, cell, NONE, true);
- drone.readBus(bc);
- //scan(dev, cell, XLUT, true);
- //boolean x = (drone.readBus() & 0x80) != 0;
- scan(dev, cell, NONE, false);
+ try {
+ scan(dev, cell, NONE, true);
+ drone.readBus(bc);
+ //scan(dev, cell, XLUT, true);
+ //boolean x = (drone.readBus() & 0x80) != 0;
+ scan(dev, cell, NONE, false);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
}
public void mouseMoved(MouseEvent e) {
}
};
scan(dev, cell, NONE, true);
- drone.readBus(bc);
- //scan(dev, cell, YLUT, false);
- cell.v(L3, false);
- dev.cell(x, 15).h(L3, false);
- dev.cell(x, 15).v(L3, false);
+ try {
+ drone.readBus(bc);
+ //scan(dev, cell, YLUT, false);
+ cell.v(L3, false);
+ dev.cell(x, 15).h(L3, false);
+ dev.cell(x, 15).v(L3, false);
+ } catch (IOException ex) {
+ throw new RuntimeException(ex);
+ }
}
}
}