def configure_light(self, number, subtype, platform_settings) -> LightPlatformInterface: """Configure a light channel.""" if not subtype: subtype = self._get_default_subtype() if subtype == "matrix": if self.machine_type == self.pinproc.MachineTypePDB: proc_num = self.pdbconfig.get_proc_light_number(str(number)) if proc_num == -1: raise AssertionError( "Matrixlight {} cannot be controlled by the P-ROC. ". format(str(number))) else: proc_num = self.pinproc.decode(self.machine_type, str(number)) return PROCMatrixLight(proc_num, self.machine, self) elif subtype == "led": board, index = number.split("-") polarity = platform_settings and platform_settings.get( "polarity", False) return PDBLED(int(board), int(index), polarity, self.config.get("debug", False), self) else: raise AssertionError("unknown subtype {}".format(subtype))
def configure_matrixlight(self, config): """Configure a matrix light in P3-Roc.""" proc_num = self.pdbconfig.get_proc_light_number(str(config['number'])) if proc_num == -1: raise AssertionError( "Matrixlight {} cannot be controlled by the P3-ROC. ".format( str(config['number']))) proc_driver_object = PROCMatrixLight(proc_num, self.proc) return proc_driver_object
def configure_matrixlight(self, config): """Configure a matrix light.""" if self.machine_type == self.pinproc.MachineTypePDB: proc_num = self.pdbconfig.get_proc_light_number( str(config['number'])) if proc_num == -1: raise AssertionError( "Matrixlight {} cannot be controlled by the P-ROC. ". format(str(config['number']))) else: proc_num = self.pinproc.decode(self.machine_type, str(config['number'])) return PROCMatrixLight(proc_num, self.proc)