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, 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()