mirror of https://github.com/EspoTek/Labrador.git
Found bug. All iso packets have length 0.
This commit is contained in:
parent
36b9be5837
commit
88ce3aec39
|
@ -42,3 +42,7 @@ Desktop_Interface/bin/Labrador
|
||||||
pinout.png
|
pinout.png
|
||||||
Matlab_Octave_API/___librador/build-librador-Desktop_Qt_5_10_0_GCC_64bit-Release
|
Matlab_Octave_API/___librador/build-librador-Desktop_Qt_5_10_0_GCC_64bit-Release
|
||||||
Matlab_Octave_API/___librador/build-librador-Desktop_Qt_5_10_0_GCC_64bit-Debug
|
Matlab_Octave_API/___librador/build-librador-Desktop_Qt_5_10_0_GCC_64bit-Debug
|
||||||
|
|
||||||
|
Matlab_Octave_API/___librador/demo/librademo/Makefile
|
||||||
|
|
||||||
|
Matlab_Octave_API/___librador/demo/librademo/librademo
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -4,7 +4,7 @@
|
||||||
#
|
#
|
||||||
#-------------------------------------------------
|
#-------------------------------------------------
|
||||||
|
|
||||||
QT += core gui
|
QT += core gui widgets printsupport
|
||||||
|
|
||||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||||
|
|
||||||
|
@ -25,10 +25,17 @@ DEFINES += QT_DEPRECATED_WARNINGS
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
main.cpp \
|
main.cpp \
|
||||||
mainwindow.cpp
|
mainwindow.cpp \
|
||||||
|
../../../../Desktop_Interface/ui_elements/qcp1/qcustomplot.cpp
|
||||||
|
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
mainwindow.h
|
mainwindow.h \
|
||||||
|
../../../../Desktop_Interface/ui_elements/qcp1/qcustomplot.h
|
||||||
|
|
||||||
|
INCLUDEPATH += \
|
||||||
|
../../../../Desktop_Interface/ui_elements/qcp1
|
||||||
|
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
mainwindow.ui
|
mainwindow.ui
|
||||||
|
@ -40,14 +47,14 @@ unix:DEPENDPATH += ../../librador
|
||||||
|
|
||||||
unix:!android:!macx {
|
unix:!android:!macx {
|
||||||
#libusb include
|
#libusb include
|
||||||
LIBS += -L../../../Desktop_Interface/build_linux/libusb -lusb-1.0 ##I suspect the -L here does nothing!
|
LIBS += -L../../../../Desktop_Interface/build_linux/libusb -lusb-1.0 ##I suspect the -L here does nothing!
|
||||||
INCLUDEPATH += ../../../Desktop_Interface/build_linux/libusb
|
INCLUDEPATH += ../../../../Desktop_Interface/build_linux/libusb
|
||||||
DEPENDPATH += ../../../Desktop_Interface/build_linux/libusb
|
DEPENDPATH += ../../../../Desktop_Interface/build_linux/libusb
|
||||||
|
|
||||||
#libdfuprog include
|
#libdfuprog include
|
||||||
LIBS += -L../../../Desktop_Interface/build_linux/libdfuprog/lib/x64 -ldfuprog-0.9
|
LIBS += -L../../../../Desktop_Interface/build_linux/libdfuprog/lib/x64 -ldfuprog-0.9
|
||||||
INCLUDEPATH += ../../../Desktop_Interface/build_linux/libdfuprog/include
|
INCLUDEPATH += ../../../../Desktop_Interface/build_linux/libdfuprog/include
|
||||||
DEPENDPATH += ../../../Desktop_Interface/build_linux/libdfuprog/include
|
DEPENDPATH += ../../../../Desktop_Interface/build_linux/libdfuprog/include
|
||||||
|
|
||||||
#linux defines
|
#linux defines
|
||||||
DEFINES += \
|
DEFINES += \
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "librador.h"
|
#include "librador.h"
|
||||||
#include "QDebug"
|
#include "QDebug"
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent) :
|
MainWindow::MainWindow(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
|
@ -10,6 +11,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setbuf(stdout, 0);
|
setbuf(stdout, 0);
|
||||||
setbuf(stderr, 0);
|
setbuf(stderr, 0);
|
||||||
|
initialisePlot();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -17,6 +19,37 @@ MainWindow::~MainWindow()
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::initialisePlot()
|
||||||
|
{
|
||||||
|
ui->widget->addGraph();
|
||||||
|
ui->widget->addGraph();
|
||||||
|
|
||||||
|
ui->widget->yAxis->setAutoTickCount(9);
|
||||||
|
ui->widget->xAxis->setAutoTickCount(9);
|
||||||
|
|
||||||
|
ui->widget->graph(0)->setPen(QPen(Qt::yellow, 1));
|
||||||
|
ui->widget->graph(1)->setPen(QPen(Qt::cyan, 1));
|
||||||
|
|
||||||
|
ui->widget->xAxis->setBasePen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->yAxis->setBasePen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->xAxis->setTickPen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->yAxis->setTickPen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->xAxis->setSubTickPen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->yAxis->setSubTickPen(QPen(Qt::white, 1));
|
||||||
|
ui->widget->xAxis->setTickLength(6);
|
||||||
|
ui->widget->yAxis->setTickLength(6);
|
||||||
|
ui->widget->xAxis->setSubTickLength(4);
|
||||||
|
ui->widget->yAxis->setSubTickLength(4);
|
||||||
|
ui->widget->xAxis->setTickLabelColor(Qt::white);
|
||||||
|
ui->widget->yAxis->setTickLabelColor(Qt::white);
|
||||||
|
|
||||||
|
ui->widget->setBackground(Qt::black);
|
||||||
|
|
||||||
|
|
||||||
|
ui->widget->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_pushButton_clicked()
|
void MainWindow::on_pushButton_clicked()
|
||||||
{
|
{
|
||||||
qDebug() << librador_init();
|
qDebug() << librador_init();
|
||||||
|
@ -36,3 +69,26 @@ void MainWindow::on_pushButton_4_clicked()
|
||||||
{
|
{
|
||||||
qDebug() << librador_avr_debug();
|
qDebug() << librador_avr_debug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_pushButton_5_clicked()
|
||||||
|
{
|
||||||
|
|
||||||
|
QVector<double> yaxis = QVector<double>::fromStdVector(*(librador_get_iso_data(75000, 1, 750000, 0)));
|
||||||
|
|
||||||
|
qDebug() << yaxis;
|
||||||
|
|
||||||
|
QVector<double> xaxis;
|
||||||
|
for (int i=0; i<yaxis.length(); i++){
|
||||||
|
xaxis.append(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
qDebug() << yaxis.length();
|
||||||
|
qDebug() << xaxis.length();
|
||||||
|
|
||||||
|
ui->widget->yAxis->setRange(0, 255);
|
||||||
|
ui->widget->xAxis->setRange(0, yaxis.length());
|
||||||
|
|
||||||
|
ui->widget->graph(0)->setData(xaxis, yaxis);
|
||||||
|
ui->widget->replot();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,8 @@ class MainWindow : public QMainWindow
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = 0);
|
explicit MainWindow(QWidget *parent = 0);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
|
private:
|
||||||
|
void initialisePlot();
|
||||||
private slots:
|
private slots:
|
||||||
void on_pushButton_clicked();
|
void on_pushButton_clicked();
|
||||||
|
|
||||||
|
@ -23,6 +25,8 @@ private slots:
|
||||||
|
|
||||||
void on_pushButton_4_clicked();
|
void on_pushButton_4_clicked();
|
||||||
|
|
||||||
|
void on_pushButton_5_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -6,42 +6,56 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>1280</width>
|
||||||
<height>300</height>
|
<height>720</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>MainWindow</string>
|
<string>MainWindow</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralWidget">
|
<widget class="QWidget" name="centralWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="text">
|
<item>
|
||||||
<string>Open API</string>
|
<widget class="QPushButton" name="pushButton">
|
||||||
</property>
|
<property name="text">
|
||||||
</widget>
|
<string>Open API</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Close API</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Setup USB</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>avrDebug()</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="pushButton_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Get Scope Data</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_2">
|
<widget class="QCustomPlot" name="widget" native="true"/>
|
||||||
<property name="text">
|
|
||||||
<string>Close API</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Setup USB</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="pushButton_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>avrDebug()</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -50,7 +64,7 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>400</width>
|
<width>1280</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
@ -66,6 +80,14 @@
|
||||||
<widget class="QStatusBar" name="statusBar"/>
|
<widget class="QStatusBar" name="statusBar"/>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QCustomPlot</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qcustomplot.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
</ui>
|
</ui>
|
||||||
|
|
|
@ -21,8 +21,8 @@ QT_BEGIN_MOC_NAMESPACE
|
||||||
QT_WARNING_PUSH
|
QT_WARNING_PUSH
|
||||||
QT_WARNING_DISABLE_DEPRECATED
|
QT_WARNING_DISABLE_DEPRECATED
|
||||||
struct qt_meta_stringdata_MainWindow_t {
|
struct qt_meta_stringdata_MainWindow_t {
|
||||||
QByteArrayData data[6];
|
QByteArrayData data[7];
|
||||||
char stringdata0[106];
|
char stringdata0[130];
|
||||||
};
|
};
|
||||||
#define QT_MOC_LITERAL(idx, ofs, len) \
|
#define QT_MOC_LITERAL(idx, ofs, len) \
|
||||||
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
Q_STATIC_BYTE_ARRAY_DATA_HEADER_INITIALIZER_WITH_OFFSET(len, \
|
||||||
|
@ -36,12 +36,13 @@ QT_MOC_LITERAL(1, 11, 21), // "on_pushButton_clicked"
|
||||||
QT_MOC_LITERAL(2, 33, 0), // ""
|
QT_MOC_LITERAL(2, 33, 0), // ""
|
||||||
QT_MOC_LITERAL(3, 34, 23), // "on_pushButton_2_clicked"
|
QT_MOC_LITERAL(3, 34, 23), // "on_pushButton_2_clicked"
|
||||||
QT_MOC_LITERAL(4, 58, 23), // "on_pushButton_3_clicked"
|
QT_MOC_LITERAL(4, 58, 23), // "on_pushButton_3_clicked"
|
||||||
QT_MOC_LITERAL(5, 82, 23) // "on_pushButton_4_clicked"
|
QT_MOC_LITERAL(5, 82, 23), // "on_pushButton_4_clicked"
|
||||||
|
QT_MOC_LITERAL(6, 106, 23) // "on_pushButton_5_clicked"
|
||||||
|
|
||||||
},
|
},
|
||||||
"MainWindow\0on_pushButton_clicked\0\0"
|
"MainWindow\0on_pushButton_clicked\0\0"
|
||||||
"on_pushButton_2_clicked\0on_pushButton_3_clicked\0"
|
"on_pushButton_2_clicked\0on_pushButton_3_clicked\0"
|
||||||
"on_pushButton_4_clicked"
|
"on_pushButton_4_clicked\0on_pushButton_5_clicked"
|
||||||
};
|
};
|
||||||
#undef QT_MOC_LITERAL
|
#undef QT_MOC_LITERAL
|
||||||
|
|
||||||
|
@ -51,7 +52,7 @@ static const uint qt_meta_data_MainWindow[] = {
|
||||||
7, // revision
|
7, // revision
|
||||||
0, // classname
|
0, // classname
|
||||||
0, 0, // classinfo
|
0, 0, // classinfo
|
||||||
4, 14, // methods
|
5, 14, // methods
|
||||||
0, 0, // properties
|
0, 0, // properties
|
||||||
0, 0, // enums/sets
|
0, 0, // enums/sets
|
||||||
0, 0, // constructors
|
0, 0, // constructors
|
||||||
|
@ -59,15 +60,17 @@ static const uint qt_meta_data_MainWindow[] = {
|
||||||
0, // signalCount
|
0, // signalCount
|
||||||
|
|
||||||
// slots: name, argc, parameters, tag, flags
|
// slots: name, argc, parameters, tag, flags
|
||||||
1, 0, 34, 2, 0x08 /* Private */,
|
1, 0, 39, 2, 0x08 /* Private */,
|
||||||
3, 0, 35, 2, 0x08 /* Private */,
|
3, 0, 40, 2, 0x08 /* Private */,
|
||||||
4, 0, 36, 2, 0x08 /* Private */,
|
4, 0, 41, 2, 0x08 /* Private */,
|
||||||
5, 0, 37, 2, 0x08 /* Private */,
|
5, 0, 42, 2, 0x08 /* Private */,
|
||||||
|
6, 0, 43, 2, 0x08 /* Private */,
|
||||||
|
|
||||||
// slots: parameters
|
// slots: parameters
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
|
QMetaType::Void,
|
||||||
QMetaType::Void,
|
QMetaType::Void,
|
||||||
|
|
||||||
0 // eod
|
0 // eod
|
||||||
|
@ -83,6 +86,7 @@ void MainWindow::qt_static_metacall(QObject *_o, QMetaObject::Call _c, int _id,
|
||||||
case 1: _t->on_pushButton_2_clicked(); break;
|
case 1: _t->on_pushButton_2_clicked(); break;
|
||||||
case 2: _t->on_pushButton_3_clicked(); break;
|
case 2: _t->on_pushButton_3_clicked(); break;
|
||||||
case 3: _t->on_pushButton_4_clicked(); break;
|
case 3: _t->on_pushButton_4_clicked(); break;
|
||||||
|
case 4: _t->on_pushButton_5_clicked(); break;
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,13 +118,13 @@ int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
|
||||||
if (_id < 0)
|
if (_id < 0)
|
||||||
return _id;
|
return _id;
|
||||||
if (_c == QMetaObject::InvokeMetaMethod) {
|
if (_c == QMetaObject::InvokeMetaMethod) {
|
||||||
if (_id < 4)
|
if (_id < 5)
|
||||||
qt_static_metacall(this, _c, _id, _a);
|
qt_static_metacall(this, _c, _id, _a);
|
||||||
_id -= 4;
|
_id -= 5;
|
||||||
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
} else if (_c == QMetaObject::RegisterMethodArgumentMetaType) {
|
||||||
if (_id < 4)
|
if (_id < 5)
|
||||||
*reinterpret_cast<int*>(_a[0]) = -1;
|
*reinterpret_cast<int*>(_a[0]) = -1;
|
||||||
_id -= 4;
|
_id -= 5;
|
||||||
}
|
}
|
||||||
return _id;
|
return _id;
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,7 @@
|
||||||
#include <QtWidgets/QAction>
|
#include <QtWidgets/QAction>
|
||||||
#include <QtWidgets/QApplication>
|
#include <QtWidgets/QApplication>
|
||||||
#include <QtWidgets/QButtonGroup>
|
#include <QtWidgets/QButtonGroup>
|
||||||
|
#include <QtWidgets/QHBoxLayout>
|
||||||
#include <QtWidgets/QHeaderView>
|
#include <QtWidgets/QHeaderView>
|
||||||
#include <QtWidgets/QMainWindow>
|
#include <QtWidgets/QMainWindow>
|
||||||
#include <QtWidgets/QMenuBar>
|
#include <QtWidgets/QMenuBar>
|
||||||
|
@ -21,6 +22,7 @@
|
||||||
#include <QtWidgets/QToolBar>
|
#include <QtWidgets/QToolBar>
|
||||||
#include <QtWidgets/QVBoxLayout>
|
#include <QtWidgets/QVBoxLayout>
|
||||||
#include <QtWidgets/QWidget>
|
#include <QtWidgets/QWidget>
|
||||||
|
#include "qcustomplot.h"
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
@ -28,11 +30,14 @@ class Ui_MainWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWidget *centralWidget;
|
QWidget *centralWidget;
|
||||||
|
QHBoxLayout *horizontalLayout;
|
||||||
QVBoxLayout *verticalLayout;
|
QVBoxLayout *verticalLayout;
|
||||||
QPushButton *pushButton;
|
QPushButton *pushButton;
|
||||||
QPushButton *pushButton_2;
|
QPushButton *pushButton_2;
|
||||||
QPushButton *pushButton_3;
|
QPushButton *pushButton_3;
|
||||||
QPushButton *pushButton_4;
|
QPushButton *pushButton_4;
|
||||||
|
QPushButton *pushButton_5;
|
||||||
|
QCustomPlot *widget;
|
||||||
QMenuBar *menuBar;
|
QMenuBar *menuBar;
|
||||||
QToolBar *mainToolBar;
|
QToolBar *mainToolBar;
|
||||||
QStatusBar *statusBar;
|
QStatusBar *statusBar;
|
||||||
|
@ -41,12 +46,15 @@ public:
|
||||||
{
|
{
|
||||||
if (MainWindow->objectName().isEmpty())
|
if (MainWindow->objectName().isEmpty())
|
||||||
MainWindow->setObjectName(QStringLiteral("MainWindow"));
|
MainWindow->setObjectName(QStringLiteral("MainWindow"));
|
||||||
MainWindow->resize(400, 300);
|
MainWindow->resize(1280, 720);
|
||||||
centralWidget = new QWidget(MainWindow);
|
centralWidget = new QWidget(MainWindow);
|
||||||
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
centralWidget->setObjectName(QStringLiteral("centralWidget"));
|
||||||
verticalLayout = new QVBoxLayout(centralWidget);
|
horizontalLayout = new QHBoxLayout(centralWidget);
|
||||||
|
horizontalLayout->setSpacing(6);
|
||||||
|
horizontalLayout->setContentsMargins(11, 11, 11, 11);
|
||||||
|
horizontalLayout->setObjectName(QStringLiteral("horizontalLayout"));
|
||||||
|
verticalLayout = new QVBoxLayout();
|
||||||
verticalLayout->setSpacing(6);
|
verticalLayout->setSpacing(6);
|
||||||
verticalLayout->setContentsMargins(11, 11, 11, 11);
|
|
||||||
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
verticalLayout->setObjectName(QStringLiteral("verticalLayout"));
|
||||||
pushButton = new QPushButton(centralWidget);
|
pushButton = new QPushButton(centralWidget);
|
||||||
pushButton->setObjectName(QStringLiteral("pushButton"));
|
pushButton->setObjectName(QStringLiteral("pushButton"));
|
||||||
|
@ -68,10 +76,23 @@ public:
|
||||||
|
|
||||||
verticalLayout->addWidget(pushButton_4);
|
verticalLayout->addWidget(pushButton_4);
|
||||||
|
|
||||||
|
pushButton_5 = new QPushButton(centralWidget);
|
||||||
|
pushButton_5->setObjectName(QStringLiteral("pushButton_5"));
|
||||||
|
|
||||||
|
verticalLayout->addWidget(pushButton_5);
|
||||||
|
|
||||||
|
|
||||||
|
horizontalLayout->addLayout(verticalLayout);
|
||||||
|
|
||||||
|
widget = new QCustomPlot(centralWidget);
|
||||||
|
widget->setObjectName(QStringLiteral("widget"));
|
||||||
|
|
||||||
|
horizontalLayout->addWidget(widget);
|
||||||
|
|
||||||
MainWindow->setCentralWidget(centralWidget);
|
MainWindow->setCentralWidget(centralWidget);
|
||||||
menuBar = new QMenuBar(MainWindow);
|
menuBar = new QMenuBar(MainWindow);
|
||||||
menuBar->setObjectName(QStringLiteral("menuBar"));
|
menuBar->setObjectName(QStringLiteral("menuBar"));
|
||||||
menuBar->setGeometry(QRect(0, 0, 400, 22));
|
menuBar->setGeometry(QRect(0, 0, 1280, 22));
|
||||||
MainWindow->setMenuBar(menuBar);
|
MainWindow->setMenuBar(menuBar);
|
||||||
mainToolBar = new QToolBar(MainWindow);
|
mainToolBar = new QToolBar(MainWindow);
|
||||||
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
|
mainToolBar->setObjectName(QStringLiteral("mainToolBar"));
|
||||||
|
@ -92,6 +113,7 @@ public:
|
||||||
pushButton_2->setText(QApplication::translate("MainWindow", "Close API", nullptr));
|
pushButton_2->setText(QApplication::translate("MainWindow", "Close API", nullptr));
|
||||||
pushButton_3->setText(QApplication::translate("MainWindow", "Setup USB", nullptr));
|
pushButton_3->setText(QApplication::translate("MainWindow", "Setup USB", nullptr));
|
||||||
pushButton_4->setText(QApplication::translate("MainWindow", "avrDebug()", nullptr));
|
pushButton_4->setText(QApplication::translate("MainWindow", "avrDebug()", nullptr));
|
||||||
|
pushButton_5->setText(QApplication::translate("MainWindow", "Get Scope Data", nullptr));
|
||||||
} // retranslateUi
|
} // retranslateUi
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
#include "librador_internal.h"
|
#include "librador_internal.h"
|
||||||
#include "usbcallhandler.h"
|
#include "usbcallhandler.h"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <QThread>
|
||||||
|
|
||||||
Librador::Librador()
|
Librador::Librador()
|
||||||
{
|
{
|
||||||
usb_driver = new usbCallHandler(LABRADOR_VID, LABRADOR_PID);
|
usb_driver = new usbCallHandler(LABRADOR_VID, LABRADOR_PID);
|
||||||
|
@ -56,3 +59,7 @@ int librador_avr_debug(){
|
||||||
CHECK_API_INITIALISED
|
CHECK_API_INITIALISED
|
||||||
return internal_librador_object->usb_driver->avrDebug();
|
return internal_librador_object->usb_driver->avrDebug();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<double> * librador_get_iso_data(int numToGet, int interval_samples, int delay_sample, int filter_mode){
|
||||||
|
return internal_librador_object->usb_driver->getMany_double(numToGet, interval_samples, delay_sample, filter_mode);
|
||||||
|
}
|
||||||
|
|
|
@ -7,5 +7,6 @@ int LIBRADORSHARED_EXPORT librador_init();
|
||||||
int LIBRADORSHARED_EXPORT librador_exit();
|
int LIBRADORSHARED_EXPORT librador_exit();
|
||||||
int LIBRADORSHARED_EXPORT librador_setup_usb();
|
int LIBRADORSHARED_EXPORT librador_setup_usb();
|
||||||
int LIBRADORSHARED_EXPORT librador_avr_debug();
|
int LIBRADORSHARED_EXPORT librador_avr_debug();
|
||||||
|
std::vector<double> * LIBRADORSHARED_EXPORT librador_get_iso_data(int numToGet, int interval_samples, int delay_sample, int filter_mode);
|
||||||
|
|
||||||
#endif // LIBRADOR_H
|
#endif // LIBRADOR_H
|
||||||
|
|
|
@ -15,10 +15,16 @@ static void LIBUSB_CALL isoCallback(struct libusb_transfer * transfer){
|
||||||
//TODO: a switch statement here to handle all the modes.
|
//TODO: a switch statement here to handle all the modes.
|
||||||
for(int i=0;i<transfer->num_iso_packets;i++){
|
for(int i=0;i<transfer->num_iso_packets;i++){
|
||||||
unsigned char *packetPointer = libusb_get_iso_packet_buffer_simple(transfer, i);
|
unsigned char *packetPointer = libusb_get_iso_packet_buffer_simple(transfer, i);
|
||||||
|
printf("Expected length is %d\n", transfer->length);
|
||||||
|
printf("Actual length is %d\n", transfer->actual_length);
|
||||||
|
for(int k=0; k<transfer->actual_length; k++){
|
||||||
|
printf("%d ", packetPointer[k]);
|
||||||
|
}
|
||||||
|
printf("\n");
|
||||||
internal_o1_buffer->addVector(packetPointer, 375);
|
internal_o1_buffer->addVector(packetPointer, 375);
|
||||||
}
|
}
|
||||||
printf("Re-arm the endpoint...\n");
|
printf("Re-arm the endpoint...\n");
|
||||||
int error = libusb_submit_transfer(transfer);
|
int error = 0;//libusb_submit_transfer(transfer);
|
||||||
if(error){
|
if(error){
|
||||||
printf("Error re-arming the endpoint!\n");
|
printf("Error re-arming the endpoint!\n");
|
||||||
}
|
}
|
||||||
|
@ -29,8 +35,8 @@ static void LIBUSB_CALL isoCallback(struct libusb_transfer * transfer){
|
||||||
void usb_polling_function(libusb_context *ctx){
|
void usb_polling_function(libusb_context *ctx){
|
||||||
printf("usb_polling_function thread spawned\n");
|
printf("usb_polling_function thread spawned\n");
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
tv.tv_sec = 0;
|
tv.tv_sec = 1;
|
||||||
tv.tv_usec = ISO_PACKETS_PER_CTX*4000;
|
tv.tv_usec = 0;//ISO_PACKETS_PER_CTX*4000;
|
||||||
while(1){
|
while(1){
|
||||||
printf("usb_polling_function begin loop\n");
|
printf("usb_polling_function begin loop\n");
|
||||||
if(libusb_event_handling_ok(ctx)){
|
if(libusb_event_handling_ok(ctx)){
|
||||||
|
@ -93,6 +99,14 @@ int usbCallHandler::setup_usb_control(){
|
||||||
return -3;
|
return -3;
|
||||||
} else printf("Interface claimed!\n");
|
} else printf("Interface claimed!\n");
|
||||||
|
|
||||||
|
error = libusb_set_interface_alt_setting(handle, 0, 0);
|
||||||
|
if(error){
|
||||||
|
printf("libusb_set_interface_alt_setting FAILED\n");
|
||||||
|
libusb_close(handle);
|
||||||
|
handle = NULL;
|
||||||
|
return -4;
|
||||||
|
} else printf("bAlternateSetting claimed!\n");
|
||||||
|
|
||||||
connected = true;
|
connected = true;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -181,3 +195,7 @@ int usbCallHandler::avrDebug(void){
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<double>* usbCallHandler::getMany_double(int numToGet, int interval_samples, int delay_sample, int filter_mode){
|
||||||
|
return internal_o1_buffer->getMany_double(numToGet, interval_samples, delay_sample, filter_mode);
|
||||||
|
}
|
||||||
|
|
|
@ -3,11 +3,12 @@
|
||||||
|
|
||||||
#include "libusb.h"
|
#include "libusb.h"
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#define NUM_ISO_ENDPOINTS 1
|
#define NUM_ISO_ENDPOINTS (1)
|
||||||
#define NUM_FUTURE_CTX 4
|
#define NUM_FUTURE_CTX (2)
|
||||||
#define ISO_PACKET_SIZE 750
|
#define ISO_PACKET_SIZE (750)
|
||||||
#define ISO_PACKETS_PER_CTX 33
|
#define ISO_PACKETS_PER_CTX (125)
|
||||||
|
|
||||||
//EVERYTHING MUST BE SENT ONE BYTE AT A TIME, HIGH AND LOW BYTES SEPARATE, IN ORDER TO AVOID ISSUES WITH ENDIANNESS.
|
//EVERYTHING MUST BE SENT ONE BYTE AT A TIME, HIGH AND LOW BYTES SEPARATE, IN ORDER TO AVOID ISSUES WITH ENDIANNESS.
|
||||||
typedef struct uds{
|
typedef struct uds{
|
||||||
|
@ -43,6 +44,7 @@ public:
|
||||||
int setup_usb_iso();
|
int setup_usb_iso();
|
||||||
int send_control_transfer(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA);
|
int send_control_transfer(uint8_t RequestType, uint8_t Request, uint16_t Value, uint16_t Index, uint16_t Length, unsigned char *LDATA);
|
||||||
int avrDebug(void);
|
int avrDebug(void);
|
||||||
|
std::vector<double> *getMany_double(int numToGet, int interval_samples, int delay_sample, int filter_mode);
|
||||||
bool connected;
|
bool connected;
|
||||||
private:
|
private:
|
||||||
unsigned short VID, PID;
|
unsigned short VID, PID;
|
||||||
|
|
Loading…
Reference in New Issue