4040_PLATFORM_NAME = "MicroPython"
4141
4242# used internally in this file to get i2c class object
43- def _connectToI2CBus (sda = None , scl = None , freq = None , * args , ** argk ):
43+ def _connectToI2CBus (sda = None , scl = None , freq = 100000 , * args , ** argk ):
4444 try :
4545 from machine import I2C , Pin
4646 if sys .platform == 'rp2' :
47- if sda is not None and scl is not None and freq is not None :
47+ if sda is not None and scl is not None :
4848 # I2C busses follow every other pair of pins
4949 scl_id = (scl // 2 ) % 2
5050 sda_id = (sda // 2 ) % 2
@@ -57,7 +57,7 @@ def _connectToI2CBus(sda=None, scl=None, freq=None, *args, **argk):
5757 elif 'xbee' in sys .platform :
5858 return I2C (id = 1 , freq = freq )
5959 elif 'esp32' in sys .platform :
60- if sda is not None and scl is not None and freq is not None :
60+ if sda is not None and scl is not None :
6161 return I2C (scl = Pin (scl ), sda = Pin (sda ), freq = freq )
6262 else :
6363 return I2C ()
@@ -77,7 +77,7 @@ class MicroPythonI2C(I2CDriver):
7777 name = _PLATFORM_NAME
7878 _i2cbus = None
7979
80- def __init__ (self , sda = None , scl = None , freq = None , * args , ** argk ):
80+ def __init__ (self , sda = None , scl = None , freq = 100000 , * args , ** argk ):
8181 I2CDriver .__init__ (self ) # init super
8282
8383 self ._sda = sda
0 commit comments