Logo Search packages:      
Sourcecode: qmk-groundstation version File versions  Download package

void Posix_QextSerialPort::setStopBits ( StopBitsType  stopBits  )  [virtual]

Sets the number of stop bits used by the serial port. Possible values of stopBits are:

		STOP_1      1 stop bit
		STOP_1_5    1.5 stop bits
		STOP_2      2 stop bits
		
Note:
This function is subject to the following restrictions:
2 stop bits cannot be used with 5 data bits.
POSIX does not support 1.5 stop bits.

Implements QextSerialBase.

Definition at line 692 of file posix_qextserialport.cpp.

Referenced by open(), and Posix_QextSerialPort().

{
      LOCK_MUTEX();
      if (Settings.StopBits!=stopBits) {
            if ((Settings.DataBits==DATA_5 && stopBits==STOP_2) || stopBits==STOP_1_5) {}
            else {
                  Settings.StopBits=stopBits;
            }
      }
      if (isOpen()) {
            switch (stopBits) {
                        
                        /*one stop bit*/
                  case STOP_1:
                        Settings.StopBits=stopBits;
                        Posix_CommConfig.c_cflag&=(~CSTOPB);
                        tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
                        break;
                        
                        /*1.5 stop bits*/
                  case STOP_1_5:
                        TTY_WARNING("Posix_QextSerialPort: 1.5 stop bit operation is not supported by POSIX.");
                        break;
                        
                        /*two stop bits*/
                  case STOP_2:
                        if (Settings.DataBits==DATA_5) {
                              TTY_WARNING("Posix_QextSerialPort: 2 stop bits cannot be used with 5 data bits");
                        }
                        else {
                              Settings.StopBits=stopBits;
                              Posix_CommConfig.c_cflag|=CSTOPB;
                              tcsetattr(Posix_File->handle(), TCSAFLUSH, &Posix_CommConfig);
                        }
                        break;
                  }
      }
      UNLOCK_MUTEX();
}


Generated by  Doxygen 1.6.0   Back to index