@@ -214,7 +214,7 @@ def ldo_voltage(self):
214
214
@ldo_voltage .setter
215
215
def ldo_voltage (self , voltage = "EXTERNAL" ):
216
216
"""Select the LDO Voltage. Valid voltages are '2V4', '2V7', '3V0'."""
217
- if not "LDO_" + voltage in dir (LDOVoltage ):
217
+ if not f "LDO_{ voltage } " in dir (LDOVoltage ):
218
218
raise ValueError ("Invalid LDO Voltage" )
219
219
self ._ldo_voltage = voltage
220
220
if self ._ldo_voltage == "2V4" :
@@ -231,9 +231,9 @@ def gain(self):
231
231
232
232
@gain .setter
233
233
def gain (self , factor = 1 ):
234
- """Select PGA gain factor. Valid values are ' 1, 2, 4, 8, 16, 32, 64,
234
+ """Select PGA gain factor. Valid values are 1, 2, 4, 8, 16, 32, 64,
235
235
and 128."""
236
- if not "GAIN_X" + str ( factor ) in dir (Gain ):
236
+ if not f "GAIN_X{ factor } " in dir (Gain ):
237
237
raise ValueError ("Invalid Gain Factor" )
238
238
self ._gain = factor
239
239
if self ._gain == 1 :
@@ -253,6 +253,28 @@ def gain(self, factor=1):
253
253
elif self ._gain == 128 :
254
254
self ._c1_gains = Gain .GAIN_X128
255
255
256
+ @property
257
+ def poll_rate (self ):
258
+ """ADC conversion/polling rate."""
259
+ return self ._c2_conv_rate
260
+
261
+ @poll_rate .setter
262
+ def poll_rate (self , rate = 0 ):
263
+ """Select polling rate. Valid values are 10, 20, 40, 80, and 320."""
264
+ if not f"RATE_{ rate } SPS" in dir (ConversionRate ):
265
+ raise ValueError ("Invalid Conversion Rate" )
266
+ self ._rate = rate
267
+ if self ._rate == 10 :
268
+ self ._c2_conv_rate = ConversionRate .RATE_10SPS
269
+ if self ._rate == 20 :
270
+ self ._c2_conv_rate = ConversionRate .RATE_20SPS
271
+ if self ._rate == 40 :
272
+ self ._c2_conv_rate = ConversionRate .RATE_40SPS
273
+ if self ._rate == 80 :
274
+ self ._c2_conv_rate = ConversionRate .RATE_80SPS
275
+ if self ._rate == 320 :
276
+ self ._c2_conv_rate = ConversionRate .RATE_320SPS
277
+
256
278
def enable (self , power = True ):
257
279
"""Enable(start) or disable(stop) the internal analog and digital
258
280
systems power. Enable = True; Disable (low power) = False. Returns
0 commit comments