(self, rx=True, tx=True)
flush rx / tx buffers for ftdi device
flush rx / tx buffers for ftdi device
flush rx / tx buffers for ftdi device
def _flushFTDI(self, rx=True, tx=True):
        """ flush rx / tx buffers for ftdi device
        """
        if not self._isFTDI:
            return
        txdir = 0                               # 0:OUT, 1:IN
        req_type = 2 if self._isFTDI else 1     # 0:std, 1:class, 2:vendor
        # 0:device, 1:interface, 2:endpoint, 3:other
        recipient = 0 if self._isFTDI else 1
        req_type = (txdir << 7) + (req_type << 5) + recipient
        if rx:
            self.device.ctrl_transfer(
                bmRequestType=req_type,
                bRequest=0,     # RESET
                wValue=1,       # PURGE RX
                wIndex=1,       # INTERFACE 1
                data_or_wLength=0)
        if tx:
            self.device.ctrl_transfer(
                bmRequestType=req_type,
                bRequest=0,     # RESET
                wValue=2,       # PURGE TX
                wIndex=1,       # INTERFACE 1
                data_or_wLength=0)
def _flushFTDI ( self , rx = True , tx = True ) : if not self . _isFTDI : return txdir = 0 # 0:OUT, 1:IN req_type = 2 if self . _isFTDI else 1 # 0:std, 1:class, 2:vendor # 0:device, 1:interface, 2:endpoint, 3:other recipient = 0 if self . _isFTDI else 1 req_type = ( txdir << 7 ) + ( req_type << 5 ) + recipient if rx : self . device . ctrl_transfer ( bmRequestType = req_type , bRequest = 0 , # RESET wValue = 1 , # PURGE RX wIndex = 1 , # INTERFACE 1 data_or_wLength = 0 ) if tx : self . device . ctrl_transfer ( bmRequestType = req_type , bRequest = 0 , # RESET wValue = 2 , # PURGE TX wIndex = 1 , # INTERFACE 1 data_or_wLength = 0 )