17 from __future__
import print_function
18 from libpruio
import *
22 libc = CDLL(
"libc.so.6")
40 if IO.Errr:
raise AssertionError(
"pruio_new failed (%s)" % IO.Errr)
43 raise AssertionError(
"step 9 configuration failed: (%s)" % IO.Errr)
45 raise AssertionError(
"step 10 configuration failed: (%s)" % IO.Errr)
47 raise AssertionError(
"step 11 configuration failed: (%s)" % IO.Errr)
54 half = ((IO.ESize >> 2) // NoStep) * NoStep
56 if half > tInd: half = tInd
58 samp = (half << 1) // NoStep
61 raise AssertionError(
"config failed (%s)" % IO.Errr)
64 raise AssertionError(
"rb_start failed (%s)" % IO.Errr)
67 p0 = IO.Adc.contents.Value
69 p1 = cast(byref(p0.contents, (half << 1)), POINTER(c_ushort))
70 for n
in range(0, NoFile):
73 print(
"Creating file %s" % fName)
75 oFile = libc.fopen(fName,
"wb")
82 rest = tInd + half - i
84 iEnd = rest
if p1 >= p0
else rest + half
85 while IO.DRam[0] < iEnd: time.sleep(0.001)
86 print(
" writing samples %u-%u" % (tInd -rest, tInd-1))
87 libc.fwrite(p0, sizeof(UInt16), rest, oFile)
91 while IO.DRam[0] < half: time.sleep(0.001)
93 while IO.DRam[0] > half: time.sleep(0.001)
94 print(
" writing samples %u-%u" % (i-half, i-1))
95 libc.fwrite(p0, sizeof(UInt16), half, oFile)
98 print(
"Finished file %s" % fName)
char * pruio_config(pruIo *Io, uint32 Samp, uint32 Mask, uint32 Tmr, uint16 Mds)
Wrapper function for PruIo::config().
pruIo * pruio_new(uint16 Act, uint8 Av, uint32 OpD, uint8 SaD)
Wrapper function for the constructor PruIo::PruIo().
char * pruio_adc_setStep(pruIo *Io, uint8 Stp, uint8 ChN, uint8 Av, uint8 SaD, uint32 OpD)
Wrapper function for AdcUdt::setStep().
char * pruio_rb_start(pruIo *Io)
Wrapper function for PruIo::rb_start().
void pruio_destroy(pruIo *Io)
Wrapper function for the destructor PruIo::~PruIo().