Skip to content

Commit e018b5a

Browse files
author
neil.hamilton
committed
Add additional enums to ps4000a.py
1 parent 36348ed commit e018b5a

File tree

1 file changed

+46
-1
lines changed

1 file changed

+46
-1
lines changed

picosdk/ps4000a.py

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from ctypes import *
1111
from picosdk.library import Library
1212
from picosdk.constants import make_enum
13-
13+
from picosdk.ctypes_wrapper import C_CALLBACK_FUNCTION_FACTORY
1414

1515
class Ps4000alib(Library):
1616
def __init__(self):
@@ -188,6 +188,24 @@ def process_enum(enum):
188188

189189
ps4000a.PICO_VOLTAGE_RANGE = process_enum(ps4000a.PICO_CONNECT_PROBE_RANGE)
190190

191+
ps4000a.PS4000A_RATIO_MODE = {
192+
'PS4000A_RATIO_MODE_NONE': 0,
193+
'PS4000A_RATIO_MODE_AGGREGATE': 1,
194+
'PS4000A_RATIO_MODE_DECIMATE': 2,
195+
'PS4000A_RATIO_MODE_AVERAGE': 4,
196+
}
197+
198+
ps4000a.PICO_RATIO_MODE = {k[19:]: v for k, v in ps4000a.PS4000A_RATIO_MODE.items()}
199+
200+
ps4000a.PS4000A_TIME_UNITS = make_enum([
201+
'PS4000A_FS',
202+
'PS4000A_PS',
203+
'PS4000A_NS',
204+
'PS4000A_US',
205+
'PS4000A_MS',
206+
'PS4000A_S',
207+
'PS4000A_MAX_TIME_UNITS',
208+
])
191209

192210
doc = """ PICO_STATUS ps4000aOpenUnit
193211
(
@@ -648,6 +666,33 @@ def process_enum(enum):
648666
ps4000a.make_symbol("_GetStreamingLatestValues", "ps4000aGetStreamingLatestValues", c_uint32,
649667
[c_int16, c_void_p, c_void_p], doc)
650668

669+
doc = """ void *ps4000aStreamingReady
670+
(
671+
int16_t handle,
672+
int32_t noOfSamples,
673+
uint32_t startIndex,
674+
int16_t overflow,
675+
uint32_t triggerAt,
676+
int16_t triggered,
677+
int16_t autoStop,
678+
void *pParameter
679+
);
680+
define a python function which accepts the correct arguments, and pass it to the constructor of this type.
681+
"""
682+
683+
ps4000a.StreamingReadyType = C_CALLBACK_FUNCTION_FACTORY(None,
684+
c_int16,
685+
c_int32,
686+
c_uint32,
687+
c_int16,
688+
c_uint32,
689+
c_int16,
690+
c_int16,
691+
c_void_p)
692+
693+
ps4000a.StreamingReadyType.__doc__ = doc
694+
695+
651696
doc = """ PICO_STATUS ps4000aNoOfStreamingValues
652697
(
653698
int16_t handle,

0 commit comments

Comments
 (0)