Skip to content

Commit

Permalink
Merge pull request #1310 from Emantor/topic/sigrok-example
Browse files Browse the repository at this point in the history
examples: add sigrok example
  • Loading branch information
jluebbe committed Dec 15, 2023
2 parents 116c2b7 + 016d814 commit 3a01d08
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions examples/sigrok/env.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
targets:
main:
resources:
SigrokDevice:
driver: fx2lafw
channels: D1
drivers:
SigrokDriver: {}
23 changes: 23 additions & 0 deletions examples/sigrok/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env python3
"""Capture Channel D1 of an fx2lafw device for 1 second."""

import sys
import time
import logging

from labgrid import Environment

# enable debug logging
logging.basicConfig(
level=logging.DEBUG,
format='%(levelname)7s: %(message)s',
stream=sys.stderr,
)

env = Environment(sys.argv[1])
target = env.get_target('main')

sigrok = target.get_driver("SigrokDriver")
sigrok.capture("test.cap")
time.sleep(1)
sigrok.stop()

0 comments on commit 3a01d08

Please sign in to comment.