forked from flowswitch/ht4032l-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
38 lines (30 loc) · 730 Bytes
/
test.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""Acquisition example"""
import sys
from HT4032L import LA
la = LA()
print "Using", la.driver.name
la.open()
print "Reset..."
la.Reset()
la.SetThresholdA(3.3/2)
la.SetThresholdB(3.3/2)
la.config.SampleRate = 0x1B # 2KS/s
la.config.SampleDepth = 2048
la.config.EnableTrigger1 = 0
la.config.EnableTrigger2 = 0
la.config.Trigger1.EdgeSignal = 0 # A0
la.config.Trigger1.EdgeType = 0 # posedge
print "Start..."
la.Start()
print "Poll..."
prev_status = -1
while la.status[2]!=2: # not DONE
la.Poll()
if prev_status!=la.status[2]:
print "\n", la.status[2]
prev_status = la.status[2]
sys.stdout.write("\r%08X" % (la.status[1]))
print "\nGetting data..."
data = la.GetData()
la.close()
print "Got %d samples" % (len(data))