def initHardware(self): try: if self._hardware['interface'] == Interfaces.APA102: from interfaces.apa102 import APA102 self._interface = APA102(numLed=self._hardware['numberOfLeds']) elif self._hardware['interface'] == Interfaces.NEOPIXELS: from interfaces.neopixels import Neopixels self._interface = Neopixels(numLeds=self._hardware['numberOfLeds'], stripType=self._hardware['type'], pin=self._hardware['gpioPin']) elif self._hardware['interface'] == Interfaces.RESPEAKER_MIC_ARRAY_V2: from interfaces.respeakerMicArrayV2 import RespeakerMicArrayV2 self._interface = RespeakerMicArrayV2(numLeds=self._hardware['numberOfLeds'], vid=self._hardware['vid'], pid=self._hardware['pid']) elif self._hardware['interface'] == Interfaces.MATRIX_VOICE: from interfaces.matrixvoice import MatrixVoice self._interface = MatrixVoice(numLeds=self._hardware['numberOfLeds'], matrixIp=self._hardware['matrixIp'], everloopPort=self._hardware['everloopPort']) if self._interface is None: return False else: return True except InterfaceInitError as e: self._logger.error('{}'.format(e)) return False
def initHardware(self): try: if self._hardware['interface'] == Interfaces.APA102: from interfaces.apa102 import APA102 self._interface = APA102(hardware=self._hardware, endFrame=self._hardware['endFrame']) elif self._hardware['interface'] == Interfaces.NEOPIXELS: from interfaces.neopixels import Neopixels self._interface = Neopixels(numLeds=self._hardware['numberOfLeds'], stripType=self._hardware['type'], pin=self._hardware['gpioPin']) elif self._hardware['interface'] == Interfaces.RESPEAKER_MIC_ARRAY_V2: from interfaces.respeakerMicArrayV2 import RespeakerMicArrayV2 self._interface = RespeakerMicArrayV2(hardware=self._hardware, vid=self._hardware['vid'], pid=self._hardware['pid']) elif self._hardware['interface'] == Interfaces.MATRIX_VOICE: from interfaces.matrixvoice import MatrixVoice self._interface = MatrixVoice(numLeds=self._hardware['numberOfLeds']) elif self._hardware['interface'] == Interfaces.PURE_GPIO: from interfaces.pureGPIO import PureGPIO self._interface = PureGPIO(numLeds=self._hardware['numberOfLeds'], pinout=self._hardware['gpios'], activeHigh=self._hardware['activeHigh']) if self._interface is None: return False else: return True except InterfaceInitError as e: self._logger.error('{}'.format(e)) return False