From ce89c445d79cc6bb2aa57e036b296fce6d8fbbef Mon Sep 17 00:00:00 2001 From: Kumi Date: Sat, 17 Feb 2024 18:02:59 +0100 Subject: [PATCH] Enhance device channel handling Introduced a new utility function to extract and return the number of channels associated with a given device, improving the driver's ability to handle device-specific configurations. Also expanded the C++ bindings by importing the pair class, which is pivotal for representing the channel information. This enhancement facilitates more granular control and paves the way for future features that may require detailed channel info. --- src/limedriver/limedriver.pyx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/limedriver/limedriver.pyx b/src/limedriver/limedriver.pyx index da4ded8..9bda00b 100644 --- a/src/limedriver/limedriver.pyx +++ b/src/limedriver/limedriver.pyx @@ -7,6 +7,7 @@ from libc.string cimport memcpy, strcpy from libcpp.vector cimport vector from libcpp.string cimport string +from libcpp.pair cimport pair import pathlib @@ -95,6 +96,8 @@ cdef extern from "limedriver.h": cdef int run_experiment_from_LimeCfg(LimeConfig_t config) + cdef pair[int, int] getChannelsFromInfo(string device) + cdef vector[string] getDeviceList() @@ -718,4 +721,8 @@ cdef class PyLimeConfig: def get_device_list(): cdef vector[string] devices = getDeviceList() - return [device.decode('utf-8') for device in devices] \ No newline at end of file + return [device.decode('utf-8') for device in devices] + +def get_channels_for_device(device): + cdef pair[int, int] channels = getChannelsFromInfo(device) + return channels.first, channels.second