File tree Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Expand file tree Collapse file tree 1 file changed +15
-8
lines changed Original file line number Diff line number Diff line change 3838from digitalio import Direction
3939from micropython import const
4040
41+ try :
42+ from typing import Optional
43+ from busio import I2C
44+ from digitalio import DigitalInOut # pylint: disable=ungrouped-imports
45+ except ImportError :
46+ pass
47+
4148_MPRLS_DEFAULT_ADDR = const (0x18 )
4249
4350
@@ -80,13 +87,13 @@ class MPRLS:
8087
8188 def __init__ (
8289 self ,
83- i2c_bus ,
90+ i2c_bus : I2C ,
8491 * ,
85- addr = _MPRLS_DEFAULT_ADDR ,
86- reset_pin = None ,
87- eoc_pin = None ,
88- psi_min = 0 ,
89- psi_max = 25
92+ addr : int = _MPRLS_DEFAULT_ADDR ,
93+ reset_pin : Optional [ DigitalInOut ] = None ,
94+ eoc_pin : Optional [ DigitalInOut ] = None ,
95+ psi_min : int = 0 ,
96+ psi_max : int = 25
9097 ):
9198 # Init I2C
9299 self ._i2c = I2CDevice (i2c_bus , addr )
@@ -113,11 +120,11 @@ def __init__(
113120 # That's pretty much it, there's no ID register :(
114121
115122 @property
116- def pressure (self ):
123+ def pressure (self ) -> float :
117124 """The measured pressure, in hPa"""
118125 return self ._read_data ()
119126
120- def _read_data (self ):
127+ def _read_data (self ) -> float :
121128 """Read the status & 24-bit data reading"""
122129 self ._buffer [0 ] = 0xAA
123130 self ._buffer [1 ] = 0
You can’t perform that action at this time.
0 commit comments