def __init__(self, mode=0, fast=0, gain=0, offset=0):
# setup main functionality
super(MuxOTA, self).__init__(fast=fast, gain=gain, offset=offset)
- # remove references to re-defined bits, they are named ".mode" now
- del self.__dict__['cint']
- del self.__dict__['zero']
- del self.__dict__['se']
self.mode = mode
@property
"""Return a dict of settings which can be passed to constructor to
restore the state."""
s = {}
- s['posA'] = self.posA
- s['posB'] = self.posB
- s['gpo1'] = self.gpo1
- s['gpo2'] = self.gpo2
+ s['posA'] = int(self.posA)
+ s['posB'] = int(self.posB)
+ s['gpo1'] = int(self.gpo1)
+ s['gpo2'] = int(self.gpo2)
return s
class DAC8568(object):
# put into official operating mode
#
- dac.swreset()
+ self.swreset()
# reference is tied to ADC, do not power down
- dac.reference(dac.REF_FLEXIBLE_ALWAYS_ON)
+ self.reference(self.REF_FLEXIBLE_ALWAYS_ON)
# CLR is tied high, explicitly ignore anyway
- dac.CCR(dac.IGNORE_CLR)
+ self.CCR(self.IGNORE_CLR)
# power up all channels
- bitfield = 0xff
- dac.power(dac.POWER_ON, bitfield)
+ self.power(self.POWER_ON, 0xff)
# set outputs if we are restoring state
for name, value in (
('vina', vina),
# zero unused outputs
# part A already POR's to 0 but...
for i in range(5, 8):
- dac.setv(i, 0.0)
+ self.setv(i, 0.0)
def _pos2v(self, pos):