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.
This commit is contained in:
Kumi 2024-02-17 17:38:18 +01:00
parent a47961e311
commit f48c034011
Signed by: kumi
GPG key ID: ECBCC9082395383F
2 changed files with 10 additions and 3 deletions

View file

@ -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"}

View file

@ -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
def get_device_list():
cdef vector[string] devices = getDeviceList()
return [device.decode('utf-8') for device in devices]