How to use the pyftdi.pyprolific.prolific.Prolific function in pyftdi

To help you get started, we’ve selected a few pyftdi examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def _vendor_in(self, value, index, length):
        """Request for a vendor message from the device"""
        try:
            return self.usb_dev.ctrl_transfer(Prolific.VENDOR_IN,
                Prolific.VENDOR_READ_REQUEST, value, index, length,
                self.usb_read_timeout)
        except usb.core.USBError, e:
            raise ProlificError('UsbError: %s' % str(e))
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def _vendor_out(self, value, index, data=''):
        """Send a vendor message to the device"""
        try:
            return self.usb_dev.ctrl_transfer(Prolific.VENDOR_OUT,
                Prolific.VENDOR_WRITE_REQUEST, value, index, data,
                self.usb_write_timeout)
        except usb.core.USBError, e:
            raise ProlificError('UsbError: %s' % str(e))
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def set_flowctrl(self, flowctrl):
        """Set flowcontrol for ftdi chip"""
        if flowctrl == 'hw':
            self._vendor_out(Prolific.SET_FLOWCONTROL_REQUEST,
                self.type == 'hx' and Prolific.FLOWCONTROL_HW_HX \
                    or Prolific.FLOWCONTROL_HW)
        else:
            self._vendor_out(Prolific.SET_FLOWCONTROL_REQUEST,
                             Prolific.FLOWCONTROL_NONE)
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def set_flowctrl(self, flowctrl):
        """Set flowcontrol for ftdi chip"""
        if flowctrl == 'hw':
            self._vendor_out(Prolific.SET_FLOWCONTROL_REQUEST,
                self.type == 'hx' and Prolific.FLOWCONTROL_HW_HX \
                    or Prolific.FLOWCONTROL_HW)
        else:
            self._vendor_out(Prolific.SET_FLOWCONTROL_REQUEST,
                             Prolific.FLOWCONTROL_NONE)
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
raise ProlificError('Unsupported byte length: %d' % bits)
        try:
            np = { 'N' : 0,
                   'O' : 1,
                   'E' : 2,
                   'M' : 3,
                   'S' : 4}[parity]
        except KeyError:
            raise ProlificError('Unsupported parity: %d' % parity)
        try:
            ns = { 1 : 0,
                   2 : 2,
                   3 : 1 }[stopbits]
        except KeyError:
            raise ProlificError('Unsupported stop bits: %d' % stopbits)
        data = self._ctrl_in(Prolific.GET_LINE_REQUEST, 0, 0, 7)
        if len(data) != 7:
            raise ProlificError('Invalid line request')
        (br, sbits, pbit, blen) = struct.unpack('
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def _ctrl_in(self, req, value, index, length):
        """Request for a vendor message from the device"""
        try:
            return self.usb_dev.ctrl_transfer(Prolific.CTRL_IN,
                req, value, index, length, self.usb_read_timeout)
        except usb.core.USBError, e:
            raise ProlificError('UsbError: %s' % str(e))
github eblot / pyftdi / pyftdi / pyprolific / prolific.py View on Github external
def _vendor_out(self, value, index, data=''):
        """Send a vendor message to the device"""
        try:
            return self.usb_dev.ctrl_transfer(Prolific.VENDOR_OUT,
                Prolific.VENDOR_WRITE_REQUEST, value, index, data,
                self.usb_write_timeout)
        except usb.core.USBError, e:
            raise ProlificError('UsbError: %s' % str(e))