Skip to content

sleep after reset before read register #36

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 2 commits into from
Apr 17, 2023

Conversation

FoamyGuy
Copy link
Contributor

resolves #35

It turns out a sleep of only 0.015 should be the longest that is needed, as specified in the datasheet (Thank you to @KeithTheEE and @jposada202020 !)

I tested the change successfully on Raspberry Pi 3 B+ w/ Blinka and double checked it on a Feather S2 TFT to ensure the microcontroller behavior still works as expected.

@@ -137,6 +138,7 @@ class SI7021:
def __init__(self, i2c_bus: I2C, address: int = 0x40) -> None:
self.i2c_device = I2CDevice(i2c_bus, address)
self._command(_RESET)
time.sleep(0.015)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think adding a comment here to explain why there's a use of time.sleep() would be helpful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, definitely. Latest comment adds a note with link back to the datasheet.

Copy link

@KeithTheEE KeithTheEE left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the hardware to test but it matches and references the datasheet, and given that you tested it on both a pi and a Feather I think it's good to go.

@FoamyGuy FoamyGuy merged commit 4c18043 into adafruit:main Apr 17, 2023
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Apr 18, 2023
Updating https://github.com/adafruit/Adafruit_CircuitPython_IS31FL3741 to 1.4.1 from 1.4.0:
  > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3741#25 from DJDevon3/DJDevon3_IS31FL3741_Branch
  > Merge pull request adafruit/Adafruit_CircuitPython_IS31FL3741#24 from DJDevon3/DJDevon3_IS31FL3741_Branch

Updating https://github.com/adafruit/Adafruit_CircuitPython_SI7021 to 4.1.7 from 4.1.6:
  > Merge pull request adafruit/Adafruit_CircuitPython_SI7021#36 from FoamyGuy/sleep_after_reset
  > Add upload url to release action
  > Add .venv to .gitignore

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Updated download stats for the libraries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raises RuntimeError with Raspberry Pi / Blinka
2 participants