-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadafruit_bmp3xx.py
40 lines (29 loc) · 891 Bytes
/
adafruit_bmp3xx.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import math
import busio
import dynamic_model
import board
# Note that this module
# accesses the dynamic_model
# directly rather than getting
# written to via the pin mapping in
# board.py. Perhaps a cleaner
# more consistent architecture
# would be to have an I2C device
# mapping similar to the pin
# mapping in board.py
class BMP3XX_I2C(object):
def __init__(self,busio_object,address = 0X77):
if not isinstance(busio_object,busio.I2C):
raise ValueError("Invalid I2C bus for BMP3XX")
if not board.bmp3xx_i2c:
raise ValueError("BMP3XX not enabled in board.py")
pass
@property
def altitude(self):
with dynamic_model.dynamic_instance.model_lock:
return dynamic_model.dynamic_instance.pos[2]
pass
@property
def temperature(self):
return 22.0
pass