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

Commit

Permalink
Now don't try to reserve a pin for DIO3 on the pi header as it's not …
Browse files Browse the repository at this point in the history
…connected.

Bump the version number for a new release
  • Loading branch information
pjb304 committed Oct 18, 2019
1 parent e25edc2 commit 55b56af
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
17 changes: 11 additions & 6 deletions dragino/SX127x/board_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class BOARD:
DIO0 = 4 # RaspPi GPIO 4
DIO1 = 23 # RaspPi GPIO 23
DIO2 = 24 # RaspPi GPIO 24
DIO3 = 20 # RaspPi GPIO 20
DIO3 = None # Not connected on dragino header
LED = 18 # RaspPi GPIO 18 connects to the LED on the proto shield
SWITCH = 4 # RaspPi GPIO 4 connects to a switch
SPI_CS = 2 # Chip Select pin to use
Expand All @@ -55,7 +55,8 @@ def setup():
GPIO.setup(BOARD.SWITCH, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
# DIOx
for gpio_pin in [BOARD.DIO0, BOARD.DIO1, BOARD.DIO2, BOARD.DIO3]:
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
if gpio_pin is not None:
GPIO.setup(gpio_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
# blink 2 times to signal the board is set up
BOARD.blink(.1, 2)

Expand Down Expand Up @@ -88,10 +89,14 @@ def add_event_detect(dio_number, callback):

@staticmethod
def add_events(cb_dio0, cb_dio1, cb_dio2, cb_dio3, cb_dio4, cb_dio5, switch_cb=None):
BOARD.add_event_detect(BOARD.DIO0, callback=cb_dio0)
BOARD.add_event_detect(BOARD.DIO1, callback=cb_dio1)
BOARD.add_event_detect(BOARD.DIO2, callback=cb_dio2)
BOARD.add_event_detect(BOARD.DIO3, callback=cb_dio3)
if BOARD.DIO0 is not None:
BOARD.add_event_detect(BOARD.DIO0, callback=cb_dio0)
if BOARD.DIO1 is not None:
BOARD.add_event_detect(BOARD.DIO1, callback=cb_dio1)
if BOARD.DIO2 is not None:
BOARD.add_event_detect(BOARD.DIO2, callback=cb_dio2)
if BOARD.DIO3 is not None:
BOARD.add_event_detect(BOARD.DIO3, callback=cb_dio3)
# the modtronix inAir9B does not expose DIO4 and DIO5
if switch_cb is not None:
GPIO.add_event_detect(BOARD.SWITCH, GPIO.RISING, callback=switch_cb, bouncetime=300)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="dragino",
version="0.0.3",
version="0.0.4",
author="Philip Basford",
author_email="P.J.Basford@soton.ac.uk",
description="A wrapper for the dragino LoRa/GPS HAT",
Expand Down

0 comments on commit 55b56af

Please sign in to comment.