Update notebook, add frequency meter
This commit is contained in:
parent
6fc8f23691
commit
2bb9aecfc6
2 changed files with 2198 additions and 82 deletions
|
|
@ -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
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue