From: W. Trevor King Date: Mon, 19 Mar 2012 15:26:43 +0000 (-0400) Subject: Revert "Mask range.unit with 0xff when determining the unit." X-Git-Tag: 0.5~30 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=60e6fee2a72800ccfc74a21fe01c65a5266591ce;p=pycomedi.git Revert "Mask range.unit with 0xff when determining the unit." This reverts commit d721a0c05450c793a5e0e562d286a689565cf81b. From the National Instruments E Series User Manual [1], page 3-2: Reference Selection (NI 6020E, NI PXI-6040E, NI 6052E, NI 6062E, NI 6070E/6071E, and PCI-MIO-16E-4 Devices Only) You can connect each DAC to the device internal reference of 10 V or to the external reference signal connected to the external reference (AO EXT REF) pin on the I/O connector. This signal applied to EXT REF should be within ±11 V. You do not need to configure both channels for the same mode. So RF_EXTERNAL is a valid unit (i.e. in units of the AO EXT REF signal). The next commit will add this unit. [1]: http://digital.ni.com/manuals.nsf/websearch/06115536722DAA558625728E007E6BA4 Edition Date: February 2007 Part Number: 370503K-01 p --- diff --git a/pycomedi/range.pyx b/pycomedi/range.pyx index 6c05cde..c3e196a 100644 --- a/pycomedi/range.pyx +++ b/pycomedi/range.pyx @@ -46,10 +46,6 @@ cdef class Range (_BitwiseOperator): >>> r.unit <_NamedInt mA> """ - # other data gets packed into the unit unsigned int (e.g RF_EXTERNAL) - _uint_all = 0xffffffffL - _unit_all = 0xff - def __cinit__(self): self.value = -1 @@ -71,10 +67,9 @@ cdef class Range (_BitwiseOperator): return self.__str__() def _unit_get(self): - return _constant.UNIT.index_by_value(self.range.unit & self._unit_all) + return _constant.UNIT.index_by_value(self.range.unit) def _unit_set(self, value): - self.range.unit &= self._uint_all - self._unit_all - self.range.unit |= _constant.bitwise_value(value) & self._unit_all + self.range.unit = _constant.bitwise_value(value) unit = property(fget=_unit_get, fset=_unit_set) def _min_get(self):