summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <axilirator@gmail.com>2017-12-09 01:22:24 +0700
committerVadim Yanitskiy <axilirator@gmail.com>2017-12-09 01:22:24 +0700
commit05ff6b06674dd3b9c310e3b27e5bad821cd6d41c (patch)
tree41d0097322d22b2cf3a1c86951323ded20aa4e75
parent8ed6f42772f3002bfa1b8ef8772b138e8cddd443 (diff)
fake_trx/clck_gen.py: send the first indication immediately
-rwxr-xr-xsrc/target/fake_trx/clck_gen.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/target/fake_trx/clck_gen.py b/src/target/fake_trx/clck_gen.py
index 85dc00e0..1eb970a5 100755
--- a/src/target/fake_trx/clck_gen.py
+++ b/src/target/fake_trx/clck_gen.py
@@ -45,6 +45,9 @@ class CLCKGen:
# Average loop back delay
LO_DELAY_US = 90.0
+ # State variables
+ timer = None
+
def __init__(self, clck_links, clck_start = 0, ind_period = 102):
self.clck_links = clck_links
self.ind_period = ind_period
@@ -55,15 +58,15 @@ class CLCKGen:
self.ctr_interval /= self.SEC_DELAY_US
self.ctr_interval *= self.ind_period
- # Create a timer manager
- self.timer = Timer(self.ctr_interval, self.send_clck_ind)
-
def start(self):
- # Schedule the first indication
- self.timer.start()
+ # Send the first indication
+ self.send_clck_ind()
def stop(self):
- self.timer.cancel()
+ # Stop pending timer
+ if self.timer is not None:
+ self.timer.cancel()
+ self.timer = None
def send_clck_ind(self):
# Keep clock cycle