From f48c034011c153760c586fe397c66e4d37046e6a Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 17 Feb 2024 17:38:18 +0100 Subject: [PATCH] Bump version and add device listing Updated the project version reflecting new features. Extended the LimeConfig_t struct to include a device string supporting device specification. Introduced a new function `get_device_list` in the Python binding, allowing users to retrieve a list of available devices, enhancing usability. This change improves user interactions with the hardware, making device management more intuitive. --- pyproject.toml | 2 +- src/limedriver/limedriver.pyx | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 85ff8e8..173e588 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "limedriver" -version = "0.3.0" +version = "0.4.0" description = "Python bindings for limedriver" authors = [{name = "Kumi", email = "limedriver@kumi.email"}] license = {file = "LICENSE"} diff --git a/src/limedriver/limedriver.pyx b/src/limedriver/limedriver.pyx index 4bd4a5e..63bc855 100644 --- a/src/limedriver/limedriver.pyx +++ b/src/limedriver/limedriver.pyx @@ -5,13 +5,15 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Free from libc.stdlib cimport malloc, free from libc.string cimport memcpy, strcpy - +from libcpp.vector cimport vector from libcpp.string cimport string import pathlib cdef extern from "limedriver.h": cdef struct LimeConfig_t: + string device + float srate int channel int TX_matching @@ -92,6 +94,8 @@ cdef extern from "limedriver.h": cdef LimeConfig_t initializeLimeConfig(int Npulses) cdef int run_experiment_from_LimeCfg(LimeConfig_t config) + + cdef vector[string] getDeviceList() cdef class PyLimeConfig: @@ -703,4 +707,7 @@ cdef class PyLimeConfig: path = self.save_path + self.file_stamp + '_' + self.file_pattern + '.h5' path = pathlib.Path(path).absolute() return path - \ No newline at end of file + +def get_device_list(): + cdef vector[string] devices = getDeviceList() + return [device.decode('utf-8') for device in devices] \ No newline at end of file