+ /**
+ * Switch to uart mode, with read/write access to four CBUS lines.
+ * This function is used to write to the CBUS lines (re-invoke it to change their state).
+ * I think readPins() is used to read from them, but I'm not sure.
+ *
+ * @param cbus_mask a four-bit mask; set bit=1 to write to a CBUS line, bit=0 to read from it
+ * @param cbus_bits a four-bit mask; the bits to assert on the write-enabled CBUS lines
+ */
+ public synchronized void uart_and_cbus_mode(int cbus_mask, int cbus_bits) {
+ example.ftdi_set_bitmode(context, (short)((cbus_mask << 4) | cbus_bits), (short)0x20);
+ }
+
+ /**
+ * Switch to dbus mode; CBUS lines will be released (ie they will float).
+ * Use getInputStream()/getOutputStream() to read/write the eight DBUS lines.
+ *
+ * @param dbus_mask an eight-bit mask; set bit=1 to write to a DBUS line, bit=0 to read from it
+ */
+ public synchronized void dbus_mode(int dbus_mask) {
+ example.ftdi_set_bitmode(context, (short)dbus_mask, (short)0x01);
+ }
+
+ /** returns the instantaneous value present on the DBUS pins */