Skip to content
This repository was archived by the owner on Aug 13, 2021. It is now read-only.

Commit 55b56af

Browse files
committed
Now don't try to reserve a pin for DIO3 on the pi header as it's not connected.
Bump the version number for a new release
1 parent e25edc2 commit 55b56af

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

dragino/SX127x/board_config.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class BOARD:
3535
DIO0 = 4 # RaspPi GPIO 4
3636
DIO1 = 23 # RaspPi GPIO 23
3737
DIO2 = 24 # RaspPi GPIO 24
38-
DIO3 = 20 # RaspPi GPIO 20
38+
DIO3 = None # Not connected on dragino header
3939
LED = 18 # RaspPi GPIO 18 connects to the LED on the proto shield
4040
SWITCH = 4 # RaspPi GPIO 4 connects to a switch
4141
SPI_CS = 2 # Chip Select pin to use
@@ -55,7 +55,8 @@ def setup():
5555
GPIO.setup(BOARD.SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
5656
# DIOx
5757
for gpio_pin in [BOARD.DIO0, BOARD.DIO1, BOARD.DIO2, BOARD.DIO3]:
58-
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
58+
if gpio_pin is not None:
59+
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
5960
# blink 2 times to signal the board is set up
6061
BOARD.blink(.1, 2)
6162

@@ -88,10 +89,14 @@ def add_event_detect(dio_number, callback):
8889

8990
@staticmethod
9091
def add_events(cb_dio0, cb_dio1, cb_dio2, cb_dio3, cb_dio4, cb_dio5, switch_cb=None):
91-
BOARD.add_event_detect(BOARD.DIO0, callback=cb_dio0)
92-
BOARD.add_event_detect(BOARD.DIO1, callback=cb_dio1)
93-
BOARD.add_event_detect(BOARD.DIO2, callback=cb_dio2)
94-
BOARD.add_event_detect(BOARD.DIO3, callback=cb_dio3)
92+
if BOARD.DIO0 is not None:
93+
BOARD.add_event_detect(BOARD.DIO0, callback=cb_dio0)
94+
if BOARD.DIO1 is not None:
95+
BOARD.add_event_detect(BOARD.DIO1, callback=cb_dio1)
96+
if BOARD.DIO2 is not None:
97+
BOARD.add_event_detect(BOARD.DIO2, callback=cb_dio2)
98+
if BOARD.DIO3 is not None:
99+
BOARD.add_event_detect(BOARD.DIO3, callback=cb_dio3)
95100
# the modtronix inAir9B does not expose DIO4 and DIO5
96101
if switch_cb is not None:
97102
GPIO.add_event_detect(BOARD.SWITCH, GPIO.RISING, callback=switch_cb, bouncetime=300)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="dragino",
8-
version="0.0.3",
8+
version="0.0.4",
99
author="Philip Basford",
1010
author_email="[email protected]",
1111
description="A wrapper for the dragino LoRa/GPS HAT",

0 commit comments

Comments
 (0)