Skip to content

support bmp390 #13

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 3 commits into from
Nov 27, 2020
Merged
Show file tree
Hide file tree
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: 4 additions & 3 deletions adafruit_bmp3xx.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@
__version__ = "0.0.0-auto.0"
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BMP3XX.git"

_CHIP_ID = const(0x50)
_BMP388_CHIP_ID = const(0x50)
_BMP390_CHIP_ID = const(0x60)

# pylint: disable=import-outside-toplevel
_REGISTER_CHIPID = const(0x00)
Expand All @@ -77,7 +78,7 @@ class BMP3XX:

def __init__(self):
chip_id = self._read_byte(_REGISTER_CHIPID)
if _CHIP_ID != chip_id:
if chip_id not in (_BMP388_CHIP_ID, _BMP390_CHIP_ID):
raise RuntimeError("Failed to find BMP3XX! Chip ID 0x%x" % chip_id)
self._read_coefficients()
self.reset()
Expand Down Expand Up @@ -237,7 +238,7 @@ def _write_register_byte(self, register, value):

class BMP3XX_I2C(BMP3XX):
"""Driver for I2C connected BMP3XX. Default address is 0x77 but another address can be passed
in as an argument"""
in as an argument"""

def __init__(self, i2c, address=0x77):
import adafruit_bus_device.i2c_device as i2c_device
Expand Down
2 changes: 1 addition & 1 deletion examples/bmp3xx_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@

while True:
print(
"Pressure: {:6.1f} Temperature: {:5.2f}".format(bmp.pressure, bmp.temperature)
"Pressure: {:6.4f} Temperature: {:5.2f}".format(bmp.pressure, bmp.temperature)
)
time.sleep(1)