forked from M-Labs/artiq
1
0
Fork 0

edge_counter: restore keyword arguments

This commit is contained in:
Sebastien Bourdeauducq 2022-02-26 17:41:48 +08:00
parent 7b02918a43
commit bea7e952fa
1 changed files with 11 additions and 12 deletions

View File

@ -139,38 +139,37 @@ class EdgeCounter:
""" """
return self.gate_both_mu(self.core.seconds_to_mu(duration)) return self.gate_both_mu(self.core.seconds_to_mu(duration))
# NAC3TODO: restore keyword arguments in calls (https://git.m-labs.hk/M-Labs/nac3/issues/199)
@kernel @kernel
def gate_rising_mu(self, duration_mu: int64) -> int64: def gate_rising_mu(self, duration_mu: int64) -> int64:
"""See :meth:`gate_rising`.""" """See :meth:`gate_rising`."""
return self._gate_mu( return self._gate_mu(
duration_mu, True, False) duration_mu, count_rising=True, count_falling=False)
@kernel @kernel
def gate_falling_mu(self, duration_mu: int64) -> int64: def gate_falling_mu(self, duration_mu: int64) -> int64:
"""See :meth:`gate_falling`.""" """See :meth:`gate_falling`."""
return self._gate_mu( return self._gate_mu(
duration_mu, False, True) duration_mu, count_rising=False, count_falling=True)
@kernel @kernel
def gate_both_mu(self, duration_mu: int64) -> int64: def gate_both_mu(self, duration_mu: int64) -> int64:
"""See :meth:`gate_both_mu`.""" """See :meth:`gate_both_mu`."""
return self._gate_mu( return self._gate_mu(
duration_mu, True, True) duration_mu, count_rising=True, count_falling=True)
@kernel @kernel
def _gate_mu(self, duration_mu: int64, count_rising: bool, count_falling: bool) -> int64: def _gate_mu(self, duration_mu: int64, count_rising: bool, count_falling: bool) -> int64:
self.set_config( self.set_config(
count_rising, count_rising=count_rising,
count_falling, count_falling=count_falling,
False, send_count_event=False,
True) reset_to_zero=True)
delay_mu(duration_mu) delay_mu(duration_mu)
self.set_config( self.set_config(
False, count_rising=False,
False, count_falling=False,
True, send_count_event=True,
False) reset_to_zero=False)
return now_mu() return now_mu()
@kernel @kernel