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
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
7 changes: 7 additions & 0 deletions adafruit_si7021/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* Adafruit's Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
"""
import struct
import time

from adafruit_bus_device.i2c_device import I2CDevice
from micropython import const
Expand Down Expand Up @@ -137,6 +138,12 @@ class SI7021:
def __init__(self, i2c_bus: I2C, address: int = 0x40) -> None:
self.i2c_device = I2CDevice(i2c_bus, address)
self._command(_RESET)

# max 15ms Powerup Time after issuing software reset
# Table 2 inside of:
# https://cdn-learn.adafruit.com/assets/assets/000/035/931/original/Support_Documents_TechnicalDocs_Si7021-A20.pdf
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.


# Make sure the USER1 settings are correct.
while True:
# While restarting, the sensor doesn't respond to reads or writes.
Expand Down