コード例 #1
0
ファイル: digital_output.py プロジェクト: krayon/pinball-mpf
    def _initialize_driver(self):
        """Configure a driver as digital output."""
        self.platform = self.machine.get_platform_sections(
            'coils', self.config['platform'])
        self.platform.assert_has_feature("drivers")
        self.type = "driver"

        config = DriverConfig(name=self.name,
                              default_pulse_ms=255,
                              default_pulse_power=1.0,
                              default_hold_power=1.0,
                              default_recycle=False,
                              max_pulse_ms=255,
                              max_pulse_power=1.0,
                              max_hold_power=1.0)

        if not self.platform.features[
                'allow_empty_numbers'] and self.config['number'] is None:
            self.raise_config_error("Digital Output must have a number.", 2)

        try:
            self.hw_driver = self.platform.configure_driver(
                config, self.config['number'],
                self.config['platform_settings'])
        except AssertionError as e:
            raise AssertionError(
                "Failed to configure driver {} in platform. See error above".
                format(self.name)) from e
コード例 #2
0
    async def _initialize(self):
        await super()._initialize()
        self.platform = self.machine.get_platform_sections(
            'coils', self.config['platform'])

        config = DriverConfig(
            name=self.name,
            default_pulse_ms=self.get_and_verify_pulse_ms(None),
            default_pulse_power=self.get_and_verify_pulse_power(None),
            default_hold_power=self.get_and_verify_hold_power(None),
            default_recycle=self.config['default_recycle'],
            max_pulse_ms=self.config['max_pulse_ms'],
            max_pulse_power=self.config['max_pulse_power'],
            max_hold_power=self.config['max_hold_power'])
        platform_settings = dict(
            self.config['platform_settings']
        ) if self.config['platform_settings'] else dict()

        if not self.platform.features[
                'allow_empty_numbers'] and self.config['number'] is None:
            self.raise_config_error("Driver must have a number.", 1)

        try:
            self.hw_driver = self.platform.configure_driver(
                config, self.config['number'], platform_settings)
        except AssertionError as e:
            raise AssertionError(
                "Failed to configure driver {} in platform. See error above".
                format(self.name)) from e
コード例 #3
0
ファイル: driver.py プロジェクト: unRARed/mpf
    def _initialize(self):
        self.platform = self.machine.get_platform_sections('coils', self.config['platform'])

        config = DriverConfig(
            default_pulse_ms=self.get_and_verify_pulse_ms(None),
            default_pulse_power=self.get_and_verify_pulse_power(None),
            default_hold_power=self.get_and_verify_hold_power(None),
            default_recycle=self.config['default_recycle'],
            max_pulse_ms=self.config['max_pulse_ms'],
            max_pulse_power=self.config['max_pulse_power'],
            max_hold_power=self.config['max_hold_power'])
        platform_settings = dict(self.config['platform_settings']) if self.config['platform_settings'] else dict()

        try:
            self.hw_driver = self.platform.configure_driver(config, self.config['number'], platform_settings)
        except AssertionError as e:
            raise AssertionError("Failed to configure driver {} in platform. See error above".format(self.name)) from e
コード例 #4
0
ファイル: driver.py プロジェクト: Blackbaud-JohnMarsh/mpf
    def _initialize(self):
        self.platform = self.machine.get_platform_sections(
            'coils', self.config['platform'])

        config = DriverConfig(
            default_pulse_ms=self.get_and_verify_pulse_ms(None),
            default_pulse_power=self.config['default_pulse_power'],
            default_hold_power=self.config['default_hold_power'],
            default_recycle=self.config['default_recycle'],
            max_pulse_ms=self.config['max_pulse_ms'],
            max_pulse_power=self.config['max_pulse_power'],
            max_hold_power=self.config['max_hold_power'])
        platform_settings = dict(
            self.config['platform_settings']
        ) if self.config['platform_settings'] else dict()

        self.hw_driver = self.platform.configure_driver(
            config, self.config['number'], platform_settings)
コード例 #5
0
ファイル: digital_output.py プロジェクト: woosle1234/mpf
    def _initialize_driver(self):
        """Configure a driver as digital output."""
        self.platform = self.machine.get_platform_sections(
            'coils', self.config['platform'])
        self.type = "driver"

        config = DriverConfig(default_pulse_ms=255,
                              default_pulse_power=1.0,
                              default_hold_power=1.0,
                              default_recycle=False,
                              max_pulse_ms=255,
                              max_pulse_power=1.0,
                              max_hold_power=1.0)

        try:
            self.hw_driver = self.platform.configure_driver(
                config, self.config['number'], {})
        except AssertionError as e:
            raise AssertionError(
                "Failed to configure driver {} in platform. See error above".
                format(self.name)) from e