lda: add support for ping

This commit is contained in:
Yann Sionneau 2015-02-26 12:53:54 +01:00 committed by Sebastien Bourdeauducq
parent d51493fb5d
commit b672a99174
1 changed files with 10 additions and 0 deletions

View File

@ -63,6 +63,9 @@ class Ldasim:
print("setting attenuation to {}".format(att)) print("setting attenuation to {}".format(att))
self._attenuation = att self._attenuation = att
def ping(self):
return True
class Lda: class Lda:
"""Lab Brick Digital Attenuator driver. """Lab Brick Digital Attenuator driver.
@ -230,3 +233,10 @@ class Lda:
raise ValueError("Cannot set attenuation {} < 0".format(att)) raise ValueError("Cannot set attenuation {} < 0".format(att))
else: else:
self.set(0x8d, bytes([int(round(att.amount*4))])) self.set(0x8d, bytes([int(round(att.amount*4))]))
def ping(self):
try:
self.get_attenuation()
except:
return False
return True