Skip to content

Commit 688c068

Browse files
authored
Merge pull request #10 from tinue/master
Grab lock in examples (due to commit a5288a1
2 parents 6d882c1 + accb653 commit 688c068

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,12 @@ Usage Example
8383
8484
spi = bitbangio.SPI(SCLK_PIN, MOSI=MOSI_PIN, MISO=MISO_PIN)
8585
cs.value = 0
86+
while not spi.try_lock():
87+
pass
8688
spi.write([0xD0])
8789
data = [0x00]
8890
spi.readinto(data)
91+
spi.unlock()
8992
cs.value = 1
9093
print("Result is {}".format(data))
9194

examples/bitbangio_simpletest.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@
1919

2020
spi = bitbangio.SPI(SCLK_PIN, MOSI=MOSI_PIN, MISO=MISO_PIN)
2121
cs.value = 0
22+
while not spi.try_lock():
23+
pass
2224
spi.write([0xD0])
2325
data = [0x00]
2426
spi.readinto(data)
27+
spi.unlock()
2528
cs.value = 1
2629
print("Result is {}".format(data))

0 commit comments

Comments
 (0)