From 2bb9aecfc62cb597155f50b6bf22131ab33cb301 Mon Sep 17 00:00:00 2001
From: jaseg <git@jaseg.de>
Date: Thu, 25 Mar 2021 12:15:38 +0100
Subject: Update notebook, add frequency meter

---
 prototype/fw/freqmeter.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'prototype/fw')

diff --git a/prototype/fw/freqmeter.py b/prototype/fw/freqmeter.py
index 54c1655..430b73f 100644
--- a/prototype/fw/freqmeter.py
+++ b/prototype/fw/freqmeter.py
@@ -12,11 +12,11 @@ count = lambda le_iter: sum(1 for _ in le_iter)
 
 DEFAULT_SAMPLING_RATE = 1e6 # sps
 
-def sigrok_capture(duration:'seconds'=1, sampling_rate=DEFAULT_SAMPLING_RATE, driver='dreamsourcelab-dslogic', config=None, channel=0):
+def sigrok_capture(duration:'milliseconds', sampling_rate=DEFAULT_SAMPLING_RATE, driver='dreamsourcelab-dslogic', config=None, channel=0):
 
     proc = subprocess.run(['sigrok-cli',
         '--driver', driver,
-        '--time', f'{duration}s',
+        '--time', f'{duration}ms',
         '--config', (f'{config},' if config else '') + f'samplerate={int(sampling_rate/1e3)}k',
         '--channels', str(channel),
         '--output-format', 'csv'], check=True, stdout=subprocess.PIPE)
@@ -54,7 +54,7 @@ def calc_frequency(intervals, sampling_rate=DEFAULT_SAMPLING_RATE):
 
 if __name__ == '__main__':
     while True:
-        capture = sigrok_capture()
+        capture = sigrok_capture(1500)
         intervals = list(debounce(capture))
 
         intervals = intervals[2:-1] # ignore partial first and last intervals
-- 
cgit