Exemplo n.º 1
0
    def __init__(self,
                 vendor=0x18d1,
                 product=0x501a,
                 interface=0,
                 serialname=None,
                 ftdi_context=None):
        """Suart contstructor.

    Initializes stm32 USB stream interface.

    Args:
      vendor: usb vendor id of stm32 device
      product: usb product id of stm32 device
      interface: interface number of stm32 device to use
      serialname: n/a. Defaults to None.
      ftdi_context: n/a. Defaults to None.

    Raises:
      SuartError: If init fails
    """
        super(Suart, self).__init__()
        self._logger = logging.getLogger('Suart')
        self._logger.debug('')
        self._logger.debug('Suart opening %04x:%04x, intf %d, sn: %s' %
                           (vendor, product, interface, serialname))

        self._susb = stm32usb.Susb(vendor=vendor,
                                   product=product,
                                   interface=interface,
                                   serialname=serialname,
                                   logger=self._logger)

        self._logger.debug("Set up stm32 uart")
Exemplo n.º 2
0
  def __init__(self, vendor=0x18d1, product=0x501a, interface=0,
               serialname=None, debuglog=False):
    """Suart contstructor.

    Initializes stm32 USB stream interface.

    Args:
      vendor: usb vendor id of stm32 device
      product: usb product id of stm32 device
      interface: interface number of stm32 device to use
      serialname: serial name to target. Defaults to None.
      debuglog: chatty output. Defaults to False.

    Raises:
      SuartError: If init fails
    """
    self._ptym = None
    self._ptys = None
    self._ptyname = None
    self._rx_thread = None
    self._tx_thread = None
    self._debuglog = debuglog
    self._susb = stm32usb.Susb(vendor=vendor, product=product,
                               interface=interface, serialname=serialname)
    self._running = False
Exemplo n.º 3
0
    def __init__(self,
                 vendor=0x18d1,
                 product=0x500f,
                 interface=1,
                 serialname=None):
        """Sgpio constructor.

    Loads libraries for libusb.  Creates instance objects
    and Gpio to iteract with the library and intializes them.

    Args:
      vendor    : usb vendor id of stm32 device
      product   : usb product id of stm32 device
      interface : interface number ( 1 - 4 ) of stm32 device to use
      serialname: string of device serialname/number TODO: is this a thing?

    Raises:
      SgpioError: An error accessing Sgpio object
    """
        self._logger = logging.getLogger("Sgpio")
        self._logger.debug("")

        self._susb = stm32usb.Susb(vendor=vendor,
                                   product=product,
                                   interface=interface,
                                   serialname=serialname,
                                   logger=self._logger)

        self._logger.debug("Set up stm32 gpio")
Exemplo n.º 4
0
  def __init__(self, vendor=0x18d1, product=0x501a, interface=0,
               serialname=None, ftdi_context=None):
    """Suart contstructor.

    Initializes stm32 USB stream interface.

    Args:
      vendor: usb vendor id of stm32 device
      product: usb product id of stm32 device
      interface: interface number of stm32 device to use
      serialname: n/a. Defaults to None.
      ftdi_context: n/a. Defaults to None.

    Raises:
      SuartError: If init fails
    """
    self._susb = stm32usb.Susb(vendor=vendor, product=product,
                               interface=interface, serialname=serialname)
Exemplo n.º 5
0
    def __init__(self,
                 vendor=0x18d1,
                 product=0x501a,
                 interface=1,
                 port=0,
                 serialname=None):
        self._logger = logging.getLogger("Si2c")
        self._logger.debug("")

        self._port = port
        self._logger.debug("Set port %d" % port)

        self._susb = stm32usb.Susb(vendor=vendor,
                                   product=product,
                                   interface=interface,
                                   serialname=serialname,
                                   logger=self._logger)

        self._logger.debug("Set up stm32 i2c")
Exemplo n.º 6
0
    def __init__(self,
                 vendor=0x18d1,
                 product=0x501a,
                 interface=1,
                 port=0,
                 serialname=None):
        i2c_base.BaseI2CBus.__init__(self)

        self._logger = logging.getLogger('Si2c')
        self._logger.debug('')

        self._port = port
        self._logger.debug('Set port %d' % port)

        self._susb = stm32usb.Susb(vendor=vendor,
                                   product=product,
                                   interface=interface,
                                   serialname=serialname,
                                   logger=self._logger)

        self._logger.debug('Set up stm32 i2c')