Skip to content

Commit 5beb77f

Browse files
authored
Merge pull request #19 from fourstix/b_spi_update
Updated examples to set CS on D20
2 parents 9bfdcf8 + b67a364 commit 5beb77f

File tree

4 files changed

+16
-7
lines changed

4 files changed

+16
-7
lines changed

examples/example1_basic_lightning_spi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@
4747
# Create a library object using the Bus SPI port
4848
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
4949

50-
# Set up chip select (CE0 is labeled CS on Sparkfun Pi Hat)
51-
cs = digitalio.DigitalInOut(board.CE0)
50+
# Set up chip select on D20
51+
# CS can be any available GPIO pin
52+
cs = digitalio.DigitalInOut(board.D20)
5253
cs.direction = digitalio.Direction.OUTPUT
5354

5455
lightning = sparkfun_qwiicas3935.Sparkfun_QwiicAS3935_SPI(spi, cs)

examples/example2_more_lightning_features_spi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,9 @@
4040
# Create a library object using the Bus SPI port
4141
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
4242

43-
# Set up chip select (CE0 is labeled CS on Sparkfun Pi Hat)
44-
cs = digitalio.DigitalInOut(board.CE0)
43+
# Set up chip select on D20
44+
# CS can be any available GPIO pin
45+
cs = digitalio.DigitalInOut(board.D20)
4546
cs.direction = digitalio.Direction.OUTPUT
4647

4748
lightning = sparkfun_qwiicas3935.Sparkfun_QwiicAS3935_SPI(spi, cs)

examples/example3_tune_antenna_spi.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,9 @@
3131
# Create a library object using the Bus SPI port
3232
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
3333

34-
# Set up chip select (CE0 is labeled CS on Sparkfun Pi Hat)
35-
cs = digitalio.DigitalInOut(board.CE0)
34+
# Set up chip select on D20
35+
# CS can be any available GPIO pin
36+
cs = digitalio.DigitalInOut(board.D20)
3637
cs.direction = digitalio.Direction.OUTPUT
3738

3839
lightning = sparkfun_qwiicas3935.Sparkfun_QwiicAS3935_SPI(spi, cs)

examples/qwiicas3935_simpletest.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@
1717
that status of the Qwiic AS3935 Lightning Detector.
1818
"""
1919
import sys
20+
21+
# import busio
22+
# import digitalio
2023
import board
2124
import sparkfun_qwiicas3935
2225

@@ -27,8 +30,11 @@
2730
lightning = sparkfun_qwiicas3935.Sparkfun_QwiicAS3935_I2C(i2c)
2831

2932
# OR create a library object using the Bus SPI port
33+
# CS can be any available GPIO pin
34+
3035
# spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
31-
# cs = digitalio.DigitalInOut(board.D8)
36+
# cs = digitalio.DigitalInOut(board.D20)
37+
# cs.direction = digitalio.Direction.OUTPUT
3238
# lightning = sparkfun_qwiicas3935.Sparkfun_QwiicAS3935_SPI(spi, cs)
3339

3440
# Check if connected

0 commit comments

Comments
 (0)