Skip to content

revise RESET to avoid need for Pull-UP #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions adafruit_rfm9x.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"""
import time
import random
import digitalio
from micropython import const


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

def idle(self):
Expand Down