summaryrefslogtreecommitdiff
path: root/prototype/fw
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-03-25 12:15:38 +0100
committerjaseg <git@jaseg.de>2021-03-25 12:15:38 +0100
commit2bb9aecfc62cb597155f50b6bf22131ab33cb301 (patch)
treeac7d5fd93cf0f22ecf29db69e423e98fdfbe2273 /prototype/fw
parent6fc8f236916c10811b8611f46edea4f3be2118b3 (diff)
downloadihsm-2bb9aecfc62cb597155f50b6bf22131ab33cb301.tar.gz
ihsm-2bb9aecfc62cb597155f50b6bf22131ab33cb301.tar.bz2
ihsm-2bb9aecfc62cb597155f50b6bf22131ab33cb301.zip
Update notebook, add frequency meter
Diffstat (limited to 'prototype/fw')
-rw-r--r--prototype/fw/freqmeter.py6
1 files changed, 3 insertions, 3 deletions
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