Skip to content

Commit 23ab6f7

Browse files
author
neil.hamilton
committed
2 parents c7863d1 + 6a62215 commit 23ab6f7

File tree

6 files changed

+32
-10
lines changed

6 files changed

+32
-10
lines changed

picosdk/PicoDeviceEnums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def _define_channel_flags():
7878
"PICO_PORT_DIGITAL_CHANNEL1",
7979
"PICO_PORT_DIGITAL_CHANNEL2",
8080
"PICO_PORT_DIGITAL_CHANNEL3",
81-
"PICO_PORT_DIGITAL_CHANNEL4"
81+
"PICO_PORT_DIGITAL_CHANNEL4",
8282
"PICO_PORT_DIGITAL_CHANNEL5",
8383
"PICO_PORT_DIGITAL_CHANNEL6",
8484
"PICO_PORT_DIGITAL_CHANNEL7",

picosdk/device.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def capture_block(self, timebase_options, channel_configs=()):
201201
# always force the number of memory segments on the device to 1 before computing timebases for a one-off
202202
# block capture.
203203
max_samples_possible = self.driver.memory_segments(self, USE_SEGMENT_ID+1)
204-
if timebase_options.no_of_samples is not None and timebase_options.no_of_samples > max_samples_possible:
204+
if timebase_options.no_of_samples is not None and timebase_options.no_of_samples > max_samples_possible.value:
205205
raise NoValidTimebaseForOptionsError()
206206
except DeviceCannotSegmentMemoryError:
207207
pass

picosdk/library.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,20 @@ def __init__(self, name):
6666
def _load(self):
6767
library_path = find_library(self.name)
6868

69-
if library_path is None:
70-
env_var_name = "PATH" if sys.platform == 'win32' else "LD_LIBRARY_PATH"
71-
raise CannotFindPicoSDKError("PicoSDK (%s) not found, check %s" % (self.name, env_var_name))
69+
# 'find_library' fails in Cygwin.
70+
if not sys.platform == 'cygwin':
71+
if library_path is None:
72+
env_var_name = "PATH" if sys.platform == 'win32' else "LD_LIBRARY_PATH"
73+
raise CannotFindPicoSDKError("PicoSDK (%s) not found, check %s" % (self.name, env_var_name))
7274

7375
try:
7476
if sys.platform == 'win32':
7577
from ctypes import WinDLL
7678
result = WinDLL(library_path)
79+
elif sys.platform == 'cygwin':
80+
from ctypes import CDLL
81+
library_path = self.name
82+
result = CDLL(library_path + ".dll")
7783
else:
7884
from ctypes import cdll
7985
result = cdll.LoadLibrary(library_path)

picosdk/ps3000a.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def _define_digital_port():
153153
"PS3000A_ABOVE_LOWER",
154154
"PS3000A_BELOW_LOWER",
155155
"PS3000A_RISING_LOWER",
156-
"PS3000A_FALLING_LOWER"
156+
"PS3000A_FALLING_LOWER",
157157
"PS3000A_POSITIVE_RUNT",
158158
"PS3000A_NEGATIVE_RUNT"
159159
])

picosdk/ps6000.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,6 +649,22 @@ class PS6000_TRIGGER_INFO (Structure):
649649
c_void_p)
650650
ps6000.BlockReadyType.__doc__ = doc
651651

652+
doc = """ void ps6000DataReadyType
653+
(
654+
int16_t handle,
655+
PICO_STATUS status,
656+
uint32_t noOfSamples,
657+
int16_t overflow,
658+
void *pParameter
659+
); """
660+
ps6000.DataReadyType = C_CALLBACK_FUNCTION_FACTORY(None,
661+
c_int16,
662+
c_uint32,
663+
c_uint32,
664+
c_int16,
665+
c_void_p)
666+
ps6000.DataReadyType.__doc__ = doc
667+
652668
doc = """ void ps6000StreamingReady
653669
(
654670
int16_t handle,
@@ -777,8 +793,8 @@ class PS6000_TRIGGER_INFO (Structure):
777793
uint32_t toSegmentIndex,
778794
int16_t *overflow
779795
); """
780-
ps6000.make_symbol("_GetValuesAsync", "ps6000GetValuesAsync", c_uint32,
781-
[c_int16, c_uint32, c_uint32, c_uint32, c_int32, c_uint32, c_uint32, c_void_p], doc)
796+
#ps6000.make_symbol("_GetValuesAsync", "ps6000GetValuesAsync", c_uint32,
797+
# [c_int16, c_uint32, c_uint32, c_uint32, c_int32, c_uint32, c_uint32, c_void_p], doc)
782798

783799
doc = """ PICO_STATUS ps6000GetNoOfCaptures
784800
(

ps3000aExamples/ps3000aBlockAdvancedTriggerExample.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
# channel = PS3000A_CHANNEL_A = 0
4444
# enabled = 1
4545
# coupling type = PS3000A_DC = 1
46-
# range = PS3000A_10V = 8
46+
# range = PS3000A_5V = 8
4747
# analogue offset = 0 V
4848
chARange = 8
4949
status["setChA"] = ps.ps3000aSetChannel(chandle, 0, 1, 1, chARange, 0)
@@ -93,7 +93,7 @@
9393
channelBDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_NONE"]
9494
channelCDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_NONE"]
9595
channelDDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_NONE"]
96-
extDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_NONE"]
96+
extDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_RISING"]
9797
auxDirection = ps.PS3000A_THRESHOLD_DIRECTION["PS3000A_NONE"]
9898
status["setTrigDir"] = ps.ps3000aSetTriggerChannelDirections(chandle, channelADirection, channelBDirection, channelCDirection, channelDDirection, extDirection, auxDirection)
9999
assert_pico_ok(status["setTrigDir"])

0 commit comments

Comments
 (0)