Skip to content

Commit d7c8ff5

Browse files
author
neil.hamilton
committed
Add API functions to ps5000.py
1 parent c94e62d commit d7c8ff5

File tree

1 file changed

+331
-2
lines changed

1 file changed

+331
-2
lines changed

picosdk/ps5000.py

Lines changed: 331 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,41 @@ def __init__(self):
1919

2020
ps5000 = Ps5000lib()
2121

22+
23+
24+
class PWQ_CONDITIONS (Structure):
25+
_pack = 1
26+
_fields = [("channelA", c_int32),
27+
("channelB", c_int32),
28+
("channelC", c_int32),
29+
("channelD", c_int32),
30+
("external", c_int32),
31+
("aux", c_int32)]
32+
33+
ps5000.PWQ_CONDITIONS = PWQ_CONDITIONS
34+
35+
class TRIGGER_CONDITIONS (Structure):
36+
_pack = 1
37+
_fields = [("channelA", c_int32),
38+
("channelB", c_int32),
39+
("channelC", c_int32),
40+
("channelD", c_int32),
41+
("external", c_int32),
42+
("aux", c_int32),
43+
("pulseWidthQualifier", c_int32)]
44+
45+
ps5000.TRIGGER_CONDITIONS = TRIGGER_CONDITIONS
46+
47+
class TRIGGER_CHANNEL_PROPERTIES (Structure):
48+
_pack = 1
49+
_fields = [("thresholdMajor", c_int16),
50+
("thresholdMinor", c_int16),
51+
("hysteresis", c_uint16),
52+
("channel", c_int32),
53+
("thresholdMode", c_int32)]
54+
55+
ps5000.TRIGGER_CHANNEL_PROPERTIES = TRIGGER_CHANNEL_PROPERTIES
56+
2257
doc = """ PICO_STATUS ps5000CloseUnit
2358
(
2459
short handle
@@ -45,7 +80,7 @@ def __init__(self):
4580
doc = """ PICO_STATUS ps5000GetStreamingLatestValues
4681
(
4782
short handle,
48-
ps5000StreamignReady lpPs5000Ready,
83+
ps5000StreamingReady lpPs5000Ready,
4984
void *pParameter
5085
); """
5186
ps5000.make_symbol("_GetStreamingLatestValues", "ps5000GetStreamingLatestValues", c_uint16, [c_int16, c_void_p, c_void_p], doc)
@@ -124,4 +159,298 @@ def __init__(self):
124159
unsigned short toSegmentIndex,
125160
short *overflow
126161
); """
127-
ps5000.make_symbol("_GetValuesBulk", "ps5000GetValuesBulk", c_uint32, [c_int16, c_void_p, c_uint16, c_uint16, c_void_p], doc)
162+
ps5000.make_symbol("_GetValuesBulk", "ps5000GetValuesBulk", c_uint32, [c_int16, c_void_p, c_uint16, c_uint16, c_void_p], doc)
163+
164+
doc = """ PICO_STATUS ps5000GetTriggerTimeOffsetBulk
165+
(
166+
short handle,
167+
unsigned long *timesUpper,
168+
unsigned long *timesLower,
169+
PS5000_TIME_UNITS *timeUnits,
170+
unsigned short fromSegmentIndex,
171+
unsigned short toSegmentIndex
172+
); """
173+
ps5000.make_symbol("_GetTriggerTimeOffsetBulk", "ps5000GetTriggerTimeOffsetBulk", c_uint32, [c_int16, c_void_p, c_void_p, c_void_p, c_uint16, c_uint16], doc)
174+
175+
doc = """ PICO_STATUS ps5000GetTriggerTimeOffsetBulk64
176+
(
177+
short handle,
178+
_int64 *times,
179+
PS5000_TIME_UNITS *timeUnits,
180+
unsigned short fromSegmentIndex,
181+
unsigned short toSegmentIndex
182+
); """
183+
ps5000.make_symbol("_GetTriggerTimeOffsetBulk64", "ps5000GetTriggerTimeOffsetBulk64", c_uint32, [c_int16, c_void_p, c_void_p, c_uint16, c_int16], doc)
184+
185+
doc = """ PICO_STATUS ps5000IsLedFlashing
186+
(
187+
short handle,
188+
short *status
189+
); """
190+
ps5000.make_symbol("_IsLedFlashing", "ps5000IsLedFlashing", c_uint32, [c_int16, c_void_p], doc)
191+
192+
doc = """ PICO_STATUS ps5000IsReady
193+
(
194+
short handle,
195+
short *ready
196+
); """
197+
ps5000.make_symbol("_IsReady", "ps5000IsReady", c_uint32, [c_int16, c_void_p], doc)
198+
199+
doc = """ PICO_STATUS ps5000IsTriggerOrPulseWidthQualifierEnabled
200+
(
201+
short handle,
202+
short *triggerEnabled,
203+
short *pulseWidthQualifierEnabled
204+
); """
205+
ps5000.make_symbol("_IsTriggerOrPulseWidthQualifierEnabled", "ps5000IsTriggerOrPulseWidthQualifierEnabled", c_uint32, [c_int16, c_void_p, c_void_p], doc)
206+
207+
doc = """ PICO_STATUS ps5000MemorySegments
208+
(
209+
short handle,
210+
unsigned short nSegments,
211+
long *nMaxSamples
212+
); """
213+
ps5000.make_symbol("_MemorySegments", "ps5000MemorySegments", c_uint32, [c_int16, c_uint16, c_void_p], doc)
214+
215+
doc = """ PICO_STATUS ps5000NoOfStreamingValues
216+
(
217+
short handle,
218+
unsigned long *noOfValues
219+
); """
220+
ps5000.make_symbol("_NoOfStreamingValues", "ps5000NoOfStreamingValues", c_uint32, [c_int16, c_void_p], doc)
221+
222+
doc = """ PICO_STATUS ps5000OpenUnit
223+
(
224+
short *handle
225+
); """
226+
ps5000.make_symbol("_OpenUnit", "ps5000OpenUnit", c_uint32, [c_void_p], doc)
227+
228+
doc = """ PICO_STATUS ps5000OpenUnitAsync
229+
(
230+
short *status
231+
); """
232+
ps5000.make_symbol("_OpenUnitAsync", "ps5000OpenUnitAsync", c_uint32, [c_void_p], doc)
233+
234+
doc = """ PICO_STATUS ps5000OpenUnitProgress
235+
(
236+
short *handle,
237+
short *progressPercent,
238+
short *complete
239+
); """
240+
ps5000.make_symbol("_OpenUnitProgress", "ps5000OpenUnitProgress", c_uint32, [c_void_p, c_void_p, c_void_p], doc)
241+
242+
doc = """ PICO_STATUS ps5000RunBlock
243+
(
244+
short handle,
245+
long noOfPreTriggerSamples,
246+
long noOfPostTriggerSamples,
247+
unsigned long timebase,
248+
short oversample,
249+
long *timeIndisposedMs,
250+
unsigned short segmentIndex,
251+
ps5000BlockReady lpReady,
252+
void *pParameter
253+
); """
254+
ps5000.make_symbol("_RunBlock", "ps5000RunBlock", c_uint32, [c_int16, c_int32, c_int32, c_uint32, c_int16, c_void_p, c_uint16, c_void_p, c_void_p], doc)
255+
256+
doc = """ PICO_STATUS ps5000RunStreaming
257+
(
258+
short handle,
259+
unsigned long *sampleInterval,
260+
PS5000_TIME_UNITS sampleIntervalTimeUnits,
261+
unsigned long maxPreTriggerSamples,
262+
unsigned long maxPostTriggerSamples,
263+
short autoStop,
264+
unsigned long downSampleRatio,
265+
unsigned long overviewBufferSize
266+
); """
267+
ps5000.make_symbol("_RunStreaming", "ps5000RunStreaming", c_uint32, [c_int16, c_void_p, c_int32, c_uint32, c_uint32, c_int16, c_uint32, c_uint32], doc)
268+
269+
doc = """ PICO_STATUS ps5000SetChannel
270+
(
271+
short handle,
272+
PS5000_CHANNEL channel,
273+
short enabled,
274+
short dc,
275+
PS5000_RANGE range
276+
); """
277+
ps5000.make_symbol("_SetChannel", "ps5000SetChannel", c_uint32, [c_int16, c_int32, c_int16, c_int16, c_int32], doc)
278+
279+
doc = """ PICO_STATUS ps5000SetDataBuffer
280+
(
281+
short handle,
282+
PS5000_CHANNEL channel,
283+
short *buffer,
284+
long buggerLth
285+
); """
286+
ps5000.make_symbol("_SetDataBuffer", "ps5000SetDataBuffer", c_uint32, [c_int16, c_int32, c_void_p, c_int32], doc)
287+
288+
doc = """ PICO_STATUS ps5000SetDataBufferBulk
289+
(
290+
short handle,
291+
PS5000_CHANNEL channel,
292+
short *buffer,
293+
long bufferLth,
294+
unsigned short waveform
295+
); """
296+
ps5000.make_symbol("_SetDataBufferBulk", "ps5000SetDataBufferBulk", c_uint32, [c_int16, c_int32, c_void_p, c_int32, c_uint16], doc)
297+
298+
doc = """ PICO_STATUS ps5000SetDataBuffers
299+
(
300+
short handle,
301+
PS5000_CHANNEL channel,
302+
short *bufferMax,
303+
short *bufferMin,
304+
long bufferLth
305+
); """
306+
ps5000.make_symbol("_SetDataBuffers", "ps5000SetDataBuffers", c_uint32, [c_int16, c_int32, c_void_p, c_void_p, c_int32], doc)
307+
308+
doc = """ PICO_STATUS ps5000SetEts
309+
(
310+
short handle,
311+
PS5000_ETS_MODE mode,
312+
short etsCycles,
313+
short etsInterleave,
314+
long *sampleTimePicoseconds
315+
); """
316+
ps5000.make_symbol("_SetEts", "ps5000SetEts", c_uint32, [c_int16, c_int32, c_int16, c_int16, c_void_p], doc)
317+
318+
doc = """ PICO_STATUS ps5000SetEtsTimeBuffer
319+
(
320+
short handle,
321+
_int64 *buffer,
322+
long bufferLth
323+
); """
324+
ps5000.make_symbol("_SetEtsTimeBuffer", "ps5000SetEtsTimeBuffer", c_uint32, [c_int16, c_void_p, c_int32], doc)
325+
326+
doc = """ PICO_STATUS ps5000SetEtsTimeBuffers
327+
(
328+
short handle,
329+
unsigned long *timeUpper,
330+
unsigned long *timeLower,
331+
long bufferLth
332+
); """
333+
ps5000.make_symbol("_SetEtsTimeBuffers", "ps5000SetEtsTimeBuffers", c_uint32, [c_int16, c_void_p, c_void_p, c_int32], doc)
334+
335+
doc = """ PICO_STATUS ps5000SetNoOfCaptures
336+
(
337+
short handle,
338+
unsigned short nCaptures
339+
); """
340+
ps5000.make_symbol("_SetNoOfCaptures", "ps5000SetNoOfCaptures", c_uint32, [c_int16, c_uint16], doc)
341+
342+
doc = """ PICO_STATUS ps5000SetPulseWidthQualifier
343+
(
344+
short handle,
345+
struct PWQ_CONDITIONS *conditions,
346+
short nConditions,
347+
THRESHOLD_DIRECTION direction,
348+
unsigned long lower,
349+
unsigned long upper,
350+
PULSE_WIDTH_TYPE type
351+
); """
352+
ps5000.make_symbol("_SetPulseWidthQualifier", "ps5000SetPulseWidthQualifier", c_uint32, [c_int16, c_void_p, c_int16, c_int32, c_uint32, c_uint32, c_int32], doc)
353+
354+
doc = """ PICO_STATUS ps5000SetSigGenArbitary
355+
(
356+
short handle,
357+
long offsetVoltage,
358+
unsigned long pkToPk,
359+
unsigned long startDeltaPhase,
360+
unsigned long stopDeltaPhase,
361+
unsigned long deltaPhaseIncrement,
362+
unsigned long dwellCount,
363+
short *arbitaryWaveform
364+
long arbitaryWaveformSize,
365+
SWEEP_TYPE sweepType,
366+
short whiteNoise,
367+
INDEX_MODE indexMode,
368+
unsigned long shots,
369+
unsigned long sweeps,
370+
SIGGEN_TRIG_TYPE triggerType,
371+
SIGGEN_TRIG_SOURCE triggerSource,
372+
short extInThreshold
373+
); """
374+
ps5000.make_symbol("_SetSigGenArbitary", "ps5000SetSigGenArbitary", c_uint32, [c_int16, c_int32, c_uint32, c_uint32, c_uint32, c_uint32, c_uint32, c_void_p, c_int32, c_int32, c_int16, c_int32, c_uint32, c_uint32, c_int32, c_int32, c_int16], doc)
375+
376+
doc = """ PICO_STATUS ps5000SetSigGenBuiltIn
377+
(
378+
short handle,
379+
long offsetVoltage,
380+
unsigned long pkToPk,
381+
short waveType,
382+
float startFrequency,
383+
float stopFrequency,
384+
float increment,
385+
float dwellTime,
386+
SWEEP_TYPE sweepType,
387+
short whiteNoise,
388+
unsigned long shots,
389+
unsigned long sweeps,
390+
SIGGEN_TRIG_TYPE triggerType,
391+
SIGGEN_TRIG_SOURCE triggerSource,
392+
short extInThreshold
393+
); """
394+
ps5000.make_symbol("_SetSigGenBuiltIn", "ps5000SetSigGenBuiltIn", c_uint32, [c_int16, c_int32, c_uint32, c_int16, c_int64, c_int64, c_int64, c_int64, c_int64, c_int32, c_int16, c_uint32, c_uint32, c_int32, c_int32, c_int16], doc)
395+
396+
doc = """ PICO_STATUS ps5000SetSimpleTrigger
397+
(
398+
short handle,
399+
short enable,
400+
PS5000_CHANNEL source,
401+
short threshold,
402+
THRESHOLD_DIRECTION direction,
403+
unsigned long delay,
404+
short autoTrigger_ms
405+
); """
406+
ps5000.make_symbol("_SetSimpleTrigger", "ps5000SetSimpleTrigger", c_uint32, [c_int16, c_int16, c_int32, c_int16 c_int32, c_uint32, c_int16], doc)
407+
408+
doc = """ PICO_STATUS ps5000SetTriggerChannelConditions
409+
(
410+
short handle,
411+
struct TRIGGER_CONDITIONS *conditions,
412+
short nConditions
413+
); """
414+
ps5000.make_symbol("_SetTriggerChannelConditions", "ps5000SetTriggerChannelConditions", c_uint32, [c_int16, c_void_p, c_int16], doc)
415+
416+
doc = """ PICO_STATUS ps5000SetTriggerChannelDirections
417+
(
418+
short handle,
419+
THRESHOLD_DIRECTION channelA,
420+
THRESHOLD_DIRECTION channelB,
421+
THRESHOLD_DIRECTION channelC,
422+
THRESHOLD_DIRECTION channelD,
423+
THRESHOLD_DIRECTION ext,
424+
THRESHOLD_DIRECTION aux
425+
); """
426+
ps5000.make_symbol("_SetTriggerChannelDirections", "ps5000SetTriggerChannelDirections", c_uint32, [c_int16, c_int32, c_int32, c_int32, c_int32, c_int32, c_int32], doc)
427+
428+
doc = """ PICO_STATUS ps5000SetTriggerChannelProperties
429+
(
430+
short handle,
431+
struct TRIGGER_CHANNEL_PROPERTIES *channelProperties,
432+
short nChannelProperties,
433+
short auxOutputEnable,
434+
long autoTriggerMilliseconds
435+
); """
436+
ps5000.make_symbol("_SetTriggerChannelProperties", "ps5000SetTriggerChannelProperties", c_uint32, [c_int16, c_void_p, c_int16, c_int16, c_int32], doc)
437+
438+
doc = """ PICO_STATUS ps5000SetTriggerDelay
439+
(
440+
short handle,
441+
unsigned long delay
442+
); """
443+
ps5000.make_symbol("_SetTriggerDelay", "ps5000SetTriggerDelay", c_uint32, [c_int16, c_uint32], doc)
444+
445+
doc = """ PICO_STATUS ps5000SigGenSoftwareControl
446+
(
447+
short handle,
448+
short state
449+
); """
450+
ps5000.make_symbol("_SigGenSoftwareControl", "ps5000SigGenSoftwareControl", c_uint32, [c_int16, c_int16], doc)
451+
452+
doc = """ PICO_STATUS ps5000Stop
453+
(
454+
short handle
455+
); """
456+
ps5000.make_symbol("_Stop", "ps5000Stop", c_uint32, [c_int16], doc)

0 commit comments

Comments
 (0)