static {
try {
jarFileTime = new File("fleet.jar").lastModified();
- bitFileTime = new File("build/fpga/main.bit").lastModified();
+ bitFileTime = new File("./main.bit").lastModified();
} catch (Exception e) { throw new RuntimeException(e); }
}
public static void main(String[] args) throws Exception {
System.err.println("programming...");
Process proc = Runtime.getRuntime().exec(new String[] {
- "misc/program.sh",
- "build/fpga/main.bit"
+ "./misc/program.sh",
+ "./main.bit"
});
BufferedReader br = new BufferedReader(new InputStreamReader(proc.getInputStream()));
String str = null;
System.err.println("jarfile modified; exiting...");
System.exit(0);
}
- if (bitFileTime != new File("build/fpga/main.bit").lastModified()) {
+ if (bitFileTime != new File("./main.bit").lastModified()) {
System.err.println("bitfile modified; exiting...");
System.exit(0);
}
synchronized(Server.class) {
System.err.println(" (got it)");
try {
- this.sp = new RXTXPort("/dev/ttyS0");
+ if (new File("/dev/cu.usbserial-FTCBWI2P").exists())
+ this.sp = new RXTXPort("/dev/cu.usbserial-FTCBWI2P");
+ else
+ this.sp = new RXTXPort("/dev/ttyS0");
sp.setInputBufferSize(0);
sp.setOutputBufferSize(0);
- sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
+ //sp.setSerialPortParams(38400, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
+ sp.setSerialPortParams(115200, SerialPort.DATABITS_8, SerialPort.STOPBITS_1, SerialPort.PARITY_NONE);
//sp.setFlowControlMode(sp.FLOWCONTROL_RTSCTS_IN | sp.FLOWCONTROL_RTSCTS_OUT);
sp.setFlowControlMode(0);
try {
final OutputStream fos = sp.getOutputStream();
final InputStream fis = new BufferedInputStream(sp.getInputStream());
+ sp.sendBreak(100);
+
// read login string
byte[] buf = new byte[1024];
StringBuffer sb = new StringBuffer();