forked from M-Labs/artiq
1
0
Fork 0

cleanup and comments

This commit is contained in:
SingularitySurfer 2022-06-15 17:32:11 +00:00
parent b0f9fd9c4c
commit 1bddadc6e2
1 changed files with 10 additions and 3 deletions

View File

@ -1073,7 +1073,7 @@ class PhaserChannel:
def set_servo_profile(self, profile):
"""Set the servo profile.
:param profile: [0:3] profile index to select for channel
:param profile: profile index to select for channel (0 to 3)
"""
if profile not in range(4):
raise ValueError("invalid profile index")
@ -1086,11 +1086,17 @@ class PhaserChannel:
@kernel
def load_servo_profile(self, profile, ab, offset):
"""Set the servo enable to True or False.
"""Load a servo profile consiting of the three filter coefficients and an output offset.
:param profile: profile to load (0 to 3)
:param ab: 3 entry coefficient vector (16 bit)
:param offset: output offset (16 bit)
"""
if profile not in range(4):
raise ValueError("invalid profile index")
# Should I check here if the profile I want to load is selected? What do I do if it is?
if len(ab) != 3:
raise ValueError("invalid number of coefficients")
# Should I check here if the profile I want to load is selected? Aka read the register. What do I do if it is?
addr = PHASER_ADDR_SERVO_AB_BASE + (6 * profile) + (self.index * 24)
for coef in ab:
self.phaser.write16(addr, coef)
@ -1098,6 +1104,7 @@ class PhaserChannel:
addr = PHASER_ADDR_SERVO_OFFSET_BASE + (2 * profile) + (self.index * 8)
self.phaser.write16(addr, offset)
class PhaserOscillator:
"""Phaser IQ channel oscillator (NCO/DDS).