mirror of
https://github.com/nqrduck/LimeDriverBindings.git
synced 2024-11-05 18:20:03 +00:00
Implemented first pointer p_dur
This commit is contained in:
parent
4d4161e878
commit
f53ad866ff
1 changed files with 11 additions and 4 deletions
|
@ -85,11 +85,14 @@ cdef extern from "limedriver.h":
|
|||
cdef class PyLimeConfig:
|
||||
cdef LimeConfig_t* _config
|
||||
|
||||
def __cinit__(self):
|
||||
def __cinit__(self, Npulses):
|
||||
self._config = <LimeConfig_t*>malloc(sizeof(LimeConfig_t))
|
||||
if self._config is NULL:
|
||||
raise MemoryError()
|
||||
|
||||
# Set Npulses
|
||||
self._config.Npulses = Npulses
|
||||
|
||||
# Allocate memory for string fields
|
||||
self._config.file_pattern = <char*>malloc(256)
|
||||
self._config.file_stamp = <char*>malloc(256)
|
||||
|
@ -97,6 +100,9 @@ cdef class PyLimeConfig:
|
|||
self._config.stamp_start = <char*>malloc(256)
|
||||
self._config.stamp_end = <char*>malloc(256)
|
||||
|
||||
# Allocate memory for arrays with Npulses elements
|
||||
self._config.p_dur = <double*>malloc(Npulses * sizeof(double))
|
||||
|
||||
|
||||
def __dealloc__(self):
|
||||
if self._config is not NULL:
|
||||
|
@ -234,11 +240,12 @@ cdef class PyLimeConfig:
|
|||
|
||||
@property
|
||||
def p_dur(self):
|
||||
return self._config.p_dur
|
||||
return [self._config.p_dur[i] for i in range(self._config.Npulses)]
|
||||
|
||||
@p_dur.setter
|
||||
def p_dur(self, double *value):
|
||||
self._config.p_dur = <double>value
|
||||
def p_dur(self, list value):
|
||||
for i in range(len(value)):
|
||||
self._config.p_dur[i] = value[i]
|
||||
|
||||
# Arrays
|
||||
|
||||
|
|
Loading…
Reference in a new issue