Skip to content

Commit dbb0502

Browse files
authored
Merge pull request #13 from ladyada/master
support bmp390
2 parents 488b7af + 5119d7d commit dbb0502

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

adafruit_bmp3xx.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454
__version__ = "0.0.0-auto.0"
5555
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_BMP3XX.git"
5656

57-
_CHIP_ID = const(0x50)
57+
_BMP388_CHIP_ID = const(0x50)
58+
_BMP390_CHIP_ID = const(0x60)
5859

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

7879
def __init__(self):
7980
chip_id = self._read_byte(_REGISTER_CHIPID)
80-
if _CHIP_ID != chip_id:
81+
if chip_id not in (_BMP388_CHIP_ID, _BMP390_CHIP_ID):
8182
raise RuntimeError("Failed to find BMP3XX! Chip ID 0x%x" % chip_id)
8283
self._read_coefficients()
8384
self.reset()
@@ -237,7 +238,7 @@ def _write_register_byte(self, register, value):
237238

238239
class BMP3XX_I2C(BMP3XX):
239240
"""Driver for I2C connected BMP3XX. Default address is 0x77 but another address can be passed
240-
in as an argument"""
241+
in as an argument"""
241242

242243
def __init__(self, i2c, address=0x77):
243244
import adafruit_bus_device.i2c_device as i2c_device

examples/bmp3xx_simpletest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@
1818

1919
while True:
2020
print(
21-
"Pressure: {:6.1f} Temperature: {:5.2f}".format(bmp.pressure, bmp.temperature)
21+
"Pressure: {:6.4f} Temperature: {:5.2f}".format(bmp.pressure, bmp.temperature)
2222
)
2323
time.sleep(1)

0 commit comments

Comments
 (0)