From 6059c10a3b218d7c0f8a32c2588fed60ac2a2701 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Mon, 19 Mar 2012 09:09:30 -0400 Subject: [PATCH] Add .ranges() method to Channel class. --- pycomedi/channel.pyx | 9 +++++++++ 1 file changed, 9 insertions(+) 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. -- 2.26.2