diff options
| author | J08nY | 2020-02-27 23:14:16 +0100 |
|---|---|---|
| committer | J08nY | 2020-02-27 23:14:16 +0100 |
| commit | c5d813d80c5314b3609ee88a21bac625a9ae5d60 (patch) | |
| tree | c764804b3aca8aa6fb23864d7e98f3ff871a31d5 | |
| parent | 50af9ee3200be9eea5b1f825df87e4529cb57f53 (diff) | |
| download | pyecsca-c5d813d80c5314b3609ee88a21bac625a9ae5d60.tar.gz pyecsca-c5d813d80c5314b3609ee88a21bac625a9ae5d60.tar.zst pyecsca-c5d813d80c5314b3609ee88a21bac625a9ae5d60.zip | |
| -rw-r--r-- | .travis.yml | 1 | ||||
| -rw-r--r-- | docs/index.rst | 1 | ||||
| m--------- | notebook | 0 | ||||
| -rw-r--r-- | pyecsca/sca/scope/picoscope_alt.py | 3 | ||||
| -rw-r--r-- | pyecsca/sca/scope/picoscope_sdk.py | 39 | ||||
| -rw-r--r-- | pyecsca/sca/target/simpleserial.py | 1 |
6 files changed, 42 insertions, 3 deletions
diff --git a/.travis.yml b/.travis.yml index c61dbf6..9c61f48 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,6 +10,7 @@ addons: key_url: "https://labs.picotech.com/debian/dists/picoscope/Release.gpg.key" packages: - libps4000 + - libps5000 - libps6000 - swig - gcc diff --git a/docs/index.rst b/docs/index.rst index 4fe5814..d8309ab 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -41,6 +41,7 @@ are the best source of documentation on how to use *pyecsca*. notebook/configuration_space notebook/simulation notebook/codegen + notebook/measurement Requirements diff --git a/notebook b/notebook -Subproject e1e9e33090644f25c3cf07dd104399a2b0aa294 +Subproject 0af7cf43939a29d382d80674bcc7bc1c050ecff diff --git a/pyecsca/sca/scope/picoscope_alt.py b/pyecsca/sca/scope/picoscope_alt.py index acf5807..c5f97af 100644 --- a/pyecsca/sca/scope/picoscope_alt.py +++ b/pyecsca/sca/scope/picoscope_alt.py @@ -3,6 +3,7 @@ from typing import Optional, Tuple, Sequence, Union import numpy as np from picoscope.ps4000 import PS4000 +from picoscope.ps5000 import PS5000 from picoscope.ps6000 import PS6000 from public import public @@ -12,7 +13,7 @@ from .base import Scope @public class PicoScopeAlt(Scope): # pragma: no cover - def __init__(self, ps: Union[PS4000, PS6000]): + def __init__(self, ps: Union[PS4000, PS5000, PS6000]): super().__init__() self.ps = ps diff --git a/pyecsca/sca/scope/picoscope_sdk.py b/pyecsca/sca/scope/picoscope_sdk.py index 5016203..02acddd 100644 --- a/pyecsca/sca/scope/picoscope_sdk.py +++ b/pyecsca/sca/scope/picoscope_sdk.py @@ -7,6 +7,7 @@ import numpy as np from picosdk.functions import assert_pico_ok from picosdk.library import Library from picosdk.ps4000 import ps4000 +from picosdk.ps5000 import ps5000 from picosdk.ps6000 import ps6000 from public import public @@ -67,7 +68,7 @@ class PicoScopeSdk(Scope): # pragma: no cover size = ctypes.c_int16() assert_pico_ok(self.__dispatch_call("GetUnitInfo", self.handle, ctypes.byref(info), 6, ctypes.byref(size), 3)) - return "".join(chr(i) for i in info[:size]) + return "".join(chr(i) for i in info[:size.value]) def setup_frequency(self, frequency: int, samples: int) -> Tuple[int, int]: return self.set_frequency(frequency, samples) @@ -183,6 +184,42 @@ class PicoScopeSdk(Scope): # pragma: no cover raise ValueError return method(*args, **kwargs) +@public +class PS5000Scope(PicoScopeSdk): # pragma: no cover + MODULE = ps5000 + PREFIX = "ps5000" + CHANNELS = { + "A": ps5000.PS5000_CHANNEL["PS5000_CHANNEL_A"], + "B": ps5000.PS5000_CHANNEL["PS5000_CHANNEL_B"], + "C": ps5000.PS5000_CHANNEL["PS5000_CHANNEL_C"], + "D": ps5000.PS5000_CHANNEL["PS5000_CHANNEL_D"] + } + + RANGES = { + 0.01: ps5000.PS5000_RANGE["PS5000_10MV"], + 0.02: ps5000.PS5000_RANGE["PS5000_20MV"], + 0.05: ps5000.PS5000_RANGE["PS5000_50MV"], + 0.10: ps5000.PS5000_RANGE["PS5000_100MV"], + 0.20: ps5000.PS5000_RANGE["PS5000_200MV"], + 1.00: ps5000.PS5000_RANGE["PS5000_1V"], + 2.00: ps5000.PS5000_RANGE["PS5000_2V"], + 5.00: ps5000.PS5000_RANGE["PS5000_5V"], + 10.0: ps5000.PS5000_RANGE["PS5000_10V"], + 20.0: ps5000.PS5000_RANGE["PS5000_20V"], + 50.0: ps5000.PS5000_RANGE["PS5000_50V"] + } + + MAX_ADC_VALUE = 32512 + MIN_ADC_VALUE = -32512 + + COUPLING = { + "AC": 0, + "DC": 1 + } + + def set_frequency(self, frequency: int, samples: int): + return self._set_freq(frequency, samples, 4e-9, 2, 1_000_000_000, 125_000_000, 2) + @public class PS4000Scope(PicoScopeSdk): # pragma: no cover diff --git a/pyecsca/sca/target/simpleserial.py b/pyecsca/sca/target/simpleserial.py index 3d4b7e0..9e26b79 100644 --- a/pyecsca/sca/target/simpleserial.py +++ b/pyecsca/sca/target/simpleserial.py @@ -68,4 +68,3 @@ class SimpleSerialTarget(SerialTarget): self.write(chunk) self.write(b"\n") return self.recv_msgs(timeout) - |
