mirror of https://github.com/EspoTek/Labrador.git
New driver (not working)
Committing before revert. Not worth going through after a shotgun debugging sesh.
This commit is contained in:
parent
ce0d5b8bb1
commit
2e8277c392
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.1.0, 2016-10-13T11:25:36. -->
|
||||
<!-- Written by QtCreator 4.1.0, 2016-10-14T08:15:47. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
|
Binary file not shown.
|
@ -52,18 +52,15 @@ void isoDriver::timerTick(void){
|
|||
autoGain();
|
||||
firstFrame = false;
|
||||
}
|
||||
//qDebug() << "TICK!" << QDateTime::currentMSecsSinceEpoch();
|
||||
if (driver->recoveryInProcess){
|
||||
//qDebug() << "Recovery in process! Aborting";
|
||||
return;
|
||||
}
|
||||
|
||||
isoTemp = driver->isoRead(TIMER_PERIOD*ADC_SPF*2);
|
||||
isoTemp = driver->isoRead();
|
||||
length = *((PUINT)isoTemp);
|
||||
qDebug() << "READING IN" << length;
|
||||
total_read += length;
|
||||
qDebug() << "TOTAL READ" << total_read;
|
||||
|
||||
if (driver->recoveryInProcess){
|
||||
recoverIsoStream();
|
||||
|
||||
if (length==0){
|
||||
free(isoTemp);
|
||||
return;
|
||||
}
|
||||
|
@ -162,32 +159,6 @@ void isoDriver::startTimer(){
|
|||
//qFatal("ISO TIMER STARTED");
|
||||
}
|
||||
|
||||
void isoDriver::recoverIsoStream(void){
|
||||
QTimer::singleShot(ISO_RECOVERY_TIME, this, SLOT(recoveryTick()));
|
||||
}
|
||||
|
||||
void isoDriver::recoveryTick(void){
|
||||
//qDebug() << "(recovery) TICK";
|
||||
|
||||
//axes->yAxis->setAutoTickCount((axes->height() + TICK_SEPARATION / 2) / TICK_SEPARATION);
|
||||
//axes->xAxis->setAutoTickCount((axes->width() + TICK_SEPARATION / 2) / TICK_SEPARATION);
|
||||
|
||||
|
||||
if(driver->recoverySuccess){
|
||||
//isoTimer->start(TIMER_PERIOD);
|
||||
//connect(isoTimer, SIGNAL(timeout()), this, SLOT(timerTick()));
|
||||
driver->recoveryInProcess = false;
|
||||
driver->dutyTemp = 0;
|
||||
disableWindow(1);
|
||||
//qDebug() << "recoveryTick() completed successfully";
|
||||
}
|
||||
else{
|
||||
driver->reinitialise(1);
|
||||
QTimer::singleShot(ISO_RECOVERY_TIME, this, SLOT(recoveryTick()));
|
||||
//qDebug() << "recoveryTick() completed with errors. Retrying...";
|
||||
}
|
||||
}
|
||||
|
||||
void isoDriver::clearBuffers(bool ch3751, bool ch3752, bool ch750){
|
||||
if(ch3751) internalBuffer375_CH1->clearBuffer();
|
||||
if(ch3752) internalBuffer375_CH2->clearBuffer();
|
||||
|
|
|
@ -38,7 +38,6 @@ private:
|
|||
void analogConvert(short *shortPtr, QVector<double> *doublePtr, int TOP, bool AC);
|
||||
void digitalConvert(short *shortPtr, QVector<double> *doublePtr);
|
||||
bool paused_CH1 = false, paused_CH2 = false, paused_multimeter = false;
|
||||
void recoverIsoStream(void);
|
||||
void frameActionGeneric(char CH1_mode, char CH2_mode);
|
||||
char *isoTemp = NULL;
|
||||
short *isoTemp_short = NULL;
|
||||
|
@ -108,7 +107,6 @@ public slots:
|
|||
void setWindow(int newWindow);
|
||||
void setVoltageRange(QWheelEvent *event);
|
||||
void timerTick(void);
|
||||
void recoveryTick(void);
|
||||
void pauseEnable_CH1(bool enabled);
|
||||
void pauseEnable_CH2(bool enabled);
|
||||
void pauseEnable_multimeter(bool enabled);
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -19,8 +19,8 @@
|
|||
|
||||
QT_BEGIN_MOC_NAMESPACE
|
||||
struct qt_meta_stringdata_isoDriver_t {
|
||||
QByteArrayData data[84];
|
||||
char stringdata0[1145];
|
||||
QByteArrayData data[83];
|
||||
char stringdata0[1132];
|
||||
};
|
||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||
|
@ -61,58 +61,57 @@ QT_MOC_LITERAL(28, 373, 15), // "setVoltageRange"
|
|||
QT_MOC_LITERAL(29, 389, 12), // "QWheelEvent*"
|
||||
QT_MOC_LITERAL(30, 402, 5), // "event"
|
||||
QT_MOC_LITERAL(31, 408, 9), // "timerTick"
|
||||
QT_MOC_LITERAL(32, 418, 12), // "recoveryTick"
|
||||
QT_MOC_LITERAL(33, 431, 15), // "pauseEnable_CH1"
|
||||
QT_MOC_LITERAL(34, 447, 15), // "pauseEnable_CH2"
|
||||
QT_MOC_LITERAL(35, 463, 22), // "pauseEnable_multimeter"
|
||||
QT_MOC_LITERAL(36, 486, 10), // "startTimer"
|
||||
QT_MOC_LITERAL(37, 497, 12), // "clearBuffers"
|
||||
QT_MOC_LITERAL(38, 510, 6), // "ch3751"
|
||||
QT_MOC_LITERAL(39, 517, 6), // "ch3752"
|
||||
QT_MOC_LITERAL(40, 524, 5), // "ch750"
|
||||
QT_MOC_LITERAL(41, 530, 14), // "setVisible_CH2"
|
||||
QT_MOC_LITERAL(42, 545, 7), // "visible"
|
||||
QT_MOC_LITERAL(43, 553, 11), // "gainBuffers"
|
||||
QT_MOC_LITERAL(44, 565, 10), // "multiplier"
|
||||
QT_MOC_LITERAL(45, 576, 8), // "gainTick"
|
||||
QT_MOC_LITERAL(46, 585, 11), // "setAutoGain"
|
||||
QT_MOC_LITERAL(47, 597, 15), // "graphMousePress"
|
||||
QT_MOC_LITERAL(48, 613, 12), // "QMouseEvent*"
|
||||
QT_MOC_LITERAL(49, 626, 17), // "graphMouseRelease"
|
||||
QT_MOC_LITERAL(50, 644, 14), // "graphMouseMove"
|
||||
QT_MOC_LITERAL(51, 659, 16), // "cursorEnableHori"
|
||||
QT_MOC_LITERAL(52, 676, 16), // "cursorEnableVert"
|
||||
QT_MOC_LITERAL(53, 693, 17), // "setTriggerEnabled"
|
||||
QT_MOC_LITERAL(54, 711, 15), // "setTriggerLevel"
|
||||
QT_MOC_LITERAL(55, 727, 5), // "level"
|
||||
QT_MOC_LITERAL(56, 733, 20), // "setSingleShotEnabled"
|
||||
QT_MOC_LITERAL(57, 754, 14), // "setTriggerMode"
|
||||
QT_MOC_LITERAL(58, 769, 7), // "newMode"
|
||||
QT_MOC_LITERAL(59, 777, 9), // "setAC_CH1"
|
||||
QT_MOC_LITERAL(60, 787, 9), // "setAC_CH2"
|
||||
QT_MOC_LITERAL(61, 797, 17), // "setMultimeterType"
|
||||
QT_MOC_LITERAL(62, 815, 4), // "type"
|
||||
QT_MOC_LITERAL(63, 820, 19), // "setSeriesResistance"
|
||||
QT_MOC_LITERAL(64, 840, 10), // "resistance"
|
||||
QT_MOC_LITERAL(65, 851, 15), // "multimeterStats"
|
||||
QT_MOC_LITERAL(66, 867, 8), // "enableMM"
|
||||
QT_MOC_LITERAL(67, 876, 18), // "setAutoMultimeterV"
|
||||
QT_MOC_LITERAL(68, 895, 18), // "setAutoMultimeterI"
|
||||
QT_MOC_LITERAL(69, 914, 18), // "setForceMillivolts"
|
||||
QT_MOC_LITERAL(70, 933, 17), // "setForceMilliamps"
|
||||
QT_MOC_LITERAL(71, 951, 13), // "setForceVolts"
|
||||
QT_MOC_LITERAL(72, 965, 12), // "setForceAmps"
|
||||
QT_MOC_LITERAL(73, 978, 26), // "setSerialDecodeEnabled_CH1"
|
||||
QT_MOC_LITERAL(74, 1005, 26), // "setSerialDecodeEnabled_CH2"
|
||||
QT_MOC_LITERAL(75, 1032, 9), // "setXYmode"
|
||||
QT_MOC_LITERAL(76, 1042, 23), // "triggerGroupStateChange"
|
||||
QT_MOC_LITERAL(77, 1066, 13), // "slowTimerTick"
|
||||
QT_MOC_LITERAL(78, 1080, 11), // "setTopRange"
|
||||
QT_MOC_LITERAL(79, 1092, 6), // "newTop"
|
||||
QT_MOC_LITERAL(80, 1099, 11), // "setBotRange"
|
||||
QT_MOC_LITERAL(81, 1111, 6), // "newBot"
|
||||
QT_MOC_LITERAL(82, 1118, 13), // "setTimeWindow"
|
||||
QT_MOC_LITERAL(83, 1132, 12) // "takeSnapshot"
|
||||
QT_MOC_LITERAL(32, 418, 15), // "pauseEnable_CH1"
|
||||
QT_MOC_LITERAL(33, 434, 15), // "pauseEnable_CH2"
|
||||
QT_MOC_LITERAL(34, 450, 22), // "pauseEnable_multimeter"
|
||||
QT_MOC_LITERAL(35, 473, 10), // "startTimer"
|
||||
QT_MOC_LITERAL(36, 484, 12), // "clearBuffers"
|
||||
QT_MOC_LITERAL(37, 497, 6), // "ch3751"
|
||||
QT_MOC_LITERAL(38, 504, 6), // "ch3752"
|
||||
QT_MOC_LITERAL(39, 511, 5), // "ch750"
|
||||
QT_MOC_LITERAL(40, 517, 14), // "setVisible_CH2"
|
||||
QT_MOC_LITERAL(41, 532, 7), // "visible"
|
||||
QT_MOC_LITERAL(42, 540, 11), // "gainBuffers"
|
||||
QT_MOC_LITERAL(43, 552, 10), // "multiplier"
|
||||
QT_MOC_LITERAL(44, 563, 8), // "gainTick"
|
||||
QT_MOC_LITERAL(45, 572, 11), // "setAutoGain"
|
||||
QT_MOC_LITERAL(46, 584, 15), // "graphMousePress"
|
||||
QT_MOC_LITERAL(47, 600, 12), // "QMouseEvent*"
|
||||
QT_MOC_LITERAL(48, 613, 17), // "graphMouseRelease"
|
||||
QT_MOC_LITERAL(49, 631, 14), // "graphMouseMove"
|
||||
QT_MOC_LITERAL(50, 646, 16), // "cursorEnableHori"
|
||||
QT_MOC_LITERAL(51, 663, 16), // "cursorEnableVert"
|
||||
QT_MOC_LITERAL(52, 680, 17), // "setTriggerEnabled"
|
||||
QT_MOC_LITERAL(53, 698, 15), // "setTriggerLevel"
|
||||
QT_MOC_LITERAL(54, 714, 5), // "level"
|
||||
QT_MOC_LITERAL(55, 720, 20), // "setSingleShotEnabled"
|
||||
QT_MOC_LITERAL(56, 741, 14), // "setTriggerMode"
|
||||
QT_MOC_LITERAL(57, 756, 7), // "newMode"
|
||||
QT_MOC_LITERAL(58, 764, 9), // "setAC_CH1"
|
||||
QT_MOC_LITERAL(59, 774, 9), // "setAC_CH2"
|
||||
QT_MOC_LITERAL(60, 784, 17), // "setMultimeterType"
|
||||
QT_MOC_LITERAL(61, 802, 4), // "type"
|
||||
QT_MOC_LITERAL(62, 807, 19), // "setSeriesResistance"
|
||||
QT_MOC_LITERAL(63, 827, 10), // "resistance"
|
||||
QT_MOC_LITERAL(64, 838, 15), // "multimeterStats"
|
||||
QT_MOC_LITERAL(65, 854, 8), // "enableMM"
|
||||
QT_MOC_LITERAL(66, 863, 18), // "setAutoMultimeterV"
|
||||
QT_MOC_LITERAL(67, 882, 18), // "setAutoMultimeterI"
|
||||
QT_MOC_LITERAL(68, 901, 18), // "setForceMillivolts"
|
||||
QT_MOC_LITERAL(69, 920, 17), // "setForceMilliamps"
|
||||
QT_MOC_LITERAL(70, 938, 13), // "setForceVolts"
|
||||
QT_MOC_LITERAL(71, 952, 12), // "setForceAmps"
|
||||
QT_MOC_LITERAL(72, 965, 26), // "setSerialDecodeEnabled_CH1"
|
||||
QT_MOC_LITERAL(73, 992, 26), // "setSerialDecodeEnabled_CH2"
|
||||
QT_MOC_LITERAL(74, 1019, 9), // "setXYmode"
|
||||
QT_MOC_LITERAL(75, 1029, 23), // "triggerGroupStateChange"
|
||||
QT_MOC_LITERAL(76, 1053, 13), // "slowTimerTick"
|
||||
QT_MOC_LITERAL(77, 1067, 11), // "setTopRange"
|
||||
QT_MOC_LITERAL(78, 1079, 6), // "newTop"
|
||||
QT_MOC_LITERAL(79, 1086, 11), // "setBotRange"
|
||||
QT_MOC_LITERAL(80, 1098, 6), // "newBot"
|
||||
QT_MOC_LITERAL(81, 1105, 13), // "setTimeWindow"
|
||||
QT_MOC_LITERAL(82, 1119, 12) // "takeSnapshot"
|
||||
|
||||
},
|
||||
"isoDriver\0setGain\0\0newGain\0disableWindow\0"
|
||||
|
@ -125,7 +124,7 @@ QT_MOC_LITERAL(83, 1132, 12) // "takeSnapshot"
|
|||
"sendVmax_CH1\0sendVmin_CH1\0sendVmean_CH1\0"
|
||||
"sendVmax_CH2\0sendVmin_CH2\0sendVmean_CH2\0"
|
||||
"setWindow\0newWindow\0setVoltageRange\0"
|
||||
"QWheelEvent*\0event\0timerTick\0recoveryTick\0"
|
||||
"QWheelEvent*\0event\0timerTick\0"
|
||||
"pauseEnable_CH1\0pauseEnable_CH2\0"
|
||||
"pauseEnable_multimeter\0startTimer\0"
|
||||
"clearBuffers\0ch3751\0ch3752\0ch750\0"
|
||||
|
@ -156,7 +155,7 @@ static const uint qt_meta_data_isoDriver[] = {
|
|||
7, // revision
|
||||
0, // classname
|
||||
0, 0, // classinfo
|
||||
62, 14, // methods
|
||||
61, 14, // methods
|
||||
0, 0, // properties
|
||||
0, 0, // enums/sets
|
||||
0, 0, // constructors
|
||||
|
@ -164,70 +163,69 @@ static const uint qt_meta_data_isoDriver[] = {
|
|||
19, // signalCount
|
||||
|
||||
// signals: name, argc, parameters, tag, flags
|
||||
1, 1, 324, 2, 0x06 /* Public */,
|
||||
4, 1, 327, 2, 0x06 /* Public */,
|
||||
6, 1, 330, 2, 0x06 /* Public */,
|
||||
7, 1, 333, 2, 0x06 /* Public */,
|
||||
9, 1, 336, 2, 0x06 /* Public */,
|
||||
11, 1, 339, 2, 0x06 /* Public */,
|
||||
12, 1, 342, 2, 0x06 /* Public */,
|
||||
13, 1, 345, 2, 0x06 /* Public */,
|
||||
14, 1, 348, 2, 0x06 /* Public */,
|
||||
15, 1, 351, 2, 0x06 /* Public */,
|
||||
16, 1, 354, 2, 0x06 /* Public */,
|
||||
17, 1, 357, 2, 0x06 /* Public */,
|
||||
19, 1, 360, 2, 0x06 /* Public */,
|
||||
20, 1, 363, 2, 0x06 /* Public */,
|
||||
21, 1, 366, 2, 0x06 /* Public */,
|
||||
22, 1, 369, 2, 0x06 /* Public */,
|
||||
23, 1, 372, 2, 0x06 /* Public */,
|
||||
24, 1, 375, 2, 0x06 /* Public */,
|
||||
25, 1, 378, 2, 0x06 /* Public */,
|
||||
1, 1, 319, 2, 0x06 /* Public */,
|
||||
4, 1, 322, 2, 0x06 /* Public */,
|
||||
6, 1, 325, 2, 0x06 /* Public */,
|
||||
7, 1, 328, 2, 0x06 /* Public */,
|
||||
9, 1, 331, 2, 0x06 /* Public */,
|
||||
11, 1, 334, 2, 0x06 /* Public */,
|
||||
12, 1, 337, 2, 0x06 /* Public */,
|
||||
13, 1, 340, 2, 0x06 /* Public */,
|
||||
14, 1, 343, 2, 0x06 /* Public */,
|
||||
15, 1, 346, 2, 0x06 /* Public */,
|
||||
16, 1, 349, 2, 0x06 /* Public */,
|
||||
17, 1, 352, 2, 0x06 /* Public */,
|
||||
19, 1, 355, 2, 0x06 /* Public */,
|
||||
20, 1, 358, 2, 0x06 /* Public */,
|
||||
21, 1, 361, 2, 0x06 /* Public */,
|
||||
22, 1, 364, 2, 0x06 /* Public */,
|
||||
23, 1, 367, 2, 0x06 /* Public */,
|
||||
24, 1, 370, 2, 0x06 /* Public */,
|
||||
25, 1, 373, 2, 0x06 /* Public */,
|
||||
|
||||
// slots: name, argc, parameters, tag, flags
|
||||
26, 1, 381, 2, 0x0a /* Public */,
|
||||
28, 1, 384, 2, 0x0a /* Public */,
|
||||
31, 0, 387, 2, 0x0a /* Public */,
|
||||
32, 0, 388, 2, 0x0a /* Public */,
|
||||
33, 1, 389, 2, 0x0a /* Public */,
|
||||
34, 1, 392, 2, 0x0a /* Public */,
|
||||
35, 1, 395, 2, 0x0a /* Public */,
|
||||
36, 0, 398, 2, 0x0a /* Public */,
|
||||
37, 3, 399, 2, 0x0a /* Public */,
|
||||
41, 1, 406, 2, 0x0a /* Public */,
|
||||
43, 1, 409, 2, 0x0a /* Public */,
|
||||
45, 0, 412, 2, 0x0a /* Public */,
|
||||
46, 1, 413, 2, 0x0a /* Public */,
|
||||
47, 1, 416, 2, 0x0a /* Public */,
|
||||
49, 1, 419, 2, 0x0a /* Public */,
|
||||
50, 1, 422, 2, 0x0a /* Public */,
|
||||
51, 1, 425, 2, 0x0a /* Public */,
|
||||
52, 1, 428, 2, 0x0a /* Public */,
|
||||
53, 1, 431, 2, 0x0a /* Public */,
|
||||
54, 1, 434, 2, 0x0a /* Public */,
|
||||
56, 1, 437, 2, 0x0a /* Public */,
|
||||
57, 1, 440, 2, 0x0a /* Public */,
|
||||
59, 1, 443, 2, 0x0a /* Public */,
|
||||
60, 1, 446, 2, 0x0a /* Public */,
|
||||
61, 1, 449, 2, 0x0a /* Public */,
|
||||
63, 1, 452, 2, 0x0a /* Public */,
|
||||
65, 0, 455, 2, 0x0a /* Public */,
|
||||
66, 0, 456, 2, 0x0a /* Public */,
|
||||
67, 1, 457, 2, 0x0a /* Public */,
|
||||
68, 1, 460, 2, 0x0a /* Public */,
|
||||
69, 1, 463, 2, 0x0a /* Public */,
|
||||
70, 1, 466, 2, 0x0a /* Public */,
|
||||
71, 1, 469, 2, 0x0a /* Public */,
|
||||
72, 1, 472, 2, 0x0a /* Public */,
|
||||
73, 1, 475, 2, 0x0a /* Public */,
|
||||
74, 1, 478, 2, 0x0a /* Public */,
|
||||
75, 1, 481, 2, 0x0a /* Public */,
|
||||
76, 1, 484, 2, 0x0a /* Public */,
|
||||
77, 0, 487, 2, 0x0a /* Public */,
|
||||
78, 1, 488, 2, 0x0a /* Public */,
|
||||
80, 1, 491, 2, 0x0a /* Public */,
|
||||
82, 1, 494, 2, 0x0a /* Public */,
|
||||
83, 0, 497, 2, 0x0a /* Public */,
|
||||
26, 1, 376, 2, 0x0a /* Public */,
|
||||
28, 1, 379, 2, 0x0a /* Public */,
|
||||
31, 0, 382, 2, 0x0a /* Public */,
|
||||
32, 1, 383, 2, 0x0a /* Public */,
|
||||
33, 1, 386, 2, 0x0a /* Public */,
|
||||
34, 1, 389, 2, 0x0a /* Public */,
|
||||
35, 0, 392, 2, 0x0a /* Public */,
|
||||
36, 3, 393, 2, 0x0a /* Public */,
|
||||
40, 1, 400, 2, 0x0a /* Public */,
|
||||
42, 1, 403, 2, 0x0a /* Public */,
|
||||
44, 0, 406, 2, 0x0a /* Public */,
|
||||
45, 1, 407, 2, 0x0a /* Public */,
|
||||
46, 1, 410, 2, 0x0a /* Public */,
|
||||
48, 1, 413, 2, 0x0a /* Public */,
|
||||
49, 1, 416, 2, 0x0a /* Public */,
|
||||
50, 1, 419, 2, 0x0a /* Public */,
|
||||
51, 1, 422, 2, 0x0a /* Public */,
|
||||
52, 1, 425, 2, 0x0a /* Public */,
|
||||
53, 1, 428, 2, 0x0a /* Public */,
|
||||
55, 1, 431, 2, 0x0a /* Public */,
|
||||
56, 1, 434, 2, 0x0a /* Public */,
|
||||
58, 1, 437, 2, 0x0a /* Public */,
|
||||
59, 1, 440, 2, 0x0a /* Public */,
|
||||
60, 1, 443, 2, 0x0a /* Public */,
|
||||
62, 1, 446, 2, 0x0a /* Public */,
|
||||
64, 0, 449, 2, 0x0a /* Public */,
|
||||
65, 0, 450, 2, 0x0a /* Public */,
|
||||
66, 1, 451, 2, 0x0a /* Public */,
|
||||
67, 1, 454, 2, 0x0a /* Public */,
|
||||
68, 1, 457, 2, 0x0a /* Public */,
|
||||
69, 1, 460, 2, 0x0a /* Public */,
|
||||
70, 1, 463, 2, 0x0a /* Public */,
|
||||
71, 1, 466, 2, 0x0a /* Public */,
|
||||
72, 1, 469, 2, 0x0a /* Public */,
|
||||
73, 1, 472, 2, 0x0a /* Public */,
|
||||
74, 1, 475, 2, 0x0a /* Public */,
|
||||
75, 1, 478, 2, 0x0a /* Public */,
|
||||
76, 0, 481, 2, 0x0a /* Public */,
|
||||
77, 1, 482, 2, 0x0a /* Public */,
|
||||
79, 1, 485, 2, 0x0a /* Public */,
|
||||
81, 1, 488, 2, 0x0a /* Public */,
|
||||
82, 0, 491, 2, 0x0a /* Public */,
|
||||
|
||||
// signals: parameters
|
||||
QMetaType::Void, QMetaType::Double, 3,
|
||||
|
@ -254,29 +252,28 @@ static const uint qt_meta_data_isoDriver[] = {
|
|||
QMetaType::Void, QMetaType::Int, 27,
|
||||
QMetaType::Void, 0x80000000 | 29, 30,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void, QMetaType::Bool, QMetaType::Bool, QMetaType::Bool, 38, 39, 40,
|
||||
QMetaType::Void, QMetaType::Bool, 42,
|
||||
QMetaType::Void, QMetaType::Double, 44,
|
||||
QMetaType::Void, QMetaType::Bool, QMetaType::Bool, QMetaType::Bool, 37, 38, 39,
|
||||
QMetaType::Void, QMetaType::Bool, 41,
|
||||
QMetaType::Void, QMetaType::Double, 43,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, 0x80000000 | 48, 30,
|
||||
QMetaType::Void, 0x80000000 | 48, 30,
|
||||
QMetaType::Void, 0x80000000 | 48, 30,
|
||||
QMetaType::Void, 0x80000000 | 47, 30,
|
||||
QMetaType::Void, 0x80000000 | 47, 30,
|
||||
QMetaType::Void, 0x80000000 | 47, 30,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Double, 55,
|
||||
QMetaType::Void, QMetaType::Double, 54,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Int, 58,
|
||||
QMetaType::Void, QMetaType::Int, 57,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Int, 62,
|
||||
QMetaType::Void, QMetaType::Double, 64,
|
||||
QMetaType::Void, QMetaType::Int, 61,
|
||||
QMetaType::Void, QMetaType::Double, 63,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
|
@ -290,8 +287,8 @@ static const uint qt_meta_data_isoDriver[] = {
|
|||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void, QMetaType::Bool, 5,
|
||||
QMetaType::Void,
|
||||
QMetaType::Void, QMetaType::Double, 79,
|
||||
QMetaType::Void, QMetaType::Double, 81,
|
||||
QMetaType::Void, QMetaType::Double, 78,
|
||||
QMetaType::Void, QMetaType::Double, 80,
|
||||
QMetaType::Void, QMetaType::Double, 27,
|
||||
QMetaType::Void,
|
||||
|
||||
|
@ -326,46 +323,45 @@ void isoDriver::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id, v
|
|||
case 19: _t->setWindow((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 20: _t->setVoltageRange((*reinterpret_cast< QWheelEvent*(*)>(_a[1]))); break;
|
||||
case 21: _t->timerTick(); break;
|
||||
case 22: _t->recoveryTick(); break;
|
||||
case 23: _t->pauseEnable_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 24: _t->pauseEnable_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 25: _t->pauseEnable_multimeter((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 26: _t->startTimer(); break;
|
||||
case 27: _t->clearBuffers((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
|
||||
case 28: _t->setVisible_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 29: _t->gainBuffers((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 30: _t->gainTick(); break;
|
||||
case 31: _t->setAutoGain((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 32: _t->graphMousePress((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 33: _t->graphMouseRelease((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 34: _t->graphMouseMove((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 35: _t->cursorEnableHori((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 36: _t->cursorEnableVert((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 37: _t->setTriggerEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 38: _t->setTriggerLevel((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 39: _t->setSingleShotEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 40: _t->setTriggerMode((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 41: _t->setAC_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 42: _t->setAC_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 43: _t->setMultimeterType((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 44: _t->setSeriesResistance((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 45: _t->multimeterStats(); break;
|
||||
case 46: _t->enableMM(); break;
|
||||
case 47: _t->setAutoMultimeterV((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 48: _t->setAutoMultimeterI((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 49: _t->setForceMillivolts((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 50: _t->setForceMilliamps((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 51: _t->setForceVolts((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 52: _t->setForceAmps((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 53: _t->setSerialDecodeEnabled_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 54: _t->setSerialDecodeEnabled_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 55: _t->setXYmode((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 56: _t->triggerGroupStateChange((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 57: _t->slowTimerTick(); break;
|
||||
case 58: _t->setTopRange((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 59: _t->setBotRange((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 60: _t->setTimeWindow((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 61: _t->takeSnapshot(); break;
|
||||
case 22: _t->pauseEnable_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 23: _t->pauseEnable_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 24: _t->pauseEnable_multimeter((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 25: _t->startTimer(); break;
|
||||
case 26: _t->clearBuffers((*reinterpret_cast< bool(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2])),(*reinterpret_cast< bool(*)>(_a[3]))); break;
|
||||
case 27: _t->setVisible_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 28: _t->gainBuffers((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 29: _t->gainTick(); break;
|
||||
case 30: _t->setAutoGain((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 31: _t->graphMousePress((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 32: _t->graphMouseRelease((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 33: _t->graphMouseMove((*reinterpret_cast< QMouseEvent*(*)>(_a[1]))); break;
|
||||
case 34: _t->cursorEnableHori((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 35: _t->cursorEnableVert((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 36: _t->setTriggerEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 37: _t->setTriggerLevel((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 38: _t->setSingleShotEnabled((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 39: _t->setTriggerMode((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 40: _t->setAC_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 41: _t->setAC_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 42: _t->setMultimeterType((*reinterpret_cast< int(*)>(_a[1]))); break;
|
||||
case 43: _t->setSeriesResistance((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 44: _t->multimeterStats(); break;
|
||||
case 45: _t->enableMM(); break;
|
||||
case 46: _t->setAutoMultimeterV((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 47: _t->setAutoMultimeterI((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 48: _t->setForceMillivolts((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 49: _t->setForceMilliamps((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 50: _t->setForceVolts((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 51: _t->setForceAmps((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 52: _t->setSerialDecodeEnabled_CH1((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 53: _t->setSerialDecodeEnabled_CH2((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 54: _t->setXYmode((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 55: _t->triggerGroupStateChange((*reinterpret_cast< bool(*)>(_a[1]))); break;
|
||||
case 56: _t->slowTimerTick(); break;
|
||||
case 57: _t->setTopRange((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 58: _t->setBotRange((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 59: _t->setTimeWindow((*reinterpret_cast< double(*)>(_a[1]))); break;
|
||||
case 60: _t->takeSnapshot(); break;
|
||||
default: ;
|
||||
}
|
||||
} else if (_c == QMetaObject::IndexOfMethod) {
|
||||
|
@ -532,13 +528,13 @@ int isoDriver::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
|||
if (_id < 0)
|
||||
return _id;
|
||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||
if (_id < 62)
|
||||
if (_id < 61)
|
||||
qt_static_metacall(this, _c, _id, _a);
|
||||
_id -= 62;
|
||||
_id -= 61;
|
||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||
if (_id < 62)
|
||||
if (_id < 61)
|
||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||
_id -= 62;
|
||||
_id -= 61;
|
||||
}
|
||||
return _id;
|
||||
}
|
||||
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -5,13 +5,10 @@ winUsbDriver::winUsbDriver(QWidget *parent) : QLabel(parent)
|
|||
qDebug() << "Making USB Driver invisible!!";
|
||||
this->hide();
|
||||
//Load stack so that reset signal can be sent
|
||||
firstConnect = usbInit(0x03eb, 0xa000);
|
||||
|
||||
if(firstConnect){
|
||||
usbInit(0x03eb, 0xa000);
|
||||
setDeviceMode(deviceMode);
|
||||
usbSendControl(0x40, 0xa7, 0, 0, 0, NULL);
|
||||
//Stack will reinitialise TIMER_PERIOD seconds later, after first failed iso request
|
||||
}
|
||||
newDig(digitalPinState);
|
||||
usbIsoInit();
|
||||
|
||||
psuTimer = new QTimer();
|
||||
psuTimer->setTimerType(Qt::PreciseTimer);
|
||||
|
@ -264,53 +261,121 @@ void winUsbDriver::newDig(int digState){
|
|||
}
|
||||
|
||||
unsigned char winUsbDriver::usbIsoInit(void){
|
||||
unsigned char success;
|
||||
unsigned int transferred;
|
||||
int n;
|
||||
bool success;
|
||||
DWORD errorCode = ERROR_SUCCESS;
|
||||
|
||||
success = StmK_Init(
|
||||
&stm_handle,
|
||||
handle,
|
||||
pipeID,
|
||||
MAX_TRANSFER_SIZE,
|
||||
MAX_PENDING_TRANSFERS,
|
||||
MAX_PENDING_IO,
|
||||
NULL,
|
||||
KSTM_FLAG_NONE);
|
||||
if (!success){
|
||||
success = OvlK_Init(&ovlPool, handle, MAX_OVERLAP, (KOVL_POOL_FLAG) 0);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug("StmK_Init failed. ErrorCode: %08Xh\n", errorCode);
|
||||
qDebug() << "OvlK_Init failed with error code" << errorCode;
|
||||
return 0;
|
||||
}
|
||||
success = UsbK_ResetPipe(handle, pipeID);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug() << "UsbK_ResetPipe failed with error code" << errorCode;
|
||||
return 0;
|
||||
}
|
||||
|
||||
success = StmK_Start(stm_handle);
|
||||
if (!success){
|
||||
for(n=0;n<NUM_FUTURE_CTX;n++){
|
||||
success = IsoK_Init(&isoCtx[n], ISO_PACKETS_PER_CTX, n*ISO_PACKETS_PER_CTX);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug("StmK_Start failed. ErrorCode: %08Xh\n", errorCode);
|
||||
qDebug() << "IsoK_Init failed with error code" << errorCode;
|
||||
qDebug() << "n =" << n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
qDebug("[Start Stream] successful!\n");
|
||||
success = IsoK_SetPackets(isoCtx[n], ISO_PACKET_SIZE);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug() << "IsoK_SetPackets failed with error code" << errorCode;
|
||||
qDebug() << "n =" << n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
success = OvlK_Acquire(&ovlkHandle[n], ovlPool);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug() << "OvlK_Acquire failed with error code" << errorCode;
|
||||
qDebug() << "n =" << n;
|
||||
return 0;
|
||||
}
|
||||
|
||||
success = UsbK_IsoReadPipe(handle, pipeID, dataBuffer[n], sizeof(dataBuffer[n]), (LPOVERLAPPED) ovlkHandle[n], isoCtx[n]);
|
||||
}
|
||||
qDebug() << "Iso Setup Successful";
|
||||
return 1;
|
||||
}
|
||||
|
||||
char *winUsbDriver::isoRead(int numSamples){
|
||||
char *winUsbDriver::isoRead(){
|
||||
unsigned char *returnBuffer;
|
||||
unsigned char success;
|
||||
|
||||
bool success;
|
||||
DWORD errorCode = ERROR_SUCCESS;
|
||||
unsigned int allocBytes = 0;
|
||||
int n, i, j;
|
||||
unsigned int returnBufferOffset = 8;
|
||||
unsigned int dataBufferOffset;
|
||||
|
||||
returnBuffer = (unsigned char *) malloc(numSamples + 8); //8-byte header contains (unsigned long) length
|
||||
|
||||
success = StmK_Read(stm_handle, returnBuffer+8, 0, numSamples, (PUINT) returnBuffer);
|
||||
//qDebug("%d bytes copied, out of a possible %d\n", *((PUINT)returnBuffer), numSamples);
|
||||
if (!success) {
|
||||
errorCode = GetLastError();
|
||||
qDebug("StmkK_Read failed. ErrorCode: %08Xh\n", errorCode);
|
||||
reinitialise(0);
|
||||
free(returnBuffer);
|
||||
return (char*) malloc(numSamples + 8);
|
||||
//printf("No more items = %08Xh\n", ERROR_NO_MORE_ITEMS);
|
||||
//Calculate how much data needs to be allocated
|
||||
for (n=0; n<NUM_FUTURE_CTX; n++){
|
||||
if(OvlK_IsComplete(ovlkHandle[n])){
|
||||
for(i=0;i<isoCtx[n]->NumberOfPackets;i++){
|
||||
allocBytes +=isoCtx[n]->IsoPackets[i].Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
//Allocate it (why am I allocating a new buffer every time?)
|
||||
returnBuffer = (unsigned char *) malloc(allocBytes + 8); //Extra 8 bytes for the "header" that contains length of "packet" as unsigned int.
|
||||
((unsigned int *) returnBuffer)[0] = allocBytes;
|
||||
|
||||
//Fill the memory with the relevant samples
|
||||
//Note that this will return garbage if more than one isoCtx has completed.
|
||||
//The above condition should only ever occur if the polling rate is slower than ISO_PACKETS_PER_CTX, though.
|
||||
//(Or if some heinous external force stops the polling and gives it a long "temporary period"!!)
|
||||
for (n=0; n<NUM_FUTURE_CTX; n++){
|
||||
if(OvlK_IsComplete(ovlkHandle[n])){
|
||||
//qDebug("Transfer %d is complete!!", n);
|
||||
|
||||
//Copy the iso packet
|
||||
char currentString[8];
|
||||
for(i=0;i<isoCtx[n]->NumberOfPackets;i++){
|
||||
dataBufferOffset = isoCtx[n]->IsoPackets[i].Offset;
|
||||
//memcpy(&returnBuffer[returnBufferOffset], &dataBuffer[n][dataBufferOffset], isoCtx[n]->IsoPackets[i].Length);
|
||||
for(int j=0;j<isoCtx[n]->IsoPackets[i].Length;j++){
|
||||
returnBuffer[returnBufferOffset+j] = dataBuffer[n][dataBufferOffset+j];
|
||||
}
|
||||
returnBufferOffset += isoCtx[n]->IsoPackets[i].Length;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Setup next transfer
|
||||
UINT oldStart = isoCtx[n]->StartFrame;
|
||||
success = IsoK_ReUse(isoCtx[n]);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug() << "IsoK_Init failed with error code" << errorCode;
|
||||
qDebug() << "n =" << n;
|
||||
return (char*) returnBuffer;
|
||||
}
|
||||
isoCtx[n]->StartFrame = oldStart + ISO_PACKETS_PER_CTX*NUM_FUTURE_CTX;
|
||||
//qDebug() << oldStart;
|
||||
//qDebug() << isoCtx[n]->StartFrame;
|
||||
//qDebug() << handle;
|
||||
|
||||
success = OvlK_ReUse(ovlkHandle[n]);
|
||||
if(!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug() << "OvlK_ReUse failed with error code" << errorCode;
|
||||
qDebug() << "n =" << n;
|
||||
return (char*) returnBuffer;
|
||||
}
|
||||
success = UsbK_IsoReadPipe(handle, pipeID, dataBuffer[n], sizeof(dataBuffer[n]), (LPOVERLAPPED) ovlkHandle[n], isoCtx[n]);
|
||||
}
|
||||
//qDebug("%d bytes need to be allocated", allocBytes);
|
||||
|
||||
return (char*) returnBuffer;
|
||||
}
|
||||
|
@ -320,21 +385,6 @@ winUsbDriver::~winUsbDriver(void){
|
|||
unsigned char success;
|
||||
DWORD errorCode = ERROR_SUCCESS;
|
||||
|
||||
success = StmK_Stop(stm_handle, 0);
|
||||
if (!success)
|
||||
{
|
||||
errorCode = GetLastError();
|
||||
qDebug("StmK_Stop failed. ErrorCode: %08Xh\n", errorCode);
|
||||
}
|
||||
qDebug("[Stop Stream] successful!\n");
|
||||
|
||||
success = StmK_Free(stm_handle);
|
||||
if (!success)
|
||||
{
|
||||
errorCode = GetLastError();
|
||||
qDebug("StmK_Free failed. ErrorCode: %08Xh\n", errorCode);
|
||||
}
|
||||
|
||||
UsbK_Free(handle);
|
||||
}
|
||||
|
||||
|
@ -434,64 +484,6 @@ void winUsbDriver::setGain(double newGain){
|
|||
usbSendControl(0x40, 0xa5, deviceMode, gainMask, 0, NULL);
|
||||
}
|
||||
|
||||
void winUsbDriver::reinitialise(bool forceAttempt){
|
||||
|
||||
if (!forceAttempt){
|
||||
if(recoveryInProcess == true) {
|
||||
//qDebug() << "Cancelling reinitialise()";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
recoveryInProcess = true;
|
||||
|
||||
unsigned char success;
|
||||
DWORD errorCode = ERROR_SUCCESS;
|
||||
|
||||
success = UsbK_Free(handle);
|
||||
if (!success){
|
||||
errorCode = GetLastError();
|
||||
qDebug("UsbK_Free (reinit) failed. ErrorCode: %08Xh\n", errorCode);
|
||||
}
|
||||
//else qDebug() << "Handle freed successfully!";
|
||||
|
||||
if(forceAttempt){
|
||||
StmK_Free(stm_handle);
|
||||
stm_handle = NULL;
|
||||
}
|
||||
//UsbK_ResetDevice(handle);
|
||||
unsigned char initSuccess = usbInit(0x03eb, 0xa000);
|
||||
//qDebug() << "usbInit(0x03eb, 0xa000) returned" << initSuccess;
|
||||
|
||||
if (!initSuccess){
|
||||
recoverySuccess = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
setDeviceMode(deviceMode);
|
||||
//qDebug() << "setDeviceMode(deviceMode) returned" << deviceSuccess;
|
||||
if (fGenPtr_CH1 != NULL) {
|
||||
//qDebug() << "setFunctionGen(0, fGenPtr_CH1)";
|
||||
setFunctionGen(0, fGenPtr_CH1);
|
||||
}
|
||||
if (fGenPtr_CH2 != NULL){
|
||||
//qDebug() << "setFunctionGen(1, fGenPtr_CH2)";
|
||||
setFunctionGen(1, fGenPtr_CH2);
|
||||
}
|
||||
newDig(digitalPinState);
|
||||
|
||||
|
||||
unsigned char isoInitSuccess = usbIsoInit();
|
||||
//qDebug() << "usbIsoInit() returned" << isoInitSuccess;
|
||||
|
||||
recoverySuccess = initSuccess && isoInitSuccess;
|
||||
|
||||
if(recoverySuccess){
|
||||
//qDebug() << "reinitialise() completed successfully";
|
||||
}
|
||||
//else qDebug() << "reinitialise() completed with errors";
|
||||
}
|
||||
|
||||
void winUsbDriver::avrDebug(void){
|
||||
usbSendControl(0x40, 0xa0, 0, 0, 0, NULL);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
#ifndef WINUSBDRIVER_H
|
||||
#define WINUSBDRIVER_H
|
||||
|
||||
//Note that big parts of this were adapted from the LibusbK example code by Travis Robinson and Xiaofan Chen.
|
||||
//Actually, I'm not sure how much input Xiaofan had on the example code, but he maintains LibusbK now and deserves a lot of credit for that!
|
||||
//Thanks guys!
|
||||
|
||||
#include <QWidget>
|
||||
#include <QLabel>
|
||||
#include <QDebug>
|
||||
|
@ -18,46 +22,57 @@
|
|||
#include <conio.h>
|
||||
#include "libusbk.h"
|
||||
|
||||
|
||||
#define ISO_PACKET_SIZE 1023
|
||||
#define ISO_PACKETS_PER_CTX 18
|
||||
#define NUM_FUTURE_CTX 4
|
||||
#define MAX_OVERLAP NUM_FUTURE_CTX+1
|
||||
|
||||
class winUsbDriver : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit winUsbDriver(QWidget *parent = 0);
|
||||
char *isoRead(int numSamples);
|
||||
~winUsbDriver();
|
||||
bool recoveryInProcess = false;
|
||||
unsigned char recoverySuccess;
|
||||
void reinitialise(bool secondStage);
|
||||
//Generic vars
|
||||
int deviceMode = INIT_DEVICE_MODE;
|
||||
void setBufferPtr(bufferControl *newPtr);
|
||||
double scopeGain = 0.5;
|
||||
int dutyTemp = 0;
|
||||
//Generic Functions
|
||||
explicit winUsbDriver(QWidget *parent = 0);
|
||||
char *isoRead();
|
||||
~winUsbDriver();
|
||||
void setBufferPtr(bufferControl *newPtr);
|
||||
private:
|
||||
unsigned char fGenTriple=0;
|
||||
//Libusbk
|
||||
//GENERIC
|
||||
KUSB_HANDLE handle = NULL;
|
||||
unsigned short gainMask = 2056;
|
||||
KSTM_HANDLE stm_handle = NULL;
|
||||
unsigned char pipeID = 0x83;
|
||||
unsigned char usbInit(ULONG VIDin, ULONG PIDin);
|
||||
void usbSendControl(int RequestType, int Request, int Value, int Index, int Length, unsigned char *LDATA);
|
||||
void xmegaBreak(void);
|
||||
unsigned char usbIsoInit(void);
|
||||
int fGenChannel;
|
||||
functionGenControl *fGenPtr_CH1 = NULL, *fGenPtr_CH2 = NULL;
|
||||
bufferControl *bufferPtr = NULL;
|
||||
int dutyPsu = 0;
|
||||
QTimer *psuTimer;
|
||||
bool firstConnect = false;
|
||||
double currentPsuVoltage;
|
||||
DWORD ec = ERROR_SUCCESS;
|
||||
//INIT
|
||||
KLST_DEVINFO_HANDLE deviceInfo = NULL;
|
||||
WINUSB_PIPE_INFORMATION pipeInfo;
|
||||
UINT deviceCount = 0;
|
||||
UCHAR pipeIndex = 0;
|
||||
DWORD ec = ERROR_SUCCESS;
|
||||
KLST_HANDLE deviceList = NULL;
|
||||
//ISO
|
||||
PKISO_CONTEXT isoCtx[NUM_FUTURE_CTX];
|
||||
KOVL_HANDLE ovlkHandle[NUM_FUTURE_CTX];
|
||||
KOVL_POOL_HANDLE ovlPool;
|
||||
unsigned char dataBuffer[NUM_FUTURE_CTX][ISO_PACKET_SIZE*ISO_PACKETS_PER_CTX];
|
||||
//Labrador Board state data (mostly)
|
||||
unsigned char fGenTriple=0;
|
||||
unsigned short gainMask = 2056;
|
||||
int fGenChannel;
|
||||
int dutyPsu = 0;
|
||||
double currentPsuVoltage;
|
||||
int digitalPinState = 0;
|
||||
//Generic vars
|
||||
functionGenControl *fGenPtr_CH1 = NULL, *fGenPtr_CH2 = NULL;
|
||||
bufferControl *bufferPtr = NULL;
|
||||
QTimer *psuTimer;
|
||||
//Generic Functions
|
||||
unsigned char usbInit(ULONG VIDin, ULONG PIDin);
|
||||
void usbSendControl(int RequestType, int Request, int Value, int Index, int Length, unsigned char *LDATA);
|
||||
void xmegaBreak(void);
|
||||
unsigned char usbIsoInit(void);
|
||||
signals:
|
||||
void sendClearBuffer(bool ch3751, bool ch3752, bool ch750);
|
||||
void setVisible_CH2(bool visible);
|
||||
|
|
Loading…
Reference in New Issue