Skip to content

Commit a2ce100

Browse files
authored
Merge pull request #987 from makermelissa/main
Improve undetected I2C and SPI messages
2 parents f52e368 + e722742 commit a2ce100

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/busio.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,8 @@ def init(self, scl, sda, frequency):
177177
pass
178178
else:
179179
raise ValueError(
180-
"No Hardware I2C on (scl,sda)={}\nValid I2C ports: {}".format(
181-
(scl, sda), i2cPorts
182-
)
180+
f"No Hardware I2C on (scl,sda)={(scl, sda)}\n"
181+
f"Valid I2C ports: {i2cPorts}.\nMake sure I2C is enabled."
183182
)
184183
if threading is not None:
185184
self._lock = threading.RLock()
@@ -398,9 +397,8 @@ def __init__(self, clock, MOSI=None, MISO=None):
398397
break
399398
else:
400399
raise ValueError(
401-
"No Hardware SPI on (SCLK, MOSI, MISO)={}\nValid SPI ports:{}".format(
402-
(clock, MOSI, MISO), spiPorts
403-
)
400+
f"No Hardware SPI on (SCLK, MOSI, MISO)={(clock, MOSI, MISO)}\n"
401+
f"Valid SPI ports: {spiPorts}.\nMake sure SPI is enabled."
404402
)
405403

406404
def configure(self, baudrate=100000, polarity=0, phase=0, bits=8):

0 commit comments

Comments
 (0)