Skip to content

Commit 5ec341c

Browse files
committed
Update existing tests to use new waveform generators
1 parent ca1f0c1 commit 5ec341c

File tree

2 files changed

+12
-20
lines changed

2 files changed

+12
-20
lines changed

tests/test_logic_analyzer.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import PSL.commands_proto as CP
1414
from PSL import logic_analyzer
1515
from PSL import packet_handler
16-
from PSL import sciencelab
16+
from PSL.waveform_generator import PWMGenerator
1717

1818
EVENTS = 2495
1919
FREQUENCY = 1e5
@@ -31,15 +31,13 @@ def la(handler, request):
3131
In integration test mode, this function also enables the PWM output.
3232
"""
3333
if not isinstance(handler, packet_handler.MockHandler):
34-
psl = sciencelab.connect()
35-
psl.H.disconnect()
36-
psl.H = handler
37-
enable_pwm(psl, request.node.name)
34+
pwm = PWMGenerator(handler)
35+
enable_pwm(pwm, request.node.name)
3836
handler._logging = True
3937
return logic_analyzer.LogicAnalyzer(handler)
4038

4139

42-
def enable_pwm(psl: sciencelab.ScienceLab, test_name: str):
40+
def enable_pwm(pwm: PWMGenerator, test_name: str):
4341
"""Enable PWM output for integration testing."""
4442
low_frequency_tests = (
4543
"test_capture_four_low_frequency",
@@ -55,15 +53,11 @@ def enable_pwm(psl: sciencelab.ScienceLab, test_name: str):
5553
else:
5654
frequency = FREQUENCY
5755

58-
psl.sqrPWM(
59-
freq=frequency,
60-
h0=DUTY_CYCLE,
61-
p1=0,
62-
h1=DUTY_CYCLE,
63-
p2=0,
64-
h2=DUTY_CYCLE,
65-
p3=0,
66-
h3=DUTY_CYCLE,
56+
pwm.generate(
57+
["SQ1", "SQ2", "SQ3", "SQ4"],
58+
frequency,
59+
DUTY_CYCLE,
60+
0,
6761
)
6862

6963

tests/test_oscilloscope.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from PSL import oscilloscope
1212
from PSL import packet_handler
13-
from PSL import sciencelab
13+
from PSL.waveform_generator import WaveformGenerator
1414

1515
FREQUENCY = 1000
1616
MICROSECONDS = 1e-6
@@ -24,10 +24,8 @@ def scope(handler):
2424
In integration test mode, this function also enables the analog output.
2525
"""
2626
if not isinstance(handler, packet_handler.MockHandler):
27-
psl = sciencelab.connect()
28-
psl.H.disconnect()
29-
psl.H = handler
30-
psl.set_sine1(FREQUENCY)
27+
wave = WaveformGenerator(handler)
28+
wave.generate(["SI1", "SI2"], FREQUENCY)
3129
handler._logging = True
3230
return oscilloscope.Oscilloscope(handler)
3331

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy