File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ def __init__(
7878
7979 self .gain = self ._gain
8080 self .resolution = self ._resolution
81- self .mode = self ._mode
81+ self .continuous_mode = self ._mode
8282
8383 self .adc_data = bytearray (4 )
8484
@@ -171,7 +171,7 @@ def resolution(self, value: int) -> None:
171171 device .write (bytes ([config_byte ]))
172172
173173 @property
174- def mode (self ) -> bool :
174+ def continuous_mode (self ) -> bool :
175175 """
176176 Current mode setting from the device
177177
@@ -183,8 +183,8 @@ def mode(self) -> bool:
183183 except Exception as error :
184184 raise OSError (f"Failed to read mode from device: { error } " ) from error
185185
186- @mode .setter
187- def mode (self , value : bool ) -> None :
186+ @continuous_mode .setter
187+ def continuous_mode (self , value : bool ) -> None :
188188 self ._mode = value
189189 config_byte = self ._register_value
190190 with self .i2c_device as device :
Original file line number Diff line number Diff line change 2828while True :
2929 print (f"ADC value: { adc_channel .value } " )
3030 print (f"Current gain: { adc .gain } X" )
31+ print (f"Current resolution: { adc .resolution } -bit" )
32+ if adc .continuous_mode :
33+ mode = "continuous"
34+ else :
35+ mode = "one-shot"
36+ print (f"Mode: { mode } " )
3137 print ()
3238 time .sleep (0.01 )
You can’t perform that action at this time.
0 commit comments