示例#1
0
    def configure_driver(self, config: DriverConfig, number: str, platform_settings: dict):
        """Create a P-ROC driver.

        Typically drivers are coils or flashers, but for the P-ROC this is
        also used for matrix-based lights.

        Args:
            config: Dictionary of settings for the driver.
            number: Number of this driver
            platform_settings: Platform specific setting for this driver.

        Returns a reference to the PROCDriver object which is the actual object
        you can use to pulse(), patter(), enable(), etc.

        """
        # todo need to add Aux Bus support
        # todo need to add virtual driver support for driver counts > 256

        # Find the P-ROC number for each driver. For P-ROC driver boards, the
        # P-ROC number is specified via the Ax-By-C format. For OEM driver
        # boards configured via driver numbers, libpinproc's decode() method
        # can provide the number.

        if self.machine_type == self.pinproc.MachineTypePDB:
            proc_num = self.pdbconfig.get_proc_coil_number(str(number))
            if proc_num == -1:
                raise AssertionError("Driver {} cannot be controlled by the P-ROC. ".format(str(number)))
        else:
            proc_num = self.pinproc.decode(self.machine_type, str(number))

        polarity = platform_settings.get("polarity", None)
        driver = PROCDriver(proc_num, config, self, number, polarity)
        self._late_init_futures.append(driver.initialise())

        return driver
示例#2
0
    def configure_driver(self, config: DriverConfig, number: str,
                         platform_settings: dict):
        """Create a P3-ROC driver.

        Typically drivers are coils or flashers, but for the P3-ROC this is
        also used for matrix-based lights.

        Args:
            config: Dictionary of settings for the driver.

        Returns a reference to the PROCDriver object which is the actual object you
        can use to pulse(), patter(), enable(), etc.
        """
        # todo need to add virtual driver support for driver counts > 256

        # Find the P3-ROC number for each driver. For P3-ROC driver boards, the
        # P3-ROC number is specified via the Ax-By-C format.

        if number.startswith("direct-"):
            return self._configure_direct_driver(config, number)

        proc_num = self.pdbconfig.get_proc_coil_number(str(number))
        if proc_num == -1:
            raise AssertionError(
                "Driver {} cannot be controlled by the P3-ROC. ".format(
                    str(number)))

        if proc_num < 32 and self.dipswitches & 0x01:
            raise AssertionError(
                "Cannot use PD-16 with ID 0 or 1 when DIP 1 is on the P3-Roc. Turn DIP 1 off or "
                "renumber PD-16s. Driver: {}".format(number))

        proc_driver_object = PROCDriver(proc_num, config, self, number, True)

        return proc_driver_object
示例#3
0
    def configure_driver(self, config: DriverConfig, number: str,
                         platform_settings: dict):
        """Create a P3-ROC driver.

        Typically drivers are coils or flashers, but for the P3-ROC this is
        also used for matrix-based lights.

        Args:
            config: Dictionary of settings for the driver.

        Returns:
            A reference to the PROCDriver object which is the actual object you
            can use to pulse(), patter(), enable(), etc.
        """
        # todo need to add virtual driver support for driver counts > 256

        # Find the P3-ROC number for each driver. For P3-ROC driver boards, the
        # P3-ROC number is specified via the Ax-By-C format.

        proc_num = self.pdbconfig.get_proc_coil_number(str(number))
        if proc_num == -1:
            raise AssertionError(
                "Driver {} cannot be controlled by the P3-ROC. ".format(
                    str(number)))

        proc_driver_object = PROCDriver(proc_num, config, self, number)

        return proc_driver_object
示例#4
0
文件: p_roc.py 项目: vgrillot/mpf
    def configure_driver(self, config):
        """Create a P-ROC driver.

        Typically drivers are coils or flashers, but for the P-ROC this is
        also used for matrix-based lights.

        Args:
            config: Dictionary of settings for the driver.

        Returns:
            A reference to the PROCDriver object which is the actual object you
            can use to pulse(), patter(), enable(), etc.

        """
        # todo need to add Aux Bus support
        # todo need to add virtual driver support for driver counts > 256

        # Find the P-ROC number for each driver. For P-ROC driver boards, the
        # P-ROC number is specified via the Ax-By-C format. For OEM driver
        # boards configured via driver numbers, libpinproc's decode() method
        # can provide the number.

        if self.machine_type == self.pinproc.MachineTypePDB:
            proc_num = self.pdbconfig.get_proc_coil_number(
                str(config['number']))
            if proc_num == -1:
                raise AssertionError(
                    "Driver {} cannot be controlled by the P-ROC. ".format(
                        str(config['number'])))
        else:
            proc_num = self.pinproc.decode(self.machine_type,
                                           str(config['number']))

        return PROCDriver(proc_num, config, self)
示例#5
0
    def _configure_direct_driver(self, config, number):
        try:
            _, driver_number = number.split("-", 2)
            driver_number = int(driver_number)
        except (ValueError, TypeError):
            raise AssertionError("Except format direct-X with 0 <= X <= 63. Invalid format. Got: {}".format(number))

        if 0 < driver_number > 63:
            raise AssertionError("Except format direct-X with 0 <= X <= 63. X out of bounds. Got: {}".format(number))

        if not self.dipswitches & 0x01:
            raise AssertionError("Set DIP 1 on the P3-Roc to use burst switches as local outputs")

        return PROCDriver(driver_number, config, self, number)