Skip to content

Commit 4f2e1a4

Browse files
author
neil-hamilton
authored
Merge branch 'master' into jude-changes
2 parents 337269e + 88dab17 commit 4f2e1a4

File tree

69 files changed

+3937
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3937
-103
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,6 @@
1414
build/
1515

1616
# venv directory
17-
venv/
17+
venv/
18+
19+
.bak/

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,15 @@ following command in the top-level directory:
3030
pip install .
3131

3232
If you are not using a virtualenv or are not elevated, use:
33+
=======
34+
For using the AS108 you will need to use the following as well:
35+
36+
python setupPicosynth.py install
37+
38+
39+
On macOS and Linux you will either need to use `sudo` with this command, to
40+
install into the system folders, or to install for the current user only you
41+
can use:
3342

3443
pip install . --user
3544

@@ -63,7 +72,6 @@ The following drivers and devices are not yet supported:
6372

6473
* `plcm3` - PicoLog CM3 Current Data Logger
6574
* `ps3000` - PicoScope 3204, 3205, 3206, 3223, 3224, 3423 & 3423
66-
* `usbpt104` - PT-104 Platinum Resistance Data Logger
6775

6876
### Dependencies
6977

@@ -76,7 +84,8 @@ examples scripts also use the `matplotlib` plotting library. You can install the
7684
### Driver-agnostic examples
7785

7886
The `anyScopeExamples` folder contains examples in pure python which do the same thing as the C-style examples, but
79-
in a driver-generic way.
87+
in a driver-generic way. These examples are currently not being developed further but are still avaliable to use
88+
and develop futher yourself.
8089

8190
### Python Classes
8291

picosdk/PicoDeviceEnums.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def _define_action():
236236

237237
picoEnum.PICO_ACTION = _define_action()
238238

239-
picoEnum.Pico_TRIGGER_STATE = make_enum([
239+
picoEnum.PICO_TRIGGER_STATE = make_enum([
240240
"PICO_CONDITION_DONT_CARE",
241241
"PICO_CONDITION_TRUE",
242242
"PICO_CONDITION_FALSE"

picosdk/PicoDeviceStructs.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"""
99

1010
from ctypes import *
11+
from picosdk.library import Library
1112

1213
class PicoStructlib(Library):
1314
def __init__(self):

picosdk/discover.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from picosdk.ps4000a import ps4000a
1111
from picosdk.ps5000a import ps5000a
1212
from picosdk.ps6000 import ps6000
13+
from picosdk.ps6000a import ps6000a
1314

1415

1516
# the A drivers are faster to enumerate devices, so search them first.
@@ -18,6 +19,7 @@
1819
ps3000a,
1920
ps4000a,
2021
ps5000a,
22+
ps6000a,
2123
ps6000,
2224
ps2000,
2325
ps3000,
@@ -47,4 +49,4 @@ def find_all_units():
4749
devices.append(device)
4850
if not devices:
4951
raise DeviceNotFoundError("Could not find any devices on any drivers.")
50-
return devices
52+
return devices

picosdk/picosynth.py

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
#
2+
# Copyright (C) 2022 Pico Technology Ltd. See LICENSE file for terms.
3+
#
4+
"""
5+
This is a Python module defining the functions from the picosynth.h C header file
6+
for the PicoSource AS108 Agile Synthesizer using the picosynth driver API functions.
7+
"""
8+
9+
from ctypes import *
10+
from picosdk.library import Library
11+
from picosdk.errors import ArgumentOutOfRangeError
12+
from picosdk.constants import make_enum
13+
14+
class Picosynthlib(Library):
15+
def __init__(self):
16+
super(Picosynthlib, self).__init__("picosynth")
17+
18+
picosynth = Picosynthlib()
19+
20+
picosynth.PICO_SOURCE_MODEL = make_enum([
21+
"PICO_NONE_SPECIFIED",
22+
"PICO_SYNTH",
23+
])
24+
25+
doc = """ PICO_STATUS picosynthOpenUnit
26+
(
27+
PICO_SOURCE_MODEL model,
28+
uint32_t *handle,
29+
unit8_t *serialNumber
30+
);"""
31+
picosynth.make_symbol("_OpenUnit","picosynthOpenUnit",c_uint32,[c_uint32, c_void_p, c_void_p],doc)
32+
33+
doc = """ PICO_STATUS picosynthEnumerateUnits
34+
(
35+
PICO_SOURCE_MODEL model,
36+
uint8_t *serials,
37+
unit16_t *serialLth
38+
);"""
39+
picosynth.make_symbol("_EnumerateUnits","picosynthEnumerateUnits",c_uint32,[c_uint32, c_void_p, c_void_p],doc)
40+
41+
doc = """ PICO_STATUS picosynthGetUnitInfo
42+
(
43+
int8_t *string,
44+
unit16_t stringLength,
45+
uint16_t *requiredSize,
46+
PICO_INFO deviceInfo
47+
);"""
48+
picosynth.make_symbol("_GetUnitInfo","picosynthGetUnitInfo",c_uint32,[c_uint32, c_void_p, c_uint16, c_void_p, c_uint32],doc)
49+
50+
doc = """ PICO_STATUS picosynthPingUnit
51+
(
52+
uint32_t *handle,
53+
);"""
54+
picosynth.make_symbol("_PingUnit","picosynthPingUnit",c_uint32,[c_uint32],doc)
55+
56+
doc = """ PICO_STATUS picosynthCloseUnit
57+
(
58+
uint32_t *handle,
59+
);"""
60+
picosynth.make_symbol("_CloseUnit","picosynthCloseUnit",c_uint32,[c_uint32],doc)
61+
62+
doc = """ PICO_STATUS picosynthSetOutputOff
63+
(
64+
uint32_t *handle,
65+
);"""
66+
picosynth.make_symbol("_SetOutputOff","picosynthSetOutputOff",c_uint32,[c_uint32],doc)
67+
68+
doc = """ PICO_STATUS picosynthSetFrequency
69+
(
70+
uint32_t *handle,
71+
double frequencyHz,
72+
double powerLeveldBm
73+
);"""
74+
picosynth.make_symbol("_SetFrequency","picosynthSetFrequency",c_uint32,[c_uint32, c_double, c_double],doc)
75+
76+
doc = """ PICO_STATUS picosynthSetPhase
77+
(
78+
uint32_t handle,
79+
double phaseDeg
80+
);"""
81+
picosynth.make_symbol("_SetPhase", "picosynthSetPhase", c_uint32,[c_uint32, c_double], doc)
82+
83+
doc = """ PICO_STATUS picosynthSetAmplitudeModulation
84+
(
85+
uint32_t handle,
86+
double frequencyHz,
87+
double powerLeveldBm,
88+
double modulationDepthPercent,
89+
double modulationRateHz,
90+
MODULATION_SOURCE modulationSource,
91+
int16_t enabled
92+
);"""
93+
picosynth.make_symbol("_SetAmplitudeModulation","picosynthSetAmplitudeModulation", c_uint32,[c_uint32,c_double,c_double,c_double,c_double,c_uint32,c_int16],doc)
94+
95+
doc = """ PICO_STATUS picosynthSetFrequencyModulation
96+
(
97+
uint32_t handle,
98+
double frequencyHz,
99+
double powerLeveldBm,
100+
double modulationDeviationHz,
101+
double modulationRateHz,
102+
MODULATION_SOURCE modulationSource,
103+
int16_t enabled
104+
);"""
105+
picosynth.make_symbol("_SetFrequencyModulation","picosynthSetFrequencyModulation",c_uint32,[c_uint32,c_double,c_double,c_double,c_double,c_uint32,c_int16],doc)
106+
107+
doc = """ PICO_STATUS picosynthSetPhaseModulation
108+
(
109+
uint32_t handle,
110+
double frequencyHz,
111+
double powerLeveldBm,
112+
double modulationDeviationHz,
113+
double modulationRateHz,
114+
MODULATION_SOURCE modulationSource,
115+
int16_t enabled
116+
);"""
117+
picosynth.make_symbol("_SetPhaseModulation","picosynthSetPhaseModulation",c_uint32,[c_uint32,c_double,c_double,c_double,c_double,c_uint32,c_int16],doc)
118+
119+
doc = """ PICO_STATUS picosynthSetFrequencyAndLevelSweep
120+
(
121+
uint32_t handle,
122+
double startFrequencyHz,
123+
double stopFrequencyHz,
124+
double startLevel,
125+
double stopLevel,
126+
LEVEL_UNIT levelUnit,
127+
double dwellTimeUs,
128+
int32_t pointsInSweep,
129+
SWEEP_HOP_MODE mode,
130+
TRIGGER_MODE triggerMode
131+
);"""
132+
picosynth.make_symbol("_SetFrequencyAndLevelSweep","picosynthSetFrequencyAndLevelSweep", c_uint32,[c_uint32,c_double,c_double,c_double,c_double,c_uint32,c_double,c_int32,c_uint32,c_uint32],doc)
133+
134+
doc = """ PICO_STATUS picosynthSetPhaseAndLevelSweep
135+
(
136+
uint32_t handle,
137+
double frequencyHz,
138+
double startPhaseDeg,
139+
double stopPhaseDeg,
140+
double startLevel,
141+
double stopLevel,
142+
LEVEL_UNIT levelUnit,
143+
double dwellTimeUs,
144+
int32_t pointsInSweep,
145+
SWEEP_HOP_MODE mode,
146+
TRIGGER_MODE triggerMode
147+
);"""
148+
picosynth.make_symbol("_SetPhaseAndLevelSweep","picosynthSetPhaseAndLevelSweep", c_uint32,[c_uint32,c_double,c_double,c_double,c_double,c_double,c_uint32,c_double,c_int32,c_uint32,c_uint32],doc)
149+
150+
doc = """ PICO_STATUS picosynthSetArbitraryPhaseAndLevel
151+
(
152+
uint32_t handle,
153+
double frequencyHz,
154+
double *arbitraryPhaseDeg,
155+
double *arbitraryPowerLeveldBm,
156+
int32_t numberOfPoints,
157+
double dwellTimeUs,
158+
TRIGGER_MODE triggerMode
159+
);"""
160+
picosynth.make_symbol("_SetArbitraryPhaseAndLevel","picosynthSetArbitraryPhaseAndLevel",c_uint32,[c_uint32,c_double,c_double,c_double,c_int32,c_double,c_uint32],doc)
161+
162+
doc = """ PICO_STATUS picosynthSetArbitraryFrequencyAndLevel
163+
(
164+
uint32_t handle,
165+
double *arbitraryFrequencyHz,
166+
double *arbitraryPowerLeveldBm,
167+
int32_t numberOfPoints,
168+
double dwellTimeUs,
169+
TRIGGER_MODE triggerMode
170+
);"""
171+
picosynth.make_symbol("_SetArbitraryFrequencyAndLevel","picosynthSetArbitraryFrequencyAndLevel",c_uint32,[c_uint32,c_double,c_double,c_int32,c_double,c_uint32],doc)

picosdk/ps2000a.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -846,3 +846,19 @@ class PS2000A_TRIGGER_CHANNEL_PROPERTIES(Structure):
846846
ps2000a.make_symbol("_GetMaxSegments", "ps2000aGetMaxSegments", c_uint32, [c_int16, c_void_p], doc)
847847

848848
ps2000a.INI_LOGIC_VOLTS = 1.5
849+
850+
doc = """ void *ps2000aBlockReady
851+
(
852+
int16_t handle,
853+
PICO_STATUS status,
854+
void *pParameter
855+
);
856+
define a python function which accepts the correct arguments, and pass it to the constructor of this type.
857+
"""
858+
859+
ps2000a.BlockReadyType = C_CALLBACK_FUNCTION_FACTORY(None,
860+
c_int16,
861+
c_uint32,
862+
c_void_p)
863+
864+
ps2000a.BlockReadyType.__doc__ = doc

picosdk/ps3000a.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _define_digital_port():
146146

147147
ps3000a.PS3000A_THRESHOLD_DIRECTION = make_enum([
148148
("PS3000A_ABOVE", "PS3000A_INSIDE"),
149-
("PS3000A_BELOW", "PS3000A_OUTSIDE"),
149+
("PS3000A_BELOW", "PS3000A_OUTSIDE","PS3000A_NONE"),
150150
("PS3000A_RISING", "PS3000A_ENTER"),
151151
("PS3000A_FALLING", "PS3000A_EXIT"),
152152
("PS3000A_RISING_OR_FALLING", "PS3000A_ENTER_OR_EXIT"),
@@ -155,8 +155,7 @@ def _define_digital_port():
155155
"PS3000A_RISING_LOWER",
156156
"PS3000A_FALLING_LOWER"
157157
"PS3000A_POSITIVE_RUNT",
158-
"PS3000A_NEGATIVE_RUNT",
159-
"PS3000A_NONE"
158+
"PS3000A_NEGATIVE_RUNT"
160159
])
161160

162161
ps3000a.PS3000A_THRESHOLD_MODE = make_enum([

0 commit comments

Comments
 (0)