Skip to content

Commit c94e62d

Browse files
author
neil.hamilton
committed
Create ps5000.py
1 parent d961dbe commit c94e62d

File tree

1 file changed

+127
-0
lines changed

1 file changed

+127
-0
lines changed

picosdk/ps5000.py

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
#
2+
# Copyright (C) 2019 Pico Technology Ltd. See LICENSE file for terms.
3+
#
4+
"""
5+
This is a Python module defining the functions from the ps5000Api.h C header
6+
file for PicoScope 5000 Series oscilloscopes using the ps5000 driver API
7+
functions.
8+
"""
9+
10+
from ctypes import *
11+
from picosdk.ctypes_wrapper import C_CALLBACK_FUNCTION_FACTORY
12+
from picosdk.library import Library
13+
from picosdk.constants import make_enum
14+
15+
class Ps5000lib(Library):
16+
def __init__(self):
17+
super(Ps5000lib, self).__init__("ps5000")
18+
19+
20+
ps5000 = Ps5000lib()
21+
22+
doc = """ PICO_STATUS ps5000CloseUnit
23+
(
24+
short handle
25+
); """
26+
ps5000.make_symbol("_CloseUnit", "ps5000CloseUnit", c_uint32, [c_int16], doc)
27+
28+
doc = """ PICO_STATUS ps5000FlashLed
29+
(
30+
short handle,
31+
short start
32+
); """
33+
ps5000.make_symbol("_FlashLed", "ps5000FlashLed", c_uint32, [c_int16, c_int16], doc)
34+
35+
doc = """ PICO_STATUS ps5000GetMaxDownSampleRatio
36+
(
37+
short handle,
38+
unsigned long noOfUnaggregatedSamples,
39+
unsigned long *maxDownSampleRatio,
40+
short downSampleRatioMode,
41+
unsigned short segmentIndex
42+
); """
43+
ps5000.make_symbol("_GetMaxDownSampleRatio", "ps5000GetMaxDownSampleRatio", c_uint32, [c_int16, c_uint32, c_void_p, c_int16, c_uint16], doc)
44+
45+
doc = """ PICO_STATUS ps5000GetStreamingLatestValues
46+
(
47+
short handle,
48+
ps5000StreamignReady lpPs5000Ready,
49+
void *pParameter
50+
); """
51+
ps5000.make_symbol("_GetStreamingLatestValues", "ps5000GetStreamingLatestValues", c_uint16, [c_int16, c_void_p, c_void_p], doc)
52+
53+
doc = """ PICO_STATUS ps5000GetTimebase
54+
(
55+
short handle,
56+
unsigned long timebase,
57+
long noSamples,
58+
long *timeIntervalNanoseconds,
59+
short oversample,
60+
long *maxSamples,
61+
unsigned short segmentIndex
62+
); """
63+
ps.make_symbol("_GetTimebase", "ps5000GetTimebase", c_uint16, [c_int16, c_uint32, c_int32, c_void_p, c_int16, c_void_p, c_uint16], doc)
64+
65+
doc = """ PICO_STATUS ps5000GetTriggerTimeOffset
66+
(
67+
short handle,
68+
unsigned long *timeUpper,
69+
unsigned long *timeLower,
70+
PS5000_TIME_UNITS *timeUnits,
71+
unsigned short segmentIndex
72+
); """
73+
ps.make_symbol("_GetTriggerTimeOffset", "ps5000GetTriggerTimeOffset", c_uint16, [c_int16, c_void_p, c_void_p, c_void_p, c_uint16], doc)
74+
75+
doc = """ PICO_STATUS ps5000GetTriggerTimeOffset64
76+
(
77+
short handle,
78+
int64_t *time,
79+
PS5000_TIME_UNITS *timeUnits,
80+
unsigned short segmentIndex
81+
); """
82+
ps.make_symbol("_GetTriggerTimeOffset64", "ps5000GetTriggerTimeOffset64", c_uint32, [c_int16, c_void_p, c_void_p, c_uint16], doc)
83+
84+
doc = """ PICO_STATUS ps5000GetUnitInfo
85+
(
86+
short handle,
87+
char *string,
88+
short stringLength,
89+
short *requiredSize,
90+
PICO_INFO info
91+
); """
92+
ps.make_symbol("_GetUnitInfo", "ps5000GetUnitInfo", c_uint32, [c_int16, c_void_p, c_int16, c_void_p, c_uint32], doc)
93+
94+
doc = """ PICO_STATUS ps5000GetValues
95+
(
96+
short handle,
97+
unsigned long startIndex,
98+
unsigned long *noOfSamples,
99+
unsigned long downSampleRatio,
100+
short downSampleRatioMode,
101+
unsigned short segmentIndex,
102+
short *overflow
103+
); """
104+
ps.make_symbol("_GetValues", "ps5000GetValues", c_uint32, [c_int16, c_uint32, c_void_p, c_uint32, c_int16, c_uint16, c_void_p], doc)
105+
106+
doc = """ PICO_STATUS ps5000GetValuesAsync
107+
(
108+
short handle,
109+
unsigned long startIndex,
110+
unsigned long noOfSamples,
111+
unsigned long downSampleRatio,
112+
short downSampleRatioMode,
113+
unsigned short segmentIndex,
114+
void *lpDataReady,
115+
void *pParameter
116+
); """
117+
ps.make_symbol("_GetValuesAsync", "ps5000GetValuesAsync", c_uint32, [c_int16, c_uint32, c_uint32, c_uint32, c_int16, c_uint16, c_void_p, c_void_p], doc)
118+
119+
doc = """ PICO_STATUS ps5000GetValuesBulk
120+
(
121+
short handle,
122+
unsigned long *noOfSamples,
123+
unsigned short fromSegmentIndex,
124+
unsigned short toSegmentIndex,
125+
short *overflow
126+
); """
127+
ps5000.make_symbol("_GetValuesBulk", "ps5000GetValuesBulk", c_uint32, [c_int16, c_void_p, c_uint16, c_uint16, c_void_p], doc)

0 commit comments

Comments
 (0)