Skip to content
This repository has been archived by the owner on Oct 14, 2022. It is now read-only.

Commit

Permalink
Merge vettel.quartiq.de:src/ptb-drivers
Browse files Browse the repository at this point in the history
* vettel.quartiq.de:src/ptb-drivers:
  synth: add setter/getter
  increase output power
  • Loading branch information
jordens committed Dec 13, 2018
2 parents 1733071 + a840f5e commit bec7be3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
23 changes: 23 additions & 0 deletions ptb/synth_protocol.py
Expand Up @@ -25,6 +25,24 @@ async def read(self, n):
ret = await self._read(n)
return ret.decode()

def set(self, **kwargs):
"""Configure synthesizer settings.
See datasheet and :class:`ADF4350` for fields and values.
This does not update the synthesizer settings or registers.
This method only sets instance attributes that affect the
calculation of register values during :meth:`set_frequency`.
"""
for k, v in kwargs.items():
if not hasattr(self, k):
raise ValueError("No such field `{}`".format(k))
setattr(self, k, v)

def get(self, key):
"""Get a synthesizer configuration setting (instance attribute)."""
return getattr(self, key)

async def version(self):
"""Return the hardware/firmware version.
Expand Down Expand Up @@ -73,6 +91,11 @@ async def save(self, regs=None):
raise ValueError("save failed", ret)

async def locked(self):
"""Return the reference lock status.
Returns:
bool: True if locked
"""
return not "not" in await self.ask("locked")

def _writeline(self, cmd):
Expand Down
2 changes: 1 addition & 1 deletion test_synth.py
Expand Up @@ -47,7 +47,7 @@ async def run():
dev.ref_div2_en = False
dev.ref_doubler_en = False
dev.mute_till_lock_en = True
dev.output_power = 0
dev.output_power = 3
dev.set_frequency([3.07e9, 5.257e9/2, 14.748e9/6, 2.105e9][i])
await dev.start()
print(await dev.locked())
Expand Down

0 comments on commit bec7be3

Please sign in to comment.