Created
December 9, 2014 01:39
-
-
Save jasongao/d19952902c19363d3c16 to your computer and use it in GitHub Desktop.
Edits to FTDISerialDriver.java to set FTDI latency timer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // FTDISerialDriver.java | |
| /** | |
| * Set latency timer. | |
| */ | |
| private static final int SIO_SET_LATENCY_TIMER_REQUEST = 9; | |
| public int setLatencyTimer(int latency) throws IOException { | |
| if (latency < 1 || latency > 255) { | |
| throw new IOException("Latency out of range. Only valid for 1-255"); | |
| } | |
| long value = latency; | |
| int result = mConnection.controlTransfer(FTDI_DEVICE_OUT_REQTYPE, | |
| SIO_SET_LATENCY_TIMER_REQUEST, (int) value, 0, null, 0, USB_WRITE_TIMEOUT_MILLIS); | |
| if (result != 0) { | |
| throw new IOException("Setting latency timer failed: result=" + result); | |
| } | |
| return result; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment