34
34
35
35
try :
36
36
from typing import Dict , Tuple
37
+ from typing_extensions import Literal
37
38
from busio import SPI
38
39
from digitalio import DigitalInOut
39
40
except ImportError :
@@ -206,7 +207,7 @@ def averaging(self, num_samples: int) -> None:
206
207
self ._write_u8 (_MAX31856_CR1_REG , conf_reg_1 )
207
208
208
209
@property
209
- def noise_rejection (self ) -> int :
210
+ def noise_rejection (self ) -> Literal [ 50 , 60 ] :
210
211
"""
211
212
The frequency (Hz) to be used by the noise rejection filter.
212
213
Must be 50 or 60. Default is 60."""
@@ -217,7 +218,7 @@ def noise_rejection(self) -> int:
217
218
return 60
218
219
219
220
@noise_rejection .setter
220
- def noise_rejection (self , frequency : int ) -> None :
221
+ def noise_rejection (self , frequency : Literal [ 50 , 60 ] ) -> None :
221
222
conf_reg_0 = self ._read_register (_MAX31856_CR0_REG , 1 )[0 ]
222
223
if frequency == 50 :
223
224
conf_reg_0 |= _MAX31856_CR0_50HZ # set the 50hz bit
@@ -290,7 +291,7 @@ def temperature_thresholds(self, val: Tuple[float, float]) -> None:
290
291
@property
291
292
def reference_temperature_thresholds ( # pylint: disable=invalid-name,
292
293
self ,
293
- ) -> Tuple [float , float ]: # pylint: disable=invalid-name
294
+ ) -> Tuple [float , float ]:
294
295
"""The cold junction's low and high temperature thresholds
295
296
as a ``(low_temp, high_temp)`` tuple
296
297
"""
@@ -302,7 +303,7 @@ def reference_temperature_thresholds( # pylint: disable=invalid-name,
302
303
@reference_temperature_thresholds .setter
303
304
def reference_temperature_thresholds ( # pylint: disable=invalid-name,
304
305
self , val : Tuple [float , float ]
305
- ) -> None : # pylint: disable=invalid-name
306
+ ) -> None :
306
307
307
308
self ._write_u8 (_MAX31856_CJLF_REG , int (val [0 ]))
308
309
self ._write_u8 (_MAX31856_CJHF_REG , int (val [1 ]))
0 commit comments