Skip to content

Commit 98791d0

Browse files
authored
fix: stop blocking when not able to lock
1 parent cfcfe2d commit 98791d0

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

adafruit_tca9548a.py

Lines changed: 2 additions & 0 deletions
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,6 +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():
53+
time.sleep(0)
5254
pass
5355
self.tca.i2c.writeto(self.tca.address, self.channel_switch)
5456
return True

0 commit comments

Comments
 (0)