def __init__(self, pin): """(formerly Dallas Semi) OneWire protocol. Protocol definition is here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/126 .. class:: OneWire(pin) Create a OneWire object associated with the given pin. The object implements the lowest level timing-sensitive bits of the protocol. :param ~microcontroller.Pin pin: Pin connected to the OneWire bus Read a short series of pulses:: from aloriumtech import busio from aloriumtech import board onewire = busio.OneWire(board.D7) onewire.reset() onewire.write_bit(True) onewire.write_bit(False) print(onewire.read_bit())""" # Make FPGA calls to allow SAMD to control pin data = 1 << pin[0] struct.pack_into("<I", self._buffer, 0, data) addr = _evo.D2F_ENSET_ADDR _evo.send_evo_write_trans(addr, self._buffer) self._pin = pin self._onewire = busio.OneWire(pin[1]) """Deinitialize the OneWire bus and release any hardware resources for reuse.""" self.deinit = self._onewire.deinit """No-op used by Context Managers.""" self.__enter__ = self._onewire.__enter__ """Automatically deinitializes the hardware when exiting a context. See :ref:`lifetime-and-contextmanagers` for more info.""" self.__exit__ = self._onewire.__exit__ """Reset the OneWire bus and read presence :returns: False when at least one device is present :rtype: bool""" self.reset = self._onewire.reset """Write out a bit based on value.""" self.write_bit = self._onewire.write_bit
def __init__(self, pin): # pylint: disable=no-member self._ow = busio.OneWire(pin) self._readbit = self._ow.read_bit self._writebit = self._ow.write_bit self._maximum_devices = _MAX_DEV
def __init__(self, pin): self._ow = busio.OneWire(pin) self._readbit = self._ow.read_bit self._writebit = self._ow.write_bit