async def new_bootloader_module(): module = await hw_modules.build(port='/dev/modules/tty0_tempdeck', which='tempdeck', simulating=True, interrupt_callback=lambda x: None) module._device_info = {'model': 'temp_deck_v1.1'} module._driver = TempDeckDriver() return module
def _build_driver( simulating: bool, sim_model: str = None ) -> Union['SimulatingDriver', 'TempDeckDriver']: if simulating: return SimulatingDriver(sim_model=sim_model) else: return TempDeckDriver()
def connect(self): """ Connect to the 'TempDeck' port Planned change- will connect to the correct port in case of multiple TempDecks """ if self._port: self._driver = TempDeckDriver() self._driver.connect(self._port) self._device_info = self._driver.get_device_info() Thread(target=self._poll_temperature).start() else: # Sanity check Should never happen, because connect should never # be called without a port on Module raise MissingDevicePortError( "TempDeck couldnt connect to port {}".format(self._port))
def __init__(self, port, simulating, loop: asyncio.AbstractEventLoop = None) -> None: if simulating: self._driver: Union['SimulatingDriver', 'TempDeckDriver'] \ = SimulatingDriver() else: self._driver: Union['SimulatingDriver', 'TempDeckDriver'] \ = TempDeckDriver() if None is loop: self._loop = asyncio.get_event_loop() else: self._loop = loop self._port = port self._device_info = None self._poller = None
def connect(self): """ Connect to the 'TempDeck' port Planned change- will connect to the correct port in case of multiple TempDecks """ if self._port: if temp_locks.get(self._port): self._driver = temp_locks[self._port][1] else: self._driver = TempDeckDriver() if not self._driver.is_connected(): self._driver.connect(self._port) self._device_info = self._driver.get_device_info() self._poll_stop_event = Event() Thread(target=self._poll_temperature, daemon=True).start() else: # Sanity check Should never happen, because connect should never # be called without a port on Module raise MissingDevicePortError( "TempDeck couldn't connect to port {}".format(self._port))
def _build_driver( simulating: bool) -> Union['SimulatingDriver', 'TempDeckDriver']: if simulating: return SimulatingDriver() else: return TempDeckDriver()
def new_bootloader_module(): module = modules.TempDeck(port='/dev/modules/tty0_tempdeck') module._device_info = {'model': 'temp_deck_v1.1'} module._driver = TempDeckDriver() return module