Allow AnalogChannel.__init__ to take integers for `range`.
authorW. Trevor King <wking@drexel.edu>
Mon, 19 Mar 2012 17:34:25 +0000 (13:34 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 19 Mar 2012 17:34:30 +0000 (13:34 -0400)
If you know the index of your desired range, you can now use that
index directly and skip the usual call to `find_range`.

pycomedi/channel.pyx

index 76bb5eba9496ccf1fe7741c95bd594fa762afc34..69bd8780eff49375dc71f5ca3f6d01af4f4a0542 100644 (file)
@@ -279,6 +279,8 @@ cdef class AnalogChannel (Channel):
         super(AnalogChannel, self).__init__(**kwargs)
         if range == None:
             range = self.get_range(0)
+        elif isinstance(range, int):
+            range = self.get_range(range)
         self.range = range
         if aref == None:
             flags = self.subdevice.get_flags()