Skip to content

Commit cfffc23

Browse files
authored
Merge pull request #47 from jerryneedell/jerryn_reset
revise RESET to avoid need for Pull-UP
2 parents b3d270f + 2753970 commit cfffc23

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

adafruit_rfm9x.py

+6-8
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
"""
3232
import time
3333
import random
34-
import digitalio
3534
from micropython import const
3635

3736

@@ -245,12 +244,11 @@ def __init__(
245244
# Device support SPI mode 0 (polarity & phase = 0) up to a max of 10mhz.
246245
# Set Default Baudrate to 5MHz to avoid problems
247246
self._device = spidev.SPIDevice(spi, cs, baudrate=baudrate, polarity=0, phase=0)
248-
# Setup reset as a digital input (default state for reset line according
249-
# to the datasheet). This line is pulled low as an output quickly to
250-
# trigger a reset. Note that reset MUST be done like this and set as
251-
# a high impedence input or else the chip cannot change modes (trust me!).
247+
# Setup reset as a digital output - initially High
248+
# This line is pulled low as an output quickly to trigger a reset.
252249
self._reset = reset
253-
self._reset.switch_to_input(pull=digitalio.Pull.UP)
250+
# initialize Reset High
251+
self._reset.switch_to_output(value=True)
254252
self.reset()
255253
# No device type check! Catch an error from the very first request and
256254
# throw a nicer message to indicate possible wiring problems.
@@ -385,9 +383,9 @@ def _write_u8(self, address, val):
385383
def reset(self):
386384
"""Perform a reset of the chip."""
387385
# See section 7.2.2 of the datasheet for reset description.
388-
self._reset.switch_to_output(value=False)
386+
self._reset.value = False # Set Reset Low
389387
time.sleep(0.0001) # 100 us
390-
self._reset.switch_to_input(pull=digitalio.Pull.UP)
388+
self._reset.value = True # set Reset High
391389
time.sleep(0.005) # 5 ms
392390

393391
def idle(self):

0 commit comments

Comments
 (0)