(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 =
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();
}
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);
}