def __init__(self, scl, sda, freq=100000): self.deinit() self._i2c = _I2C(I2C_MASTER_PORT, sda=sda, scl=scl, freq=freq) if threading is not None: self._lock = threading.RLock()
def init(self, scl, sda, frequency): from machine import Pin from machine import I2C as _I2C self.deinit() id = ( -1 ) # force bitbanging implementation - in future introspect platform if SDA/SCL matches hardware I2C self._i2c = _I2C(id, Pin(scl.id), Pin(sda.id), freq=frequency)
def init(self, scl, sda, frequency): """Initialization""" from machine import Pin from machine import I2C as _I2C self.deinit() id = ( # pylint: disable=redefined-builtin -1) # force bitbanging implementation - in future # introspect platform if SDA/SCL matches hardware I2C self._i2c = _I2C(id, Pin(scl.id), Pin(sda.id), freq=frequency)
def __init__(self, scl, sda, *, frequency=100000): for portId, portScl, portSda in i2cPorts: try: if scl == portScl and sda == portSda: self._i2c = _I2C(portId, sda=Pin(sda.id), scl=Pin(scl.id), freq=frequency) break except RuntimeError: pass else: raise ValueError( "No Hardware I2C on (scl,sda)={}\nValid I2C ports: {}".format( (scl, sda), i2cPorts))
def init(self, scl, sda, frequency): self.deinit() from machine import I2C as _I2C from machine import Pin as _Pin self._i2c = _I2C(id=0, scl=_Pin(scl), sda=_Pin(sda), freq=frequency)
def __init__(self, portId, *, mode=MASTER, baudrate=100000): self._i2c = _I2C(portId, freq=baudrate)
def __init__(self, scl, sda, frequency=100000): """Initialization""" self.deinit() from machine import I2C as _I2C self._i2c = _I2C(1, freq=frequency)
def init(self, frequency): """Initialization""" self.deinit() from machine import I2C as _I2C self._i2c = _I2C(2, freq=frequency)