def initialize(self): """Initialise trinamics steprocker platform.""" yield from super().initialize() # validate our config (has to be in intialize since config_processor # is not read in __init__) self.config = self.machine.config_validator.validate_config("trinamics_steprocker", self.config) self.TMCL = TMCLDevice(self.config['port'], False)
def initialize(self): """Method is called after all hardware platforms were instantiated.""" yield from super().initialize() # validate our config (has to be in intialize since config_processor # is not read in __init__) self.config = self.machine.config_validator.validate_config( "trinamics_steprocker", self.config) self.TMCL = TMCLDevice(self.config['port'], False)
class TrinamicsStepRocker(StepperPlatform): """Supports the Trinamics Step Rocker via PySerial. Works with Trinamics Step Rocker. TBD other 'TMCL' based steppers eval boards """ def __init__(self, machine): """Initialise Trinamics Step Rocker platform.""" super().__init__(machine) self.log = logging.getLogger("Trinamics StepRocker") self.log.debug("Configuring template hardware interface.") self.config = self.machine.config['trinamics_steprocker'] self.platform = None self.features['tickless'] = True self.TMCL = None def __repr__(self): """Return string representation.""" return '<Platform.TrinamicsStepRocker>' @asyncio.coroutine def initialize(self): """Initialise trinamics steprocker platform.""" yield from super().initialize() # validate our config (has to be in intialize since config_processor # is not read in __init__) self.config = self.machine.config_validator.validate_config( "trinamics_steprocker", self.config) self.TMCL = TMCLDevice(self.config['port'], False) def stop(self): """Close serial.""" if self.TMCL: self.TMCL.stop() self.TMCL = None @asyncio.coroutine def configure_stepper(self, number: str, config: dict) -> "TrinamicsTMCLStepper": """Configure a smart stepper device in platform. Args: config (dict): Configuration of device """ return TrinamicsTMCLStepper(number, config, self.TMCL, self.machine) @classmethod def get_stepper_config_section(cls): """Return config validator name.""" return "steprocker_stepper_settings"