WORKING in and outputgit status

This commit is contained in:
Anne de Jong 2020-09-15 14:16:48 +02:00
parent a3a7c37548
commit 49ee42bb01
6 changed files with 576 additions and 299 deletions

View File

@ -19,7 +19,8 @@ cdef extern from "lasp_cppthread.h" nogil:
CPPThread(F threadfunction, T data)
void join()
void CPPsleep(unsigned int ms)
void CPPsleep_ms(unsigned int ms)
void CPPsleep_us(unsigned int us)
cdef extern from "lasp_cppqueue.h" nogil:
cdef cppclass SafeQueue[T]:

View File

@ -23,7 +23,10 @@ class CPPThread {
};
void CPPsleep(unsigned int ms) {
void CPPsleep_ms(unsigned int ms) {
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
}
void CPPsleep_us(unsigned int us) {
std::this_thread::sleep_for(std::chrono::microseconds(us));
}
#endif // LASP_CPPTHREAD_H

View File

@ -49,9 +49,9 @@ class DeviceInfo:
@dataclass
class DAQChannel:
channel_enabled: bool
channel_name: str
sensitivity: float
qty: Qty
channel_name: str = 'Unnamed channel'
sensitivity: float = 1.0
qty: Qty = SIQtys.default
range_: str = 'Undefined'
IEPE_enabled: bool = False

View File

@ -422,7 +422,7 @@ cdef void audioCallbackPythonThreadFunction(void* voidstream) nogil:
while stream.outputQueue.size() > 10 and not stream.stopThread.load():
# printf('Sleeping...\n')
# No input queue to wait on, so we relax a bit here.
CPPsleep(1);
CPPsleep_ms(1);
# Outputbuffer is free'ed by the audiothread, so should not be touched
# here.
@ -693,7 +693,7 @@ cdef class RtAudio:
self._stream.thread = new CPPThread[void*, void (*)(void*)](audioCallbackPythonThreadFunction,
<void*> self._stream)
# Allow it to start
CPPsleep(500)
CPPsleep_ms(500)
pass
return nFramesPerBlock

View File

@ -1,5 +1,6 @@
include "lasp_common_decls.pxd"
cdef extern from "uldaq.h" nogil:
ctypedef enum DaqDeviceInterface:
@ -24,6 +25,8 @@ cdef extern from "uldaq.h" nogil:
long long currentIndex
char reserved[64]
UlError ulGetErrMsg(UlError, char* errMsg)
ctypedef enum UlError:
ERR_NO_ERROR
ERR_UNHANDLED_EXCEPTION
@ -136,11 +139,6 @@ cdef extern from "uldaq.h" nogil:
ERR_NET_BUFFER_OVERRUN
ERR_BAD_NET_BUFFER
ctypedef enum AiInputMode:
AI_DIFFERENTIAL = 1,
AI_SINGLE_ENDED = 2,
AI_PSEUDO_DIFFERENTIAL = 3
ctypedef enum Range:
BIP10VOLTS
BIP5VOLTS
@ -241,10 +239,11 @@ cdef extern from "uldaq.h" nogil:
DAQINSCAN_FF_NOCALIBRATEDATA
DAQINSCAN_FF_NOCLEAR
ctypedef enum DaqOutScanFlag:
DAQOUTSCAN_FF_DEFAULT
DAQOUTSCAN_FF_NOSCALEDATA
DAQOUTSCAN_FF_NOCALIBRATEDATA
ctypedef enum AOutScanFlag:
AOUTSCAN_FF_DEFAULT
AOUTSCAN_FF_NOSCALEDATA
AOUTSCAN_FF_NOCALIBRATEDATA
AOUTSCAN_FF_NOCLEAR
ctypedef enum DaqInChanType:
DAQI_ANALOG_DIFF
@ -260,15 +259,6 @@ cdef extern from "uldaq.h" nogil:
DaqInChanType type
Range range
ctypedef enum DaqOutChanType:
DAQO_ANALOG
DAQO_DIGITAL
ctypedef struct DaqOutChanDescriptor:
int channel
DaqOutChanType type
Range range
ctypedef enum DaqEventType:
DE_NONE
DE_ON_DATA_AVAILABLE
@ -359,29 +349,13 @@ cdef extern from "uldaq.h" nogil:
UlError ulDaqInScanStop(DaqDeviceHandle daqDeviceHandle);
UlError ulDaqInScanWait(DaqDeviceHandle daqDeviceHandle, WaitType waitType, long long waitParam, double timeout);
UlError ulDaqOutScan(DaqDeviceHandle daqDeviceHandle, DaqOutChanDescriptor chanDescriptors[], int numChans, int samplesPerChan, double* rate, ScanOption options, DaqOutScanFlag flags, double data[]);
UlError ulDaqOutScanStatus(DaqDeviceHandle daqDeviceHandle, ScanStatus* status, TransferStatus* xferStatus);
UlError ulDaqOutScanStop(DaqDeviceHandle daqDeviceHandle);
UlError ulDaqOutSetTrigger(DaqDeviceHandle daqDeviceHandle, TriggerType type, DaqInChanDescriptor trigChanDescriptor, double level, double variance, unsigned int retriggerSampleCount);
ctypedef void (*DaqEventCallback)(DaqDeviceHandle, DaqEventType, unsigned long long, void*)
UlError ulEnableEvent(DaqDeviceHandle daqDeviceHandle, DaqEventType eventTypes, unsigned long long eventParameter, DaqEventCallback eventCallbackFunction, void* userData);
UlError ulDisableEvent(DaqDeviceHandle daqDeviceHandle, DaqEventType eventTypes)
# UlError ulAIGetConfigDbl(DaqDeviceHandle daqDeviceHandle, AiConfigItemDbl configItem, unsigned int index, double* configValue);
# UlError ulAIGetConfigStr(DaqDeviceHandle daqDeviceHandle, AiConfigItemStr configItem, unsigned int index, char* configStr, unsigned int* maxConfigLen);
# ctypedef enum AiIn
# {
# /** Returns the minimum scan rate in samples per second to the \p infoValue argument. Index is ignored. */
# AI_INFO_MIN_SCAN_RATE = 1000,
# /** Returns the maximum scan rate in samples per second to the \p infoValue argument. Index is ignored. */
# AI_INFO_MAX_SCAN_RATE = 1001,
# /** Returns the maximum throughput in samples per second to the \p infoValue argument. Index is ignored. */
# AI_INFO_MAX_THROUGHPUT = 1002,
# /** Returns the maximum scan rate in samples per second when using the ::SO_BURSTIO ScanOption to the \p infoValue argument. Index is ignored. */
# AI_INFO_MAX_BURST_RATE = 1003,
# /** Returns the maximum throughput in samples per second when using the ::SO_BURSTIO ScanOption to the \p infoValue argument. Index is ignored. */
# AI_INFO_MAX_BURST_THROUGHPUT = 1004
# }AiInfoItemDbl
UlError ulAOutScan(DaqDeviceHandle daqDeviceHandle,int lowChan,int highChan,Range range,int samplesPerChan,double * rate,ScanOption options,AOutScanFlag flags,double data[])
UlError ulAOutScanStatus(DaqDeviceHandle daqDeviceHandle,ScanStatus * status,TransferStatus * xferStatus)
UlError ulAOutScanStop(DaqDeviceHandle daqDeviceHandle)
UlError ulAOutScanWait(DaqDeviceHandle daqDeviceHandle,WaitType waitType,long long waitParam,double timeout)
UlError ulAOutSetTrigger(DaqDeviceHandle daqDeviceHandle,TriggerType type,int trigChan,double level,double variance,unsigned int retriggerSampleCount)

File diff suppressed because it is too large Load Diff