Beispiel #1
0
        public void SetDataCharacteristics(byte dataBits, byte stopBits, FTParity parity)
        {
            if (!(dataBits == 8 || dataBits == 7))
            {
                throw new ArgumentException("Must be 7 or 8", "dataBits");
            }
            if (!(stopBits == 1 || stopBits == 2))
            {
                throw new ArgumentException("Must be 1 or 2", "stopBits");
            }

            // one stop bit is a 0 for the FT api
            if (stopBits == 1)
            {
                stopBits = 0;
            }

            FTStatus status;

            if ((status = Native.FT_SetDataCharacteristics(Handle, dataBits, stopBits, (byte)parity)) != FTStatus.Ok)
            {
                throw new FTException("FT_SetDataCharacteristics", status);
            }
        }
Beispiel #2
0
        public void SetDataCharacteristics(byte dataBits, byte stopBits, FTParity parity)
        {
            if (!(dataBits == 8 || dataBits == 7))
                throw new ArgumentException("Must be 7 or 8", "dataBits");
            if (!(stopBits == 1 || stopBits == 2))
                throw new ArgumentException("Must be 1 or 2", "stopBits");

            // one stop bit is a 0 for the FT api
            if (stopBits == 1)
                stopBits = 0;

            FTStatus status;
            if ((status = Native.FT_SetDataCharacteristics(Handle, dataBits, stopBits, (byte)parity)) != FTStatus.Ok)
                throw new FTException("FT_SetDataCharacteristics", status);
        }