Ejemplo n.º 1
0
        public static void Read(FT_HANDLE handle, byte[] buffer)
        {
            FT_STATUS status = FT_Read(handle, buffer, (uint)buffer.Length, out uint bytesReturned);

            if (status != FT_STATUS.FT_OK || bytesReturned != buffer.Length)
            {
                throw new InvalidOperationException();
            }
        }
Ejemplo n.º 2
0
        public static int BytesToRead(FT_HANDLE handle)
        {
            if (FT_GetStatus(handle, out uint amountInRxQueue, out uint _, out uint _) == FT_STATUS.FT_OK)
            {
                return((int)amountInRxQueue);
            }


            return(0);
        }
Ejemplo n.º 3
0
        public static byte ReadByte(FT_HANDLE handle)
        {
            FT_STATUS status = FT_ReadByte(handle, out byte buffer, 1, out uint bytesReturned);

            if (status != FT_STATUS.FT_OK || bytesReturned != 1)
            {
                throw new InvalidOperationException();
            }


            return(buffer);
        }
Ejemplo n.º 4
0
        public static FT_STATUS Write(FT_HANDLE handle, byte[] buffer)
        {
            FT_STATUS status = FT_Write(handle, buffer, (uint)buffer.Length, out uint bytesWritten);

            if (bytesWritten != buffer.Length)
            {
                return(FT_STATUS.FT_FAILED_TO_WRITE_DEVICE);
            }


            return(status);
        }
Ejemplo n.º 5
0
 public static extern FT_STATUS FT_ReadByte(FT_HANDLE handle, out byte buffer, uint bytesToRead, out uint bytesReturned);
Ejemplo n.º 6
0
 public static extern FT_STATUS FT_Read(FT_HANDLE handle, [Out] byte[] buffer, uint bytesToRead, out uint bytesReturned);
Ejemplo n.º 7
0
 public static extern FT_STATUS FT_GetStatus(FT_HANDLE handle, out uint amountInRxQueue, out uint amountInTxQueue, out uint eventStatus);
Ejemplo n.º 8
0
 public static extern FT_STATUS FT_Purge(FT_HANDLE handle, FT_PURGE mask);
Ejemplo n.º 9
0
 public static extern FT_STATUS FT_Write(FT_HANDLE handle, byte[] buffer, uint bytesToWrite, out uint bytesWritten);
Ejemplo n.º 10
0
 public static extern FT_STATUS FT_SetTimeouts(FT_HANDLE handle, uint readTimeout, uint writeTimeout);
Ejemplo n.º 11
0
 public static extern FT_STATUS FT_SetFlowControl(FT_HANDLE handle, FT_FLOW_CONTROL flowControl, byte xon, byte xoff);
Ejemplo n.º 12
0
 public static extern FT_STATUS FT_SetDataCharacteristics(FT_HANDLE handle, byte wordLength, byte stopBits, byte parity);
Ejemplo n.º 13
0
 public static extern FT_STATUS FT_SetBaudRate(FT_HANDLE handle, uint baudRate);
Ejemplo n.º 14
0
 public static extern FT_STATUS FT_Close(FT_HANDLE handle);
Ejemplo n.º 15
0
 public static extern FT_STATUS FT_Open(int device, out FT_HANDLE handle);