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

void Win_QextSerialPort::setParity ( ParityType  parity  )  [virtual]

Sets the parity associated with the serial port. The possible values of parity are:

		PAR_SPACE       Space Parity
		PAR_MARK        Mark Parity
		PAR_NONE        No Parity
		PAR_EVEN        Even Parity
		PAR_ODD         Odd Parity
		

Implements QextSerialBase.

Definition at line 407 of file win_qextserialport.cpp.

Referenced by open(), and Win_QextSerialPort().

                                                    {
      LOCK_MUTEX();
      if (Settings.Parity!=parity) {
            Settings.Parity=parity;
      }
      if (isOpen()) {
            Win_CommConfig.dcb.Parity=(unsigned char)parity;
            switch (parity) {
                        
                        /*space parity*/
                  case PAR_SPACE:
                        if (Settings.DataBits==DATA_8) {
                              TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning: Space parity with 8 data bits is not supported by POSIX systems.");
                        }
                        Win_CommConfig.dcb.fParity=TRUE;
                        break;
                        
                        /*mark parity - WINDOWS ONLY*/
                  case PAR_MARK:
                        TTY_PORTABILITY_WARNING("Win_QextSerialPort Portability Warning:  Mark parity is not supported by POSIX systems");
                        Win_CommConfig.dcb.fParity=TRUE;
                        break;
                        
                        /*no parity*/
                  case PAR_NONE:
                        Win_CommConfig.dcb.fParity=FALSE;
                        break;
                        
                        /*even parity*/
                  case PAR_EVEN:
                        Win_CommConfig.dcb.fParity=TRUE;
                        break;
                        
                        /*odd parity*/
                  case PAR_ODD:
                        Win_CommConfig.dcb.fParity=TRUE;
                        break;
                  }
                  SetCommConfig(Win_Handle, &Win_CommConfig, sizeof(COMMCONFIG));
      }
      UNLOCK_MUTEX();
}


Generated by  Doxygen 1.6.0   Back to index