From: W. Trevor King Date: Mon, 19 Mar 2012 13:09:30 +0000 (-0400) Subject: Add .ranges() method to Channel class. X-Git-Tag: 0.5~34 X-Git-Url: http://git.tremily.us/?p=pycomedi.git;a=commitdiff_plain;h=6059c10a3b218d7c0f8a32c2588fed60ac2a2701 Add .ranges() method to Channel class. --- diff --git a/pycomedi/channel.pyx b/pycomedi/channel.pyx index b743731..76bb5eb 100644 --- a/pycomedi/channel.pyx +++ b/pycomedi/channel.pyx @@ -119,6 +119,15 @@ cdef class Channel (object): """ return self.get_range(self._find_range(unit, min, max)) + def ranges(self, **kwargs): + "Iterate through all available ranges." + ret = [] + for i in range(self.get_n_ranges()): + #yield self.subdevice(i, **kwargs) + # Generators are not supported in Cython 0.14.1 + ret.append(self.get_range(i, **kwargs)) + return ret + cdef class DigitalChannel (Channel): """Channel configured for reading or writing digital data.