def __init__(self, hardware, vid, pid): self._hardware = hardware super(RespeakerMicArrayV2, self).__init__(self._hardware['numberOfLeds']) self._leds = pixel_ring.find(vid=int(vid, 16), pid=int(pid, 16)) if self._leds is None: raise InterfaceInitError( 'Respeaker Mic Array V2 not found using pid={} and vid={}'. format(pid, vid)) self._colors = self._newArray() self._src = None if 'doa' in hardware and hardware['doa']: self._logger.info('Hardware is DOA capable') from libraries.seeedstudios.channel_picker import ChannelPicker from libraries.seeedstudios.source import Source lib = importlib.import_module('libraries.seeedstudios.' + hardware['doa']) klass = getattr(lib, 'DOA') self._src = Source(rate=hardware['rate'], channels=hardware['channels']) ch0 = ChannelPicker(channels=self._src.channels, pick=0) self._doa = klass(rate=hardware['rate']) self._src.link(ch0) self._src.link(self._doa)
def __init__(self, numLeds, matrixIp, everloopPort): super(MatrixVoice, self).__init__(numLeds) try: self._leds = Everloop(numLeds, matrixIp, everloopPort) except: raise InterfaceInitError("Couldn't initialize everloop")
def __init__(self, numLeds, vid, pid): super(RespeakerMicArrayV2, self).__init__(numLeds) self._leds = pixel_ring.find(vid=int(vid, 16), pid=int(pid, 16)) if self._leds is None: raise InterfaceInitError('Respeaker Mic Array V2 not found using pid={} and vid={}'.format(pid, vid)) self._power = LED(5) self._colors = self._newArray()
def __init__(self, numLeds, stripType, pin): super(Neopixels, self).__init__(numLeds) if stripType not in self._STRIP_TYPES.keys(): raise InterfaceInitError('Unsupported neopixel type "{}"'.format(stripType)) self._type = stripType self._pin = pin self._leds = Adafruit_NeoPixel(num=numLeds, pin=pin, brightness=100, strip_type=self._STRIP_TYPES[stripType]) self._leds.begin()
def __init__(self, numLeds): super(respeaker7MicArray, self).__init__(numLeds) self._image = self._newArray() try: self._leds = respeaker.usb_hid.get() if self._leds is None: raise InterfaceInitError() except InterfaceInitError: self._logger.error("Couldn't init respeaker 7 mic array")
def __init__(self, numLeds, pinout, activeHigh): super(PureGPIO, self).__init__(numLeds) if len(pinout) != numLeds: raise InterfaceInitError( 'Pure GPIO number of led versus pinout declaration missmatch') self._pinout = pinout self._activeHigh = activeHigh self._image = self._newArray() self._leds = [] for pin in self._pinout: self._leds.append( LED(pin=pin, active_high=activeHigh, initial_value=False))