Skip to content

Commit 1ad9f4d

Browse files
authored
Merge pull request #39 from GwnDaan/patch-1
Wait for other thread to unlock when not able to lock
2 parents cfcfe2d + 48516aa commit 1ad9f4d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

adafruit_tca9548a.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
3030
"""
3131

32+
import time
3233
from micropython import const
3334

3435
_DEFAULT_ADDRESS = const(0x70)
@@ -49,7 +50,7 @@ def __init__(self, tca, channel):
4950
def try_lock(self):
5051
"""Pass through for try_lock."""
5152
while not self.tca.i2c.try_lock():
52-
pass
53+
time.sleep(0)
5354
self.tca.i2c.writeto(self.tca.address, self.channel_switch)
5455
return True
5556

0 commit comments

Comments
 (0)