- protected static int mask =
- (1<<0) |
- (1<<1)// |
- //(1<<2) |
- //(1<<3)
- ;
-
- public synchronized void purge() {
- example.ftdi_usb_purge_buffers(context);
- }
- public synchronized void uart() { uart(mask, bits); }
- public synchronized void uart(int mask, int bits) {
- example.ftdi_set_bitmode(context, (short)((mask << 4) | bits), (short)0x20);
- //example.ftdi_setflowctrl(context, (1 << 8));
- }
- public synchronized void dbangmode(int dmask) {
- example.ftdi_set_bitmode(context, (short)dmask, (short)0x01);
+ /** returns the instantaneous value present on the DBUS pins */
+ public synchronized int readPins() throws IOException {
+ getOutputStream().flush();
+ byte[] b = new byte[1];
+ FtdiUartNative.ftdi_read_pins(context, b);
+ return b[0];